Exemple #1
0
 def read(self, f):
     tokenizer = TexTokenizer(f)
     while 1:
         t = tokenizer.get()
         #      print repr(t)
         if not t: break
         self.feed(t)
     self.close()
     return
Exemple #2
0
        return


# main
if __name__ == "__main__":

    def usage():
        print "usage: latex2html.py [file.tex ...]"
        sys.exit(2)

    try:
        (opts, args) = getopt.getopt(sys.argv[1:], "")
    except getopt.GetoptError:
        usage()

    for n in (args or ["-"]):
        if n == "-":
            f = sys.stdin
        else:
            f = file(n)
        tokenizer = TexTokenizer(f)
        parser = ConvHTMLParser()
        print "<html>"
        while 1:
            t = tokenizer.get()
            if not t: break
            parser.feed(t)
        parser.close()
        print "</html>"
        f.close()