Check-in [5856b45662]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix new perl warnings
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5856b45662a2a78d3cd3abcafd6be5ebef077e31
User & Date: vitus@wagner.pp.ru 2017-07-17 18:17:07
Context
2017-07-17
18:27
Sync Tex2fb2 with spacians version check-in: c02a8003d5 user: vitus@wagner.pp.ru tags: trunk
18:17
Fix new perl warnings check-in: 5856b45662 user: vitus@wagner.pp.ru tags: trunk
2017-06-13
19:36
Typo fix check-in: 8eb0fcb219 user: vitus@wagner.pp.ru tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tex2fb2.

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
if ((/^$/ || $environ) && $buffer) {
#output on empty line (p or stanza) depending on poetry mode
	add_to_section(tag(flushbuffer($buffer),$poetry?"stanza":"p")."\n");
	$buffer="";
}
next LINE if $environ;
# Section headings
if (/\\(part|chapter|section|subsection|subsubsection)\*?{(.*)}/) {
	if ($buffer) {
		add_to_section(tag(flushbuffer($buffer),$poetry?"stanza":"p"));
		$buffer="";
	}
	pushsection($1,tag($2,"p"));
	next LINE;
}
if (/\\vspace{/) {
	add_to_section("<empty-line />");
	next LINE;
}
next LINE if /\\pagebreak\b/;
#replace ' and " with entities
s/&/&amp;/g;
s/'/&apos;/g;
s/"/&quot;/g;
s/</&lt;/g;
s/>/&gt;/g;
#normal mode: 
if (!$verbatim) {
#strip TeX comments 
s/([^\\])%.*$/$1/;
s/^%.*$//;
# strip \sloppy
s/\\sloppy\s+//g;
s/\\sloppy{}//g;
s/\\sloppy([^\w])/$1/g;
# strip extra space
s/^\s+//;
s/\s+$//;
s/(\s)\s+/$1/g;
#replace TeX ligatures ~ --- << >> \% with appropriate unicode symbols
s/~/\xA0/g;







|







|

















|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
if ((/^$/ || $environ) && $buffer) {
#output on empty line (p or stanza) depending on poetry mode
	add_to_section(tag(flushbuffer($buffer),$poetry?"stanza":"p")."\n");
	$buffer="";
}
next LINE if $environ;
# Section headings
if (/\\(part|chapter|section|subsection|subsubsection)\*?\{(.*)\}/) {
	if ($buffer) {
		add_to_section(tag(flushbuffer($buffer),$poetry?"stanza":"p"));
		$buffer="";
	}
	pushsection($1,tag($2,"p"));
	next LINE;
}
if (/\\vspace\{/) {
	add_to_section("<empty-line />");
	next LINE;
}
next LINE if /\\pagebreak\b/;
#replace ' and " with entities
s/&/&amp;/g;
s/'/&apos;/g;
s/"/&quot;/g;
s/</&lt;/g;
s/>/&gt;/g;
#normal mode: 
if (!$verbatim) {
#strip TeX comments 
s/([^\\])%.*$/$1/;
s/^%.*$//;
# strip \sloppy
s/\\sloppy\s+//g;
s/\\sloppy\{\}//g;
s/\\sloppy([^\w])/$1/g;
# strip extra space
s/^\s+//;
s/\s+$//;
s/(\s)\s+/$1/g;
#replace TeX ligatures ~ --- << >> \% with appropriate unicode symbols
s/~/\xA0/g;
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
		$_ = $poetic_buffer." ".$_;
		$poetic_buffer = undef;
	}
	if (/{[^}]+$/) {
		$poetic_buffer=$_;
		next LINE;
	}
	s/\\footnote{(.*)}/push_footnote($1)/e;
	s/\s*\\\\$//;
  $buffer.=tag($_,'v')."\n";
} elsif ($verbatim) {
	add_to_section(tag(tag($_,"code"),"p"));
} else {
  $buffer.=" ".$_;
}







|







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
		$_ = $poetic_buffer." ".$_;
		$poetic_buffer = undef;
	}
	if (/{[^}]+$/) {
		$poetic_buffer=$_;
		next LINE;
	}
	s/\\footnote\{(.*)\}/push_footnote($1)/e;
	s/\s*\\\\$//;
  $buffer.=tag($_,'v')."\n";
} elsif ($verbatim) {
	add_to_section(tag(tag($_,"code"),"p"));
} else {
  $buffer.=" ".$_;
}
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
	$content =~s/^\s+//s;
	return "" unless $content;
	return "<$name>$content</$name>";
}

sub flushbuffer {
	local $_ = shift;
	s/{\\(em|it|bf)(?:\s+|{})([^{}]+)}/<emphasis>$2<\/emphasis>/g;
	s/\\(emph|textit|textbf){([^{}]+)}/<emphasis>$2<\/emphasis>/g;
	s/\\footnote{(.*)}/push_footnote($1)/e;
	s/[{}]//g;
	return $_;
}


sub push_footnote {
	my $id = "note_".(++$idseq);







|
|
|







202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
	$content =~s/^\s+//s;
	return "" unless $content;
	return "<$name>$content</$name>";
}

sub flushbuffer {
	local $_ = shift;
	s/\{\\(em|it|bf)(?:\s+|\{\})([^{}]+)\}/<emphasis>$2<\/emphasis>/g;
	s/\\(emph|textit|textbf)\{([^{}]+)\}/<emphasis>$2<\/emphasis>/g;
	s/\\footnote\{(.*)\}/push_footnote($1)/e;
	s/[{}]//g;
	return $_;
}


sub push_footnote {
	my $id = "note_".(++$idseq);