#!/bin/sh # latex2sep # simple script to convert latex files of entries for the Stanford Encyclopedia # into SEP-format HTML. Call as latex2sep , where is the name # (without .tex extension) of the latex file. Result will be in # /index.html # requires latex2html and GNU sed; see http://www.ucalgary.ca/~rzach/sep/ # Author: Richard Zach # v. 1 - Tue Jun 10 13:12:03 MDT 2003 # v. 1.1 - Tue Jul 1 18:13:44 MDT 2003 # Show usage if called without arguments if [ -z "$1" ]; then cat < EXAMPLE: latex2sep frege will convert frege.tex to HTML and do some SEP formatting on it; the result will be in frege/index.html Don't forget to latex and bibtex the file first to generate .aux, .toc, and .bbl files. HELP exit 0 fi # do the conversion latex2html -split 0 -lcase_tags -no_navigation -noaddress -noinfo -noaddress -html_version "4.0,math" $1.tex # remove index.html in the subdirectory generated rm $1/index.html # join lines broken at href=.. so we can remove name and # target attributes from links sed -e ':a; $!N;s/\n *[hH][rR][eE][fF]=/ href=/;ta;P;D' $1/$1.html >$1/index.html # join lines ending with an tag or an
or beginning with one # (headers etc on single line) sed -e :a -e '/<[ahp][^>]*>$/N; s/>\n/>/; ta' $1/index.html >$1/$1.html sed -e :a -e '$!N;s/\n<\//<\//;ta' -e 'P;D' $1/$1.html >$1/index.html # clean up some things: make `` and '' into ", take out tags, # class attributes etc, increase header level, make title not centered # remove target and name attributes (except for anchors) sed "s/\`\`/\"/g;s/''/\"/g;s/\`/\'/g;s/
//g;s/
/
  • /g;s/]*>/