Roger Haase committed f56612f Merge

merge - backs out 6c8c378 fix for 500 error on rst images in favor of sharky93 fix for same. former uses xinclude, latter xlink

Comments (0)

Files changed (2)


File contents unchanged.


 from MoinMoin import log
 logging = log.getLogger(__name__)
+from flask import request
 from flask import g as flaskg
 from MoinMoin import config
 from MoinMoin.util.iri import Iri
-from MoinMoin.util.tree import html, moin_page, xlink
+from MoinMoin.util.tree import html, moin_page, xlink, xinclude
 from MoinMoin.constants.contenttypes import CHARSET
 from ._util import allowed_uri_scheme, decode_data, normalize_split_text
         self.header_size = 1
         self.status = ['document']
         self.footnotes = dict()
+        self.last_lineno = 0
+        self.current_lineno = 0
     def dispatch_visit(self, node):
         node_name = node.__class__.__name__
         method = getattr(self, 'visit_' + node_name, self.unknown_visit)
+        self.current_lineno = node.line
         return method(node)
     def dispatch_departure(self, node):
     def open_moin_page_node(self, mointree_element):
+        if request.user_agent and flaskg.user.edit_on_doubleclick:
+            # add data-lineno attribute for auto-scrolling edit textarea (user_agent is None when running tests)
+            if self.last_lineno < self.current_lineno:
+                mointree_element.attrib[html.data_lineno] = self.current_lineno
+                self.last_lineno = self.current_lineno
         self.current_node = mointree_element