[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: @ref in @multitable broken in Info output if split across lines
From: |
Gavin Smith |
Subject: |
Re: @ref in @multitable broken in Info output if split across lines |
Date: |
Sun, 8 Feb 2015 14:42:56 +0000 |
On Fri, Feb 6, 2015 at 11:54 PM, Karl Berry <address@hidden> wrote:
> Possibly any xref command inside a multitable should be implicitly
> handled as if enclosed in @w, to avoid the unable-to-find-the-reference
> problem.
Here's a possible fix.
Index: Plaintext.pm
===================================================================
--- Plaintext.pm (revision 6106)
+++ Plaintext.pm (working copy)
@@ -2013,6 +2013,26 @@ sub _convert($$)
$args[3] = $args[2];
$args[2] = undef;
}
+
+ # Treat cross-reference commands in a multitable cell as if they
+ # were surrounded by @w{ ... }, so the output will not be split across
+ # lines, leading text from other columns appearing to be part of the
+ # cross-reference.
+ #
+ # Normally in this case, $self->{'format_context'}->[-2]->{'cmdname'}
+ # is 'multitable' and $self->{'format_context'}->[-1]->{'cmdname'} is
+ # one of 'headitem', 'item' and 'tab', but it is possible for other
+ # contexts to follow (like 'quotation'). Hence we check if
+ # 'multitable' occurs anywhere in the stack of format contexts.
+ my $in_multitable = 0;
+ if (grep {$_->{'cmdname'} eq 'multitable'}
@{$self->{'format_context'}}) {
+ $in_multitable = 1;
+ $formatter->{'w'}++;
+ $result .= $self->_count_added($formatter->{'container'},
+ $formatter->{'container'}->set_space_protection(1,undef))
+ if ($formatter->{'w'} == 1);
+ }
+
if ($command eq 'xref') {
$result = $self->_convert({'contents' => [{'text' => '*Note '}]});
} else {
@@ -2112,6 +2132,13 @@ sub _convert($$)
unshift @{$self->{'current_contents'}->[-1]}, @added;
}
}
+
+ if ($in_multitable) {
+ $formatter->{'w'}--;
+ $result .= $self->_count_added($formatter->{'container'},
+ $formatter->{'container'}->set_space_protection(0,undef))
+ if ($formatter->{'w'} == 0);
+ }
return $result;
}
return '';
- Re: @ref in @multitable broken in Info output if split across lines, Gavin Smith, 2015/02/06
- Re: @ref in @multitable broken in Info output if split across lines, Gavin Smith, 2015/02/06
- Re: @ref in @multitable broken in Info output if split across lines, Karl Berry, 2015/02/06
- Re: @ref in @multitable broken in Info output if split across lines, Gavin Smith, 2015/02/07
- Re: @ref in @multitable broken in Info output if split across lines,
Gavin Smith <=
- Re: @ref in @multitable broken in Info output if split across lines, Karl Berry, 2015/02/08
- Re: @ref in @multitable broken in Info output if split across lines, Patrice Dumas, 2015/02/08
- Re: @ref in @multitable broken in Info output if split across lines, Karl Berry, 2015/02/10
- Re: @ref in @multitable broken in Info output if split across lines, Gavin Smith, 2015/02/11
- Re: @ref in @multitable broken in Info output if split across lines, Patrice Dumas, 2015/02/11