annotate MoinMoin/formatter/text_gedit.py @ 2781:5507fdc7fe87

gedit formatter: use new transclusion syntax for attachment_inline when feeding gui editor
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 28 Aug 2007 14:15:07 +0200
parents 28b851be0844
children e1ce3040fcd6
rev   line source
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
2 """
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
3 MoinMoin - "text/html+css" Formatter for feeding the GUI editor
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1910
diff changeset
5 @copyright: 2005-2006 Bastian Blank, Florian Festi, Thomas Waldmann, Reimar Bauer
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
7 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
8
661
19ef5f9fff84 moved formatter.base to formatter.__init__
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 652
diff changeset
9 from MoinMoin.formatter import FormatterBase, text_html
1791
6dd2e29acffe Eclipse PyDev Check: fixed lots of its errors and warnings
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1739
diff changeset
10 from MoinMoin import wikiutil
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
11 from MoinMoin.Page import Page
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
12 from MoinMoin.action import AttachFile
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
13
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
14 class Formatter(text_html.Formatter):
528
92faed4fbd76 updated i18n, fix orig. text typo
Thomas Waldmann <tw@waldmann-edv.de>
parents: 410
diff changeset
15 """ Send HTML data for the GUI editor """
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
16
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
17 # Block elements ####################################################
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
18
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
19 def heading(self, on, depth, **kw):
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
20 # remember depth of first heading, and adapt counting depth accordingly
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
21 if not self._base_depth:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
22 self._base_depth = depth
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
23
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
24 count_depth = max(depth - (self._base_depth - 1), 1)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
25 heading_depth = depth + 1
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
26
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
27 # closing tag, with empty line after, to make source more readable
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
28 if not on:
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
29 return self._close('h%d' % heading_depth)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
30 else:
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
31 return self._open('h%d' % heading_depth, **kw)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
32
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
33 # Links ##############################################################
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
34
139
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
35 def pagelink(self, on, pagename='', page=None, **kw):
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
36 """ Link to a page.
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
37
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
38 formatter.text_python will use an optimized call with a page!=None
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
39 parameter. DO NOT USE THIS YOURSELF OR IT WILL BREAK.
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
40
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
41 See wikiutil.link_tag() for possible keyword parameters.
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
42 """
1182
5de0dc972701 removed deprecated usage of apply()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 999
diff changeset
43 FormatterBase.pagelink(self, on, pagename, page, **kw)
139
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
44 if page is None:
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
45 page = Page(self.request, pagename, formatter=self)
139
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
46 return page.link_to(self.request, on=on, **kw)
639dc94d4c52 fixed MoinMoinBugs/GUIEditorInsertsQuestionmark
Florian Festi <Florian.Festi@trick.informatik.uni-stuttgart.de>
parents: 36
diff changeset
47
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
48 def interwikilink(self, on, interwiki='', pagename='', **kw):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
49 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
50 @keyword title: override using the interwiki wikiname as title
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
51 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
52 if not on:
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
53 return self.url(0) # return '</a>'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
54 html_class = 'badinterwiki' # we use badinterwiki in any case to simplify reverse conversion
652
483d2c0ee1f4 fix deletion of empty interwiki links (backport to 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 639
diff changeset
55 href = wikiutil.quoteWikinameURL(pagename) or "/" # FCKeditor behaves strange on empty href
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
56 title = kw.get('title', interwiki)
1816
4a31739bc6e1 Page.url(): removed escaping support
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1791
diff changeset
57 return self.url(1, href, title=title, css=html_class) # interwiki links with pages with umlauts
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
58
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
59 def attachment_inlined(self, url, text, **kw):
2780
28b851be0844 fix gui editot formatter XSS issues
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2779
diff changeset
60 url = wikiutil.escape(url)
28b851be0844 fix gui editot formatter XSS issues
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2779
diff changeset
61 text = wikiutil.escape(text)
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
62 if url == text:
2781
5507fdc7fe87 gedit formatter: use new transclusion syntax for attachment_inline when feeding gui editor
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2780
diff changeset
63 return '<span style="background-color:#ffff11">{{attachment:%s}}</span>' % url
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
64 else:
2781
5507fdc7fe87 gedit formatter: use new transclusion syntax for attachment_inline when feeding gui editor
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2780
diff changeset
65 return '<span style="background-color:#ffff11">{{attachment:%s|%s}}</span>' % (url, text)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
66
2701
398af77c7ede fixed attachment_link api - it now has a 'on' parameter like most of the other methods
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
67 def attachment_link(self, on, url=None, **kw):
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
68 _ = self.request.getText
2701
398af77c7ede fixed attachment_link api - it now has a 'on' parameter like most of the other methods
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
69 if on:
398af77c7ede fixed attachment_link api - it now has a 'on' parameter like most of the other methods
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
70 pagename = self.page.page_name
398af77c7ede fixed attachment_link api - it now has a 'on' parameter like most of the other methods
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
71 target = AttachFile.getAttachUrl(pagename, url, self.request)
398af77c7ede fixed attachment_link api - it now has a 'on' parameter like most of the other methods
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
72 return self.url(on, target, title="attachment:%s" % wikiutil.quoteWikinameURL(url))
398af77c7ede fixed attachment_link api - it now has a 'on' parameter like most of the other methods
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
73 else:
398af77c7ede fixed attachment_link api - it now has a 'on' parameter like most of the other methods
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
74 return self.url(on)
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
75
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
76 def attachment_image(self, url, **kw):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
77 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
78 pagename = self.page.page_name
1734
db207703e114 text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1726
diff changeset
79 kw = {}
db207703e114 text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1726
diff changeset
80 kw['title'] = "attachment:%s" % wikiutil.quoteWikinameURL(url)
db207703e114 text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1726
diff changeset
81 if '/' in url:
db207703e114 text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1726
diff changeset
82 pagename, target = AttachFile.absoluteName(url, pagename)
1739
aef7aa0effc3 text_gedit formatter, ImageLink: minor optimizations
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1738
diff changeset
83 url = url.split('/')[-1]
1734
db207703e114 text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1726
diff changeset
84 kw['src'] = AttachFile.getAttachUrl(pagename, url, self.request, addts=1)
db207703e114 text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1726
diff changeset
85 return self.image(**kw)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
86
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
87 def attachment_drawing(self, url, text, **kw):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
88 _ = self.request.getText
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
89 pagename = self.page.page_name
281
8155e50e94ca fixed crash with non-ASCII attachment filename
Thomas Waldmann <tw@waldmann-edv.de>
parents: 277
diff changeset
90 image = url + u'.png'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
91 return self.image(
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
92 title="drawing:%s" % wikiutil.quoteWikinameURL(url),
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
93 src=AttachFile.getAttachUrl(pagename, image, self.request, addts=1))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
94
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
95 def nowikiword(self, text):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
96 return '<span style="background-color:#ffff11">!</span>' + self.text(text)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
97
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
98 # Dynamic stuff / Plugins ############################################
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
99
2779
c9dd12befda7 wiki parser: match everything looking like a macro and either execute it (macro imports ok) or render the macro markup as text (macro import fails, error msg is in title). This makes scan_rules independent of wiki, so we can move all re.compile time to Parser class (doing it only once on module import time).
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2733
diff changeset
100 def macro(self, macro_obj, name, args, markup=None):
1704
fe19c9ac4b82 text_gedit: Feature scalable images for gui added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1650
diff changeset
101 #use ImageLink for resized images
fe19c9ac4b82 text_gedit: Feature scalable images for gui added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1650
diff changeset
102 if name == "ImageLink" and args is not None:
2028
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
103
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
104 from MoinMoin.macro import ImageLink
1704
fe19c9ac4b82 text_gedit: Feature scalable images for gui added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1650
diff changeset
105 pagename = self.page.page_name
2028
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
106
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
107 kwAllowed = ['width', 'height', 'alt']
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
108 pp, pp_count, kw, kw_count = ImageLink.explore_args(args, kwAllowed)
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
109
1723
4916528e1cd7 text_gedit: displays now images from subpages and http sources
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1722
diff changeset
110 kw['src'] = None
2028
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
111 url = None
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
112
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
113 if pp_count >= 1:
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
114 url = pp[0]
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
115
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
116 if pp_count == 2:
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
117 kw['target'] = pp[1]
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
118
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
119 if ImageLink._is_URL(url):
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
120 kw['src'] = url
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
121 kw['title'] = url
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
122 else:
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
123 kw['title'] = "attachment:%s" % wikiutil.quoteWikinameURL(url)
8383e7156ef5 ImageLink, text_gedit: refactored
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1918
diff changeset
124
1738
7ac15b5e2db8 text_gedit formatter, ImageLink: minor optimizations
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1734
diff changeset
125 if kw['src'] is None:
1734
db207703e114 text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1726
diff changeset
126 if '/' in url:
db207703e114 text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1726
diff changeset
127 pagename, target = AttachFile.absoluteName(url, pagename)
1738
7ac15b5e2db8 text_gedit formatter, ImageLink: minor optimizations
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1734
diff changeset
128 url = url.split('/')[-1]
1726
810a5856c94c text_gedit:bug with wrong used splitting for subpages removed, now the w/h frame for images from other pages is shown, saving of changes works well. ToDo: find out how an image could be shown from an other page without changing the pagename from within the gui editor.
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1723
diff changeset
129 kw['src'] = AttachFile.getAttachUrl(pagename, url, self.request, addts=1)
1722
366650d8772b ImageLink gui formatter/converter roundtrip: fixed width/height/alt bugs
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1706
diff changeset
130 return self.image(**kw)
1704
fe19c9ac4b82 text_gedit: Feature scalable images for gui added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1650
diff changeset
131
2779
c9dd12befda7 wiki parser: match everything looking like a macro and either execute it (macro imports ok) or render the macro markup as text (macro import fails, error msg is in title). This makes scan_rules independent of wiki, so we can move all re.compile time to Parser class (doing it only once on module import time).
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2733
diff changeset
132 elif markup is not None:
c9dd12befda7 wiki parser: match everything looking like a macro and either execute it (macro imports ok) or render the macro markup as text (macro import fails, error msg is in title). This makes scan_rules independent of wiki, so we can move all re.compile time to Parser class (doing it only once on module import time).
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2733
diff changeset
133 result = markup
1704
fe19c9ac4b82 text_gedit: Feature scalable images for gui added
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 1650
diff changeset
134 elif args is not None:
2725
388204baf00f change [[macro]] to <<macro>> in all built-in markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
135 result = "<<%s(%s)>>" % (name, args)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
136 else:
2725
388204baf00f change [[macro]] to <<macro>> in all built-in markup
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2028
diff changeset
137 result = "<<%s>>" % name
2780
28b851be0844 fix gui editot formatter XSS issues
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2779
diff changeset
138 return '<span style="background-color:#ffff11">%s</span>' % wikiutil.escape(result)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
139
639
a80a6c629bc3 remove processor support, use a parser now
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 573
diff changeset
140 def parser(self, parser_name, lines):
a80a6c629bc3 remove processor support, use a parser now
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 573
diff changeset
141 """ parser_name MUST be valid!
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
142 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
143 result = [self.preformatted(1)]
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
144 for line in lines:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
145 result.append(self.text(line))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
146 result.append(self.linebreak(preformatted=1))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
147 result.append(self.preformatted(0))
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
148
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
149 return "".join(result)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
150
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
151 # Other ##############################################################
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
152
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
153 style2attribute = {
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
154 'width': 'width',
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
155 'height': 'height',
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
156 'background': 'bgcolor',
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
157 'background-color': 'bgcolor',
277
08778f685aaf begin fixing http://moinmoin.wikiwikiweb.de/MoinMoinBugs/GuiEditorDestroysTableStyles (incomplete)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 159
diff changeset
158 #if this is used as table style="text-align: right", it doesn't work
08778f685aaf begin fixing http://moinmoin.wikiwikiweb.de/MoinMoinBugs/GuiEditorDestroysTableStyles (incomplete)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 159
diff changeset
159 #if it is transformed to align="right":
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
160 #'text-align': 'align',
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
161 #'vertical-align': 'valign'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
162 }
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
163
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
164 def _style_to_attributes(self, attrs):
1868
64507f46beb2 reduce usage of has_key()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1816
diff changeset
165 if 'style' not in attrs:
531
f6a74f85b9d7 fix tableclass attr for gui editor
Thomas Waldmann <tw@waldmann-edv.de>
parents: 530
diff changeset
166 return attrs
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
167 unknown = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
168 for entry in attrs['style'].split(';'):
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
169 try:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
170 key, value = entry.split(':')
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
171 except ValueError:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
172 unknown.append(entry)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
173 continue
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
174 key, value = key.strip(), value.strip()
1868
64507f46beb2 reduce usage of has_key()
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1816
diff changeset
175 if key in self.style2attribute:
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
176 attrs[self.style2attribute[key]] = value
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
177 else:
277
08778f685aaf begin fixing http://moinmoin.wikiwikiweb.de/MoinMoinBugs/GuiEditorDestroysTableStyles (incomplete)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 159
diff changeset
178 unknown.append("%s:%s" % (key, value))
08778f685aaf begin fixing http://moinmoin.wikiwikiweb.de/MoinMoinBugs/GuiEditorDestroysTableStyles (incomplete)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 159
diff changeset
179 if unknown:
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
180 attrs['style'] = ';'.join(unknown)
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
181 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
182 del attrs['style']
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
183 return attrs
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
184
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
185 def _checkTableAttr(self, attrs, prefix):
531
f6a74f85b9d7 fix tableclass attr for gui editor
Thomas Waldmann <tw@waldmann-edv.de>
parents: 530
diff changeset
186 #self.request.log(repr(attrs))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
187 attrs = text_html.Formatter._checkTableAttr(self, attrs, prefix)
531
f6a74f85b9d7 fix tableclass attr for gui editor
Thomas Waldmann <tw@waldmann-edv.de>
parents: 530
diff changeset
188 #self.request.log(repr(attrs))
f6a74f85b9d7 fix tableclass attr for gui editor
Thomas Waldmann <tw@waldmann-edv.de>
parents: 530
diff changeset
189 attrs = self._style_to_attributes(attrs)
f6a74f85b9d7 fix tableclass attr for gui editor
Thomas Waldmann <tw@waldmann-edv.de>
parents: 530
diff changeset
190 #self.request.log(repr(attrs))
f6a74f85b9d7 fix tableclass attr for gui editor
Thomas Waldmann <tw@waldmann-edv.de>
parents: 530
diff changeset
191 return attrs
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
192
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
193 _allowed_table_attrs = {
573
b6af162cc4e2 fixed gui editor formatter table height attribute
Thomas Waldmann <tw@waldmann-edv.de>
parents: 545
diff changeset
194 'table': ['class', 'id', 'style', 'bgcolor', 'width', 'height', ],
b6af162cc4e2 fixed gui editor formatter table height attribute
Thomas Waldmann <tw@waldmann-edv.de>
parents: 545
diff changeset
195 'row': ['class', 'id', 'style', 'bgcolor', 'width', 'height', ],
1650
55761640667a formatter gedit_html: allow height for table cells
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1641
diff changeset
196 '': ['colspan', 'rowspan', 'class', 'id', 'style', 'bgcolor', 'width', 'height', ],
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
197 }
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
198
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
199 def table(self, on, attrs=None, **kw):
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
200 """ Create table
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
201
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
202 @param on: start table
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
203 @param attrs: table attributes
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
204 @rtype: string
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
205 @return start or end tag of a table
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
206 """
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
207 result = []
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
208 if on:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
209 # Open table
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
210 if not attrs:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
211 attrs = {}
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
212 else:
277
08778f685aaf begin fixing http://moinmoin.wikiwikiweb.de/MoinMoinBugs/GuiEditorDestroysTableStyles (incomplete)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 159
diff changeset
213 #result.append(self.rawHTML("<!-- ATTRS1: %s -->" % repr(attrs)))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
214 attrs = self._checkTableAttr(attrs, 'table')
277
08778f685aaf begin fixing http://moinmoin.wikiwikiweb.de/MoinMoinBugs/GuiEditorDestroysTableStyles (incomplete)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 159
diff changeset
215 #result.append(self.rawHTML("<!-- ATTRS2: %s -->" % repr(attrs)))
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
216 result.append(self._open('table', newline=1, attr=attrs,
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
217 allowed_attrs=self._allowed_table_attrs['table'],
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
218 **kw))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
219 else:
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
220 # Close table then div
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
221 result.append(self._close('table'))
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
222
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
223 return ''.join(result)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
224
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
225 def comment(self, text, **kw):
20
329b6aaf3118 fix for growing amounts of space before EOL in comments when using gui editor
Thomas Waldmann <tw@waldmann-edv.de>
parents: 0
diff changeset
226 text = text.rstrip() # workaround for growing amount of blanks at EOL
1641
39ca0331843f GUI editor formatter: use the formatter for comment texts (ported from 1.5)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1182
diff changeset
227 return self.preformatted(1, css_class='comment') + self.text(text) + self.preformatted(0)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
228
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
229 def strong(self, on, **kw):
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
230 tag = 'b'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
231 if on:
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
232 return self._open(tag, allowed_attrs=[], **kw)
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
233 return self._close(tag)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
234
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
235 def emphasis(self, on, **kw):
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
236 tag = 'i'
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
237 if on:
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
238 return self._open(tag, allowed_attrs=[], **kw)
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
239 return self._close(tag)
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
240
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
241 def underline(self, on, **kw):
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
242 tag = 'u'
0
77665d8e2254 tag of nonpublic@localhost--archive/moin--enterprise--1.5--base-0
Thomas Waldmann <tw-public@gmx.de>
parents:
diff changeset
243 if on:
529
20f8bda12a7b fix table *bgcolor trouble, cleanup style synth, fix html_gedit api
Thomas Waldmann <tw@waldmann-edv.de>
parents: 528
diff changeset
244 return self._open(tag, allowed_attrs=[], **kw)
407
bea43f99cc27 star-merged moin--refactor--1.5 (formatter, parser, converter fixes, see docs/CHANGES.refactor)
Thomas Waldmann <tw@waldmann-edv.de>
parents: 281
diff changeset
245 return self._close(tag)
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
246
36
eb3b18ffb28b fixed some english strings, better converter debugging msgs, move lineno anchors to formatter
Thomas Waldmann <tw@waldmann-edv.de>
parents: 34
diff changeset
247 def line_anchordef(self, lineno):
eb3b18ffb28b fixed some english strings, better converter debugging msgs, move lineno anchors to formatter
Thomas Waldmann <tw@waldmann-edv.de>
parents: 34
diff changeset
248 return '' # not needed for gui editor feeding
999
97ce857bdebf whitespace-only cleanup and minor style changes
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 661
diff changeset
249
36
eb3b18ffb28b fixed some english strings, better converter debugging msgs, move lineno anchors to formatter
Thomas Waldmann <tw@waldmann-edv.de>
parents: 34
diff changeset
250 def line_anchorlink(self, on, lineno=0):
eb3b18ffb28b fixed some english strings, better converter debugging msgs, move lineno anchors to formatter
Thomas Waldmann <tw@waldmann-edv.de>
parents: 34
diff changeset
251 return '' # not needed for gui editor feeding
eb3b18ffb28b fixed some english strings, better converter debugging msgs, move lineno anchors to formatter
Thomas Waldmann <tw@waldmann-edv.de>
parents: 34
diff changeset
252