| 1 | package TeX::AutoTeX::HyperTeX; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # $Id: HyperTeX.pm,v 1.10.2.7 2011/01/27 18:42:28 thorstens Exp $ | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # $Revision: 1.10.2.7 $ | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # $Source: /cvsroot/arxivlib/arXivLib/lib/TeX/AutoTeX/HyperTeX.pm,v $ | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # $Date: 2011/01/27 18:42:28 $ | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # $Author: thorstens $ | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | ### use warnings; | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | our ($VERSION) = '$Revision: 1.10.2.7 $' =~ m{ \$Revision: \s+ (\S+) }x; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub copy_source_from_hyper { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copy_source_from_hyper: not called CC=44 SCAR=75.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | my ($this_type, $file, $dir, $log, $local_hyper_transform) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $protect = q{}; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my $stripping = 0; | |||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | if ($this_type eq 'TYPE_LATEX' || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$this_type eq "TYPE_LATEX" or $this_type eq "TYPE_LATEX2e" or $this_type eq "TYPE_PDFLATEX"
$this_type eq "TYPE_LATEX" or $this_type eq "TYPE_LATEX2e"
MC/DC0%0/3
$this_type eq "TYPE_LATEX" or $this_type eq "TYPE_LATEX2e" or $this_type eq "TYPE_PDFLATEX"
$this_type eq "TYPE_LATEX"
$this_type eq "TYPE_LATEX2e"
$this_type eq "TYPE_PDFLATEX"
Truth table0%0/4
A or B or C
A= $this_type eq "TYPE_LATEX"B= $this_type eq "TYPE_LATEX2e"C= $this_type eq "TYPE_PDFLATEX"
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | $this_type eq 'TYPE_LATEX2e' || | ||||||||||||||||||||||||||||||||||||||||||
| 25 | $this_type eq 'TYPE_PDFLATEX') { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | $protect = '\\protect'; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | $stripping = 1; | |||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my $customfilter = 0; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | if (ref($local_hyper_transform) =~ /Filter/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $customfilter = 1; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | $local_hyper_transform->{protect} = $protect; | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my $checktexsis = 0; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ($file !~ /texsis/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $checktexsis = 1; | |||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | # aipproc often does not work with hypertex | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # supercite, crckapb10, crckapb..., lamuphys do not work with hypertex | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # heron2e.sty style does not work with hypertex | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $incompatiblemacropackages = qr/aipproc|supercite|crckapb|lamuphys|heron2e/; | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | open (my $WITH_HYPER, '>', "$dir/$file.with_hyper") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | || $log->error("failed to create '$file.with_hyper': $!"); | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | open (my $WITHOUT_HYPER, '>', "$dir/$file.without_hyper") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | || $log->error("failed to create '$file.without_hyper': $!"); | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | open (my $SOURCE, '<', "$dir/$file") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | || $log->error("failed to open latex source file '$file' for parsing: $!"); | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if ($stripping) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $pos = tell $SOURCE; | |||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | LEADINGCRUFT: while (<$SOURCE>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if (/^\s*[\\\{]/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | seek $SOURCE, $pos, 0; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | $.--; | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | last LEADINGCRUFT; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | $pos = tell $SOURCE | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $seen_doc_style_or_class; | |||||||||||||||||||||||||||||||||||||||||
| 66 | my $h_included; | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $try_amslplain = 0; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $dont_hypertex = 0; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | SOURCE: while (<$SOURCE>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | # look for commented out phyzzx reference | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | s/%macropackage=phyzzx/\\input\ phyzzx/; | |||||||||||||||||||||||||||||||||||||||||
| 74 | # Fix old versions of revtex by adding a version number | ||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | s/^(\s*\\documentstyle\s*\[.*)revtex(.*)\]\s*{aps}/$1aps$2,version2]{revtex}/; | |||||||||||||||||||||||||||||||||||||||||
| 76 | # convert \texsis to \input mtexsis | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | if ($checktexsis){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | s/(?<!\\def)\\texsis/\\input mtexsis/; | |||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | # include some stuff for hlatex2e - ignored by hlatex | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | if (!$h_included && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not $h_included and $seen_doc_style_or_class and /^[^%]*(?:\\newtheorem|\\begin\s*{document}|\\usepackage[^%{]*{amsrefs})/
not $h_included and $seen_doc_style_or_class
MC/DC0%0/3
not $h_included and $seen_doc_style_or_class and /^[^%]*(?:\\newtheorem|\\begin\s*{document}|\\usepackage[^%{]*{amsrefs})/
not $h_included
$seen_doc_style_or_class
/^[^%]*(?:\\newtheorem|\\begin\s*{document}|\\usepackage[^%{]*{amsrefs})/
Truth table0%0/4
not(A) and B and C
A= not $h_includedB= $seen_doc_style_or_classC= /^[^%]*(?:\\newtheorem|\\begin\s*{document}|\\usepackage[^%{]*{amsrefs})/
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | $seen_doc_style_or_class && | ||||||||||||||||||||||||||||||||||||||||||
| 84 | /^[^%]*(?:\\newtheorem|\\begin\s*{document}|\\usepackage[^%{]*{amsrefs})/) { | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if ($this_type eq 'TYPE_PDFLATEX') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | print {$WITH_HYPER} "\\RequirePackage[hyperindex,pdftex]{hyperref}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | print {$WITH_HYPER} "\\RequirePackage[hyperindex]{hyperref}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | $h_included = 1; | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if (/^[^%]*\\(?:documentstyle|documentclass|usepackage|input)([^%]*)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my $macrostring = $1; | |||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | if ($macrostring =~ /($incompatiblemacropackages)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | $dont_hypertex = nohypertex($log, $1); | |||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | # current (as of 10/2007) ws-procs9x6.cls, ws-procs10x7.sty ... | ||||||||||||||||||||||||||||||||||||||||||
| 99 | # do not work with hypertex. some previous versions were ok | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if ($macrostring =~ /ws-procs\d{1,2}x\d/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $dont_hypertex = nohypertex($log, 'ws-procs'); | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | if (/\\document(?:style|class)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | $seen_doc_style_or_class = 1; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | # look for amsppt style - it must be AMSTeX in disguise | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | if (s/^([^%]*\\documentstyle(\[.*])?\{amsppt\})/\\input\ amstex\n$1/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | $log->verbose('Whoahaa. This looks like AMSTeX not latex'); | |||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $this_type = 'TYPE_TEX'; # Passed back to calling routine at end | |||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if (/^[^%]*\\documentstyle(\[.*])?\{amsart\}/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | $log->verbose("File contains 'amsart' doc style. Will remember that and\n revert to amslplain should things fail"); | |||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $try_amslplain = 1; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | print {$WITHOUT_HYPER} $_; | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | # amslatex can now include hyper stuff | ||||||||||||||||||||||||||||||||||||||||||
| 120 | # TS: 12/09 should this test be limited to $. == 1 or $. < 5? | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | if (substr $_, 0, 5 eq '%&ams') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | s/^%&amslplain/\\input hyperlatex%/; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | s/^%&amstex/\\input hyperbasics%/; | |||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | # TS: 12/10 skip past verbatim environments. handles multiple | ||||||||||||||||||||||||||||||||||||||||||
| 127 | # consecutive verbatim environments on the same line (for those | ||||||||||||||||||||||||||||||||||||||||||
| 128 | # pathologically newline challenged OSes). does not bother parsing | ||||||||||||||||||||||||||||||||||||||||||
| 129 | # things interspersed, preceeding, or following the verbatim env on | ||||||||||||||||||||||||||||||||||||||||||
| 130 | # the same source line. a line for arXiv's parsing purposes is | ||||||||||||||||||||||||||||||||||||||||||
| 131 | # defined by unix line delimiter \n (012) | ||||||||||||||||||||||||||||||||||||||||||
| 132 | # FIXME: What other environments should be skipped? | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if (0 <= index $_, '\begin{verbatim}') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if (/^([^%]*(?:(?<=\\)%)*)*\\begin{verbatim}/gc) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | ▶ | if (0 <= index $_, '\end{verbatim}', 16 + pos) { # 16 == length '\begin{verbatim}' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | print {$WITH_HYPER} $_; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | next SOURCE; | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | print {$WITH_HYPER} $_; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | while (<$SOURCE>) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | print {$WITHOUT_HYPER} $_; | |||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if (0 <= (my $pos = rindex $_, '\end{verbatim}')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | pos = $pos + 14; # 14 == length '\end{verbatim}' | |||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | if (/\G([^%]*(?:(?<=\\)%)*)*\\begin{verbatim}/gc) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | print {$WITH_HYPER} $_; | |||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | print {$WITH_HYPER} $_; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | next SOURCE; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | print {$WITH_HYPER} $_; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | my $n = 0; # counter to prevent deep recursion | |||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | while (m!(^|[^{"]\s*)((ftp|http)://[^*)\s",>&;%]+)!i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $tex_url = $2; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | last if (/\\verb\*?\S\s*\Q$tex_url\E/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if ($tex_url =~ /\\\~\{?$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | s/\\\~\s*(\{\s*\}\s*)?/\$\\sim\$/g; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | m#(^|[^{]\s*)((ftp|http)://[^]*)\s",>&;]+)#i; | |||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $tex_url = $2; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $tex_url =~ s/^([^\{]+)\}.*/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $tex_url =~ s/^([^\[]+)\].*/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | $tex_url =~ s/^([^\$]+)\$[^\$]*$/$1/; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | while ($tex_url =~ tr/\}/\}/ > $tex_url =~ tr/\{/\{/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | last unless $tex_url =~ s/\}[^\}]*$//; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $tex_url =~ s/[\.\+\{\|\!\'\\]+(\[[^]]*\])?$//; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | s/\\verb(.)~\1/\$\\sim\$/g if | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | $tex_url =~ s/\\verb(.)~\1/\$\\sim\$/g; #/\verb|~| | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | s{/~}{/\$\\sim\$}g if $tex_url =~ s{/~}{/\$\\sim\$}g; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | # now $\sim$ -> \string~, and e.g. \_ -> \string_ | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | my $special_url = $tex_url; | |||||||||||||||||||||||||||||||||||||||||
| 178 | # $special_url =~ s/\\,//g; | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $special_url =~ s/\\lower[^{}]*\{([^{}]*)\}/$1/g; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $special_url =~ s/\\kern//g; | |||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $special_url =~ s/(\$\^?\\sim\$|\\symbol\{126\}|\\char\'176|\$\\(wide)?tilde\{[^\}]*\}\$|\\homepage)/\\string~/g; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | $special_url =~ s/(\\linebreak|\\\\)(\[[^]]*\])?//g; | |||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $special_url =~ s/\\([\W\_])(\s*\{\s*\}\s*)?/\\string$1/g; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $special_url =~ tr/\{\}//d; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | $special_url =~ s/\\mbox//g; | |||||||||||||||||||||||||||||||||||||||||
| 186 | # FIXME: TS 7/2007 | ||||||||||||||||||||||||||||||||||||||||||
| 187 | # \mbox is but one special case | ||||||||||||||||||||||||||||||||||||||||||
| 188 | # just skip out if we see any undesired character | ||||||||||||||||||||||||||||||||||||||||||
| 189 | # e.g. '\', '|', '^', '[', ']', '`', or at least any \<command>? | ||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | last if $n++ >= 5 && s/\Q$tex_url/$protect\\vrule width0pt$protect\\href\{$special_url}\{$tex_url}/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$n++ >= 5 and s/\Q$tex_url\E/$protect\\vrule width0pt$protect\\href{$special_url}{$tex_url}/
MC/DC0%0/2
$n++ >= 5 and s/\Q$tex_url\E/$protect\\vrule width0pt$protect\\href{$special_url}{$tex_url}/
$n++ >= 5
s/\Q$tex_url\E/$protect\\vrule width0pt$protect\\href{$special_url}{$tex_url}/
Truth table0%0/3
A and B
A= $n++ >= 5B= s/\Q$tex_url\E/$protect\\vrule width0pt$protect\\href{$special_url}{$tex_url}/
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if ($customfilter) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $_ = $local_hyper_transform->filter($_); | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | print {$WITH_HYPER} $_; | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | close $WITH_HYPER or $log->verbose("couldn't close source file with markup: $!"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | close $WITHOUT_HYPER or $log->verbose("couldn't close source file without markup: $!"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | close $SOURCE or $log->verbose("couldn't close source file: $!"); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | my $setbacktime = time - 5; | |||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | utime $setbacktime, $setbacktime, "$dir/$file", "$dir/$file.with_hyper", "$dir/$file.without_hyper"; | |||||||||||||||||||||||||||||||||||||||||
| 203 | # Pass back information about new identifications | ||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | return ($this_type, $dont_hypertex, $try_amslplain); | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | ▶ | sub nohypertex { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nohypertex: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my ($log, $msg) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $log->verbose("nohypertex: turning off hypertex because $msg does not work with hypertex"); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | __END__ | ||||||||||||||||||||||||||||||||||||||||||