Skip to content

Commit

Permalink
fix issue erikrose#44 so the parser.py script can be run from differe…
Browse files Browse the repository at this point in the history
…nt directories
  • Loading branch information
rvernica committed Jul 31, 2013
1 parent a30c1a0 commit 5d43461
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions parser.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# -*- coding: utf8 -*-
# -*- coding: utf-8 -*-

import time
start_time = time.time()

import os
dir = os.path.dirname(__file__)

# get the parser
from pijnu import makeParser
preprocessorGrammar = file("preprocessor.pijnu").read()
preprocessorGrammar = file(os.path.join(dir, "preprocessor.pijnu")).read()
makeParser(preprocessorGrammar)

mediawikiGrammar = file("mediawiki.pijnu").read()
mediawikiGrammar = file(os.path.join(dir, "mediawiki.pijnu")).read()
makeParser(mediawikiGrammar)

allowed_tags = ['p', 'span', 'b', 'i', 'small', 'center']
Expand Down Expand Up @@ -67,4 +70,4 @@
file("article.htm", "w").write(output.encode('UTF-8'))

end_time = time.time()
print "Parsed and rendered in", end_time - start_time, "s."
print "Parsed and rendered in", end_time - start_time, "s."

0 comments on commit 5d43461

Please sign in to comment.