-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbib2html
executable file
·28 lines (27 loc) · 950 Bytes
/
bib2html
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
27
28
#run via make html
b=$Bob/bibshell
mkdir -p $Bob
echo "\documentclass{article} \
\usepackage[utf8]{inputenc} \
\usepackage{natbib} \
\begin{filecontents}{\jobname.bib} " > $b.tex
cat $Bib_file >> $b.tex
echo "\end{filecontents}" >>$b.tex
echo "\begin{document} \
\nocite{*} \
\bibliographystyle{$Bibstyle} \
\bibliography{\jobname} \
\end{document}" >>$b.tex
cd $Bob
rm -f $b.bib
latex $b
bibtex bibshell
sed -e "/thebibliography/d" -e '/\\providecommand/d' -e '/\\expandafter/d' < $b.bbl | \
tr -d '\n' | \
sed -e 's/\\bibitem[^]]*]{\([^}]*\)}/<\/p><p> [<a name="\1">\1<\/a>] /g' -e "s/\\newblock//g" \
-e 's/\\newblock//g' -e "s/~/ /g" -e"s|\\\\/||g" \
-e 's/\%\([^ \t\n]\)/\1/g' \
-e 's/{\\em \([^}]*\)}/<em>\1<\/em>/g' \
-e 's/{\\emph \([^}]*\)}/<em>\1<\/em>/g' \
-e 's/\\cite.{\([^}]*\)}/<a href="#\1">\1<\/a>/g' \
-e 's/[{}]//g' -e 's/\\[^ ]*//g' > $b.html