LEFT | RIGHT |
(no file at all) | |
1 # Copyright: 2008 MoinMoin:BastianBlank | 1 # Copyright: 2008 MoinMoin:BastianBlank |
2 # Copyright: 2010-2011 MoinMoin:ThomasWaldmann | 2 # Copyright: 2010-2011 MoinMoin:ThomasWaldmann |
3 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. | 3 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details. |
4 | 4 |
5 """ | 5 """ |
6 MoinMoin - Include handling | 6 MoinMoin - Include handling |
7 | 7 |
8 Expands include elements in an internal Moin document. | 8 Expands include elements in an internal Moin document. |
9 | 9 |
10 Although this module is named include.py, many comments within and the moin docs | 10 Although this module is named include.py, many comments within and the moin docs |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 continue | 242 continue |
243 | 243 |
244 if xp_include_heading is not None: | 244 if xp_include_heading is not None: |
245 attrib = {self.tag_href: p_href} | 245 attrib = {self.tag_href: p_href} |
246 children = (xp_include_heading or page.name, ) | 246 children = (xp_include_heading or page.name, ) |
247 elem_a = ET.Element(self.tag_a, attrib, children=childre
n) | 247 elem_a = ET.Element(self.tag_a, attrib, children=childre
n) |
248 attrib = {self.tag_outline_level: xp_include_level or '1
'} | 248 attrib = {self.tag_outline_level: xp_include_level or '1
'} |
249 elem_h = ET.Element(self.tag_h, attrib, children=(elem_a
, )) | 249 elem_h = ET.Element(self.tag_h, attrib, children=(elem_a
, )) |
250 included_elements.append(elem_h) | 250 included_elements.append(elem_h) |
251 | 251 |
252 page_doc = page.internal_representation() | 252 page_doc = page.content.internal_representation() |
253 # page_doc.tag = self.tag_div # XXX why did we have this? | 253 # page_doc.tag = self.tag_div # XXX why did we have this? |
254 | 254 |
255 self.recurse(page_doc, page_href) | 255 self.recurse(page_doc, page_href) |
256 | 256 |
257 # if this is an existing item, mark it as a transclusion. n
on-existent items are not marked (page_doc.tag.name == u'a') | 257 # if this is an existing item, mark it as a transclusion. n
on-existent items are not marked (page_doc.tag.name == u'a') |
258 # The href needs to be an absolute URI, without the prefix "
wiki://" | 258 # The href needs to be an absolute URI, without the prefix "
wiki://" |
259 if page_doc.tag.name == u'page': | 259 if page_doc.tag.name == u'page': |
260 page_doc = mark_item_as_transclusion(page_doc, p_href.pa
th) | 260 page_doc = mark_item_as_transclusion(page_doc, p_href.pa
th) |
261 included_elements.append(page_doc) | 261 included_elements.append(page_doc) |
262 | 262 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 def __call__(self, tree): | 342 def __call__(self, tree): |
343 self.stack = [] | 343 self.stack = [] |
344 self.recurse(tree, None) | 344 self.recurse(tree, None) |
345 | 345 |
346 return tree | 346 return tree |
347 | 347 |
348 | 348 |
349 from . import default_registry | 349 from . import default_registry |
350 from MoinMoin.util.mime import Type, type_moin_document | 350 from MoinMoin.util.mime import Type, type_moin_document |
351 default_registry.register(Converter._factory, type_moin_document, type_moin_docu
ment) | 351 default_registry.register(Converter._factory, type_moin_document, type_moin_docu
ment) |
LEFT | RIGHT |