File: notes

package info (click to toggle)
libbibtex-parser-perl 1.03%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 260 kB
  • sloc: perl: 1,379; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 655 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from Biblio::Catalog::BibTeX :

sub tex2html {
    my $latex = shift;
    return "" unless defined($latex);

    for ($latex) {
        s/\\textit\{([^{]+)\}/<i>$1<\/i>/g;
        s/\\textbf\{([^{]+)\}/<b>$1<\/b>/g;
        s/\\texttt\{([^{]+)\}/<tt>$1<\/tt>/g;
        s/\\emph{([^{]+)}/<i>$1<\/i>/g;
        s/\\item\b/<li>/g;
        s/\\_/_/g;
        s/\\mbox{([^}]+)}/$1/g;
        s/{\\it\s([^}]+)}/<i>$1<\/i>/g;
        s/\\LaTeX/LaTeX/g;
        s/\\begin{itemize}/<ul>/g;
        s/\\begin{quote}/<blockquote><i>/g;
        s/\\end{quote}/<\/i><\/blockquote>/g;
        s/\\end{itemize}/<\/ul>/g;
        s/[}{]//g;
    }

    return $latex;
}