Skip to content

Commit

Permalink
further patch to complete djvu support, and further fixes relating to…
Browse files Browse the repository at this point in the history
… some rare bibtex linebreaks
  • Loading branch information
Mark Jelasity committed Jun 11, 2012
1 parent 2372f5a commit 2790a02
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions bib2xhtml.pl
Original file line number Diff line number Diff line change
Expand Up @@ -832,14 +832,14 @@ sub utf_ent {
if (defined($opt_e)) {
my(@opts) = split(/,/, $opt_e);
for $opt (@opts) {
if ($opt =~ m/(PostScript|PDF|DVI|DOI):(.*)/) {
if ($opt =~ m/(PostScript|PDF|DVI|DOI|DJVU):(.*)/) {
$typeicon{$1} = $2;
} elsif ($opt =~ m/(notype|nosize|nopages|nocompression|nodoi|nobrackets)/) {
eval "\$$1 = 1";
} else {
print STDERR qq{Invalid extended information specification: $opt
This can be a comma-separated list of the following specifications:
PostScript|PDF|DVI|DOI:new-text (e.g. PDF file icon)
PostScript|PDF|DVI|DOI|DJVU:new-text (e.g. PDF file icon)
notype|nosize|nopages|nocompression|nodoi|nobrackets
};
exit 1;
Expand Down Expand Up @@ -1005,7 +1005,7 @@ sub utf_ent {
if (defined($opt_R)) {
open(BBLFILE, "<$t") || die "error opening $t: $!\n";
while (<BBLFILE>) {
($bcite, $blabel) = m+<dt><a name=\"([^\"]*)\">\[([^\]]*)\]</a></dt><dd>+;
($bcite, $blabel) = m+name=\"([^\"]*)\">\[([^\]]*)\]</a></dt><dd>+;
if ($bcite) {
$ntotent++;
}
Expand Down Expand Up @@ -1093,33 +1093,35 @@ sub utf_ent {

# Adjust beginning of entry based on bibliography style.
if ($label_style == $LABEL_PLAIN) {
s:<dt>(<a name=\"[^\"]*\">)\[[^\]]*\](</a>)</dt><dd>:<li>$1$2:;
s:</dd>:</li>:;
s+<dt><a+<li><a+;
s+(name=\"[^\"]*\">)\[[^\]]*\](</a>)</dt><dd>+$1$2+;
s+</dd>+</li>+;

# Attempt to fix up empty <a name=...></a> tag, which some browsers
# don't handle properly (even though it *is* legal HTML).
# First try to combine a <a name=...></a> with a following <A ".
s:(<a name=\"[^\"]*\")></a><a\b:$1:
s+(name=\"[^\"]*\")></a><a\b+$1+
# If that doesn't work, try to swallow following word.
or s:(<a name=\"[^\"]*\">)</a>([\w]+):$1$2<\/a>:;
or s:(name=\"[^\"]*\">)</a>([\w]+):$1$2<\/a>:;
} elsif ($label_style == $LABEL_PARAGRAPH) {
s:<dt>(<a name=\"[^\"]*\">)\[[^\]]*\](</a>)</dt><dd>:<p>$1$2:;
s:</dd>:</p>:;
s+<dt><a+<p><a+;
s+(name=\"[^\"]*\">)\[[^\]]*\](</a>)</dt><dd>+$1$2+;
s+</dd>+</p>+;

# Attempt to fix up empty <a name=...></a> tag, which some browsers
# don't handle properly (even though it *is* legal HTML).
# First try to combine a <a name=...></a> with a following <A ".
s:(<a name=\"[^\"]*\")></a><a\b:$1:
s+(name=\"[^\"]*\")></a><a\b+$1+
# If that doesn't work, try to swallow following word.
or s:(<a name=\"[^\"]*\">)</a>([\w]+):$1$2<\/a>:;
or s:(name=\"[^\"]*\">)</a>([\w]+):$1$2<\/a>:;
} elsif ($label_style == $LABEL_NUMBERED) {
s:(<dt><a name=\"[^\"]*\">\[)[^\]]*(\]</a></dt><dd>):$1$nentryp$2:;
s+(name=\"[^\"]*\">\[)[^\]]*(\]</a></dt><dd>)+$1$nentryp$2+;
}

# Append the key name, if asked so
if ($opt_k && ($label_style == $LABEL_NUMBERED || $label_style == $LABEL_DEFAULT)) {
# $1 $2 $3 $4 $5
s:(<dt><a name=\")([^\"]*)(\">\[)([^\]]*)(\]</a></dt><dd>):$1$2$3$4 --- $2$5:;
# $1 $2 $3 $4 $5
s+(name=\")([^\"]*)(\">\[)([^\]]*)(\]</a></dt><dd>)+$1$2$3$4 --- $2$5+;
}

# Attempt to fix up crossrefs.
Expand Down

0 comments on commit 2790a02

Please sign in to comment.