changeset 2556:f56612ff00b3

merge - backs out 6c8c378 fix for 500 error on rst images in favor of sharky93 fix for same. former uses xinclude, latter xlink
author RogerHaase <haaserd@gmail.com>
date Sun, 09 Feb 2014 13:23:19 -0700
parents 98ab35b03176 (current diff) 2581df6b3483 (diff)
children 46ed410e111a
files MoinMoin/converter/_tests/test_rst_in.py MoinMoin/converter/rst_in.py
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/rst_in.py	Sun Feb 09 12:57:50 2014 -0700
+++ b/MoinMoin/converter/rst_in.py	Sun Feb 09 13:23:19 2014 -0700
@@ -25,11 +25,12 @@
 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
@@ -56,6 +57,8 @@
         self.header_size = 1
         self.status = ['document']
         self.footnotes = dict()
+        self.last_lineno = 0
+        self.current_lineno = 0
 
     def dispatch_visit(self, node):
         """
@@ -65,6 +68,7 @@
         """
         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):
@@ -94,6 +98,11 @@
         pass
 
     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.append(mointree_element)
         self.current_node = mointree_element
         self.path.append(mointree_element)