changeset 150:3f6de4cba30b

fixed MoinMoinBugs/DiffAnchorOffset imported from: moin--main--1.5--patch-152
author Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
date Fri, 28 Oct 2005 11:04:05 +0000
parents c5b967d9d1e6
children 226b379bde22
files MoinMoin/Page.py MoinMoin/parser/wiki.py
diffstat 2 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Fri Oct 28 10:19:57 2005 +0000
+++ b/MoinMoin/Page.py	Fri Oct 28 11:04:05 2005 +0000
@@ -970,6 +970,7 @@
         pi_refresh = None
         pi_formtext = []
         pi_formfields = []
+        pi_lines = 0
         wikiform = None
 
         # check for XML content
@@ -978,6 +979,8 @@
 
         # check processing instructions
         while body and body[0] == '#':
+            pi_lines += 1
+            
             # extract first line
             try:
                 line, body = body.split('\n', 1)
@@ -1204,7 +1207,9 @@
         else:
             # parse the text and send the page content
             self.send_page_content(request, Parser, body,
-                                   format_args=pi_formatargs, do_cache=do_cache)
+                                   format_args=pi_formatargs,
+                                   do_cache=do_cache,
+                                   start_line=pi_lines)
 
             # check for pending footnotes
             if getattr(request, 'footnotes', None):
@@ -1271,7 +1276,7 @@
         return False
 
     def send_page_content(self, request, Parser, body, format_args='',
-                          do_cache=1):
+                          do_cache=1, **kw):
         """ Output the formatted wiki page, using caching if possible
 
         @param request: the request object
@@ -1281,7 +1286,7 @@
         @param do_cache: if True, use cached content
         """
         request.clock.start('send_page_content')
-        parser = Parser(body, request, format_args=format_args)
+        parser = Parser(body, request, format_args=format_args, **kw)
 
         if not (do_cache and self.canUseCache(Parser)):
             self.format(parser)
--- a/MoinMoin/parser/wiki.py	Fri Oct 28 10:19:57 2005 +0000
+++ b/MoinMoin/parser/wiki.py	Fri Oct 28 11:04:05 2005 +0000
@@ -108,6 +108,7 @@
         self.cfg = request.cfg
         self.line_anchors = kw.get('line_anchors', True)
         self.macro = None
+        self.start_line = kw.get('start_line', 0)
 
         self.is_em = 0
         self.is_b = 0
@@ -922,7 +923,7 @@
         rawtext = self.raw.expandtabs()
 
         # go through the lines
-        self.lineno = 0
+        self.lineno = self.start_line
         self.lines = eol_re.split(rawtext)
         self.line_is_empty = 0