Changeset 2439
- Timestamp:
- 07/10/07 06:49:22 (1 year ago)
- Files:
-
- wikigoodiesplugin/0.11/goodies/__init__.py (modified) (1 diff)
- wikigoodiesplugin/0.11/goodies/mailto.py (modified) (2 diffs)
- wikigoodiesplugin/0.11/goodies/smileys.py (modified) (5 diffs)
- wikigoodiesplugin/0.11/goodies/unc_paths.py (copied) (copied from wikigoodiesplugin/0.11/goodies/mailto.py) (2 diffs)
- wikigoodiesplugin/0.11/README.txt (modified) (3 diffs)
- wikigoodiesplugin/0.11/setup.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wikigoodiesplugin/0.11/goodies/__init__.py
r774 r2439 4 4 from mozilla import Mozilla 5 5 from mailto import MailToLink 6 from unc_paths import UNCPathLink 6 7 7 8 wikigoodiesplugin/0.11/goodies/mailto.py
r1568 r2439 13 13 14 14 from trac.core import implements, Component 15 from trac.web.chrome import Chrome 15 16 from trac.wiki import IWikiSyntaxProvider 16 17 17 18 18 class MailToLink(Component): … … 25 25 26 26 def get_wiki_syntax(self): 27 yield (self._email_regexp, (lambda x, y, z: 28 tag.a(y, href="mailto:"+y[1:-1]))) 27 chrome = Chrome(self.env) 28 def mailto(formatter, match, fullmatch): 29 return tag.a(chrome.format_author(formatter.req, match), 30 href="mailto:"+match[1:-1]) 31 yield (self._email_regexp, mailto) 29 32 30 33 def get_link_resolvers(self): wikigoodiesplugin/0.11/goodies/smileys.py
r1568 r2439 15 15 16 16 from genshi.builder import tag 17 18 from pkg_resources import resource_filename 17 19 18 20 from trac.core import implements, Component … … 48 50 "<!>": "attention.png", 49 51 '/!\\': "alert.png", 50 "{1}": "prio1.png", 51 "{2}": "prio2.png", 52 "{3}": "prio3.png", 52 "{p1}": "prio1.png", 53 "{p2}": "prio2.png", 54 "{p3}": "prio3.png", 55 "{P1}": "prio1.png", 56 "{P2}": "prio2.png", 57 "{P3}": "prio3.png", 53 58 "{o}": "star_off.png", 54 59 "{*}": "star_on.png", … … 65 70 66 71 def get_htdocs_dirs(self): 67 from pkg_resources import resource_filename68 72 return [('smileys', resource_filename(__name__, 'htdocs/modern/img'))] 69 73 … … 74 78 75 79 def get_wiki_syntax(self): 76 yield ( prepare_regexp(SMILEYS), self._format_smiley)80 yield (r"(?<!\w)(?:%s)" % prepare_regexp(SMILEYS), self._format_smiley) 77 81 78 82 def get_link_resolvers(self): … … 93 97 "(defaults 3).") 94 98 95 def render_macro(self, req, name, content):99 def expand_macro(self, formatter, name, content): 96 100 return render_table(SMILEYS.keys(), content, 97 lambda s: self._format_smiley( req, s, None))101 lambda s: self._format_smiley(formatter, s, None)) 98 102 wikigoodiesplugin/0.11/goodies/unc_paths.py
r1568 r2439 16 16 17 17 18 class MailToLink(Component):18 class UNCPathLink(Component): 19 19 20 20 implements(IWikiSyntaxProvider) … … 22 22 # IWikiSyntaxProvider methods 23 23 24 _ email_regexp = r"<[^@]+@[^>]+>"24 _unc_path_regexp = r"\\\\[^\s\\]+(?:\\[^\s\\]*)*" 25 25 26 26 def get_wiki_syntax(self): 27 yield (self._email_regexp, (lambda x, y, z: 28 tag.a(y, href="mailto:"+y[1:-1]))) 27 yield (self._unc_path_regexp, 28 (lambda x, y, z: 29 tag.a(y, href='file:///'+y.replace('\\', '/')))) 29 30 30 31 def get_link_resolvers(self): wikigoodiesplugin/0.11/README.txt
r248 r2439 5 5 This plugin extends the Trac Wiki in several ways: 6 6 * Support for displaying smileys, as in 7 [http://moinmoin.wikiwikiweb.de/HelpOnSmileys MoinMoin] 8 * Support for inserting HTML 4.0 entities 9 * Support for replacing common text idioms by their corresponding symbols 7 [http://moinmoin.wikiwikiweb.de/HelpOnSmileys MoinMoin], 8 with a few exceptions (no flags, "priority" smileys are renamed {p1} 9 instead of {1} in order to be compatible with report: shorthand links) 10 * HTML 4.0 entities (named entities and numerical entities) 11 * Automatic replacement of common text idioms by their corresponding symbols 10 12 (e.g. arrows, fractions, etc.) 13 * Simplified markup for single words: `*this* /is/ _important_` 14 becomes '''this''' ''is'' __important__ [[comment(replace by *this* /is/ _important_)]] 15 * Replace <name@domain> with "mailto:" links (obfuscated if needed) 16 * Replace \\... UNC paths with "file:///" links 17 18 Each feature can be disabled individually if needed. 19 20 In particular, turning off the UNC paths transformation might be seen as a 21 [http://kb.mozillazine.org/Links_to_local_pages_don%27t_work security measure]. 22 Here, the "file:" links are user-oriented and can't be embedded in a <img> 23 or Javascript code, I don't really see what could be the risk, so I think 24 it's OK to enable this feature. 25 Firefox users can use the [http://locallink.mozdev.org/ LocalLink] plugin 26 ([https://addons.mozilla.org/en-US/firefox/addon/281 install]). 27 Of course, if someone can demonstrate that this feature presents 28 a security risk, I'll disable it by default in future releases. 11 29 12 30 … … 16 34 [report:9?COMPONENT=WikiGoodiesPlugin here]. 17 35 18 If you have any issues, create a 19 [http://trac-hacks.swapoff.org/newticket?component=WikiGoodiesPlugin&owner=cboos new ticket]. 36 Short list of known defects: 37 [[TicketQuery(status!=closed&component=WikiGoodiesPlugin&type=defect)]] 38 39 If you have any new issue of feature request, create a 40 [http://trac-hacks.org/newticket?component=WikiGoodiesPlugin&owner=cboos new ticket]. 20 41 21 42 == Download == 22 43 23 Download the zipped source from [download:wikigoodiesplugin here]. 44 Download the zipped source: 45 || ''Trac Version'' || ''Zip'' || 46 || 0.9.3 and above, 0.10 || [download:wikigoodiesplugin/0.9] || 47 || 0.11 || [download:wikigoodiesplugin/0.11] || 24 48 25 49 == Source == 26 50 27 You can check out the source for WikiGoodiesPlugin from Subversion at http://trac-hacks. swapoff.org/svn/wikigoodiesplugin.51 You can check out the source for WikiGoodiesPlugin from Subversion at http://trac-hacks.org/svn/wikigoodiesplugin. 28 52 29 53 == Example == … … 35 59 (e.g. in WikiFormatting): 36 60 {{{ 37 == Additional Goodies==38 === Smileys===61 === Additional Goodies === 62 ==== Smileys ==== 39 63 [[ShowSmileys(5)]] 40 === Entities===41 [[ShowEntities( 5)]]42 === Symbols===64 ==== Entities ==== 65 [[ShowEntities(4)]] 66 ==== Symbols ==== 43 67 [[ShowSymbols(5)]] 68 44 69 }}} 45 70 ''(the argument is the number of columns to be used in the displayed table)'' 46 71 72 For the entities, only the named ones are shown. 73 For help on using the numerical entities, see for example those 74 [http://home.tiscali.nl/t876506/entitiesTips.html tips]. 47 75 48 76 === Known Issues === 49 50 That plugin will only be compatible with Trac-0.9.3,51 which is not yet released...52 53 But it also works for the trunk (!r2713 as of this writing).54 However, in order to support the HTML 4.0 entities, this55 additional patch is required:56 {{{57 Index: trac/wiki/formatter.py58 ===================================================================59 --- trac/wiki/formatter.py (revision 2713)60 +++ trac/wiki/formatter.py (working copy)61 @@ -144,7 +144,6 @@62 # between _pre_rules and _post_rules63 64 _pre_rules = [65 - r"(?P<htmlescape>[&<>])",66 # Font styles67 r"(?P<bolditalic>%s)" % BOLDITALIC_TOKEN,68 r"(?P<bold>%s)" % BOLD_TOKEN,69 @@ -160,6 +159,7 @@70 r"(?P<htmlescapeentity>!?&#\d+;)"]71 72 _post_rules = [73 + r"(?P<htmlescape>[&<>])",74 # shref corresponds to short TracLinks, i.e. sns:stgt75 r"(?P<shref>!?((?P<sns>%s):(?P<stgt>%s|%s(?:%s*%s)?)))" \76 % (LINK_SCHEME, QUOTED_STRING,77 }}}78 77 79 78 wikigoodiesplugin/0.11/setup.py
r1568 r2439 6 6 description='Plugin for Trac which extends the Wiki with some goodies', 7 7 keywords='trac wiki plugin smileys entities symbols', 8 url='http://trac-hacks. swapoff.org/wiki/WikiGoodiesPlugin',9 version='0.11. 1',8 url='http://trac-hacks.org/wiki/WikiGoodiesPlugin', 9 version='0.11.2', 10 10 license='BSD', 11 11 author='Christian Boos', … … 17 17 Single words surrounded by "*", "/" or "_" characters are tranformed 18 18 to bold, italic and underline text, respectively. 19 20 E-mail are transformed to "mailto:" links and UNC paths are transformed 21 to "file:" links. 19 22 20 23 It also comes with a set of 3 macros that can be used
