1.1 --- a/wikiparser.py Sat Jan 10 15:11:34 2015 +0100
1.2 +++ b/wikiparser.py Mon Feb 02 15:18:19 2015 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Confluence Wiki syntax parsing.
1.6
1.7 -Copyright (C) 2012, 2013 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2012, 2013, 2015 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This software is free software; you can redistribute it and/or
1.11 modify it under the terms of the GNU General Public License as
1.12 @@ -425,7 +425,8 @@
1.13
1.14 "A parser for Confluence markup."
1.15
1.16 - def __init__(self):
1.17 + def __init__(self, is_comment_page=False):
1.18 + self.is_comment_page = is_comment_page
1.19 self.max_level = self.level = 0
1.20 self.in_heading = False
1.21 self.held_anchors = []
1.22 @@ -495,6 +496,8 @@
1.23
1.24 else:
1.25 prefix = "../"
1.26 + if self.is_comment_page:
1.27 + prefix += "../"
1.28
1.29 # Make the link tidier by making a target if none was given.
1.30
1.31 @@ -804,11 +807,11 @@
1.32 def forbids_macros(self):
1.33 return self.in_heading or self.macro
1.34
1.35 -def parse(s, out):
1.36 +def parse(s, out, is_comment_page=False):
1.37
1.38 "Parse the content in the string 's', writing a translation to 'out'."
1.39
1.40 - parser = ConfluenceParser()
1.41 + parser = ConfluenceParser(is_comment_page)
1.42 out.write(parser.parse_text(s, top=True))
1.43
1.44 if __name__ == "__main__":