|
86 | 86 | # the \W prefix is ignored except in HTML; in HTML the last part |
87 | 87 | # becomes a hyperlink to the first part. |
88 | 88 | # |
| 89 | +# Web URL \w{http://foobar/} |
| 90 | +# equivalent to \W{http://foobar}\c{http://foobar/}. |
| 91 | +# |
89 | 92 | # Literals \{ \} \\ |
90 | 93 | # In case it's necessary, they expand to the real versions. |
91 | 94 | # |
|
123 | 126 | # insert the {something} string associated with metadata {key} |
124 | 127 | # |
125 | 128 | # Include subfile |
126 | | -# \&{filename} |
127 | | -# Includes filename. Recursion is allowed. |
| 129 | +# \& filename |
| 130 | +# includes filename. Recursion is allowed. Must be on a separate line. |
128 | 131 | # |
129 | 132 |
|
130 | 133 | use File::Spec; |
@@ -474,22 +477,31 @@ sub got_para { |
474 | 477 | die "badly formatted \\k: \\k$_\n" if !/\{([^\}]*)\}(.*)$/; |
475 | 478 | $_ = $2; |
476 | 479 | push @$para,"$t$1"; |
477 | | - } elsif (/^\\W/) { |
478 | | - s/^\\W//; |
479 | | - die "badly formatted \\W: \\W$_\n" |
480 | | - if !/\{([^\}]*)\}(\\i)?(\\c)?\{(([^\\}]|\\.)*)\}(.*)$/; |
481 | | - $l = $1; |
482 | | - $w = $4; |
483 | | - $_ = $6; |
484 | | - $t = "w "; |
485 | | - $t = "wc" if $3 eq "\\c"; |
486 | | - $indexing = 1 if $2; |
487 | | - $w =~ s/\\\{/\{/g; |
488 | | - $w =~ s/\\\}/\}/g; |
489 | | - $w =~ s/\\-/-/g; |
490 | | - $w =~ s/\\\\/\\/g; |
491 | | - push(@$para, addidx($node, $w, "c $w")) if $indexing; |
492 | | - push(@$para, "$t<$l>$w"); |
| 480 | + } elsif (/^\\[Ww]/) { |
| 481 | + if (/^\\w/) { |
| 482 | + die "badly formatted \\w: $_\n" |
| 483 | + if !/^\\w(\\i)?\{([^\\}]*)\}(.*)$/; |
| 484 | + $l = $2; |
| 485 | + $w = $2; |
| 486 | + $indexing = $1; |
| 487 | + $c = 1; |
| 488 | + $_ = $3; |
| 489 | + } else { |
| 490 | + die "badly formatted \\W: $_\n" |
| 491 | + if !/^\\W\{([^\\}]*)\}(\\i)?(\\c)?\{(([^\\}]|\\.)*)\}(.*)$/; |
| 492 | + $l = $1; |
| 493 | + $w = $4; |
| 494 | + $_ = $6; |
| 495 | + $indexing = $2; |
| 496 | + $c = $3; |
| 497 | + } |
| 498 | + $t = $c ? 'wc' : 'w '; |
| 499 | + $w =~ s/\\\{/\{/g; |
| 500 | + $w =~ s/\\\}/\}/g; |
| 501 | + $w =~ s/\\-/-/g; |
| 502 | + $w =~ s/\\\\/\\/g; |
| 503 | + push(@$para, addidx($node, $w, "c $w")) if $indexing; |
| 504 | + push(@$para, "$t<$l>$w"); |
493 | 505 | } else { |
494 | 506 | die "what the hell? $_\n" if !/^(([^\s\\\-]|\\[\\{}\-])*-?)(.*)$/; |
495 | 507 | die "painful death! $_\n" if !length $1; |
|
0 commit comments