Changeset 2439

Show
Ignore:
Timestamp:
07/10/07 06:49:22 (1 year ago)
Author:
cboos
Message:

WikiGoodiesPlugin:

New release 0.11.2.

This release contains minor bugfixes and a few enhancements.
If you upgrade to this version, take care of using a recent Trac 0.11 trunk.


  • Smileys:
    • Fixed an import issue with setuptools
    • Use 0.11 API for macros
    • C:/WINDOWS no longer gets a smiley in the middle,
      even if that particular one would be well deserved ;-)
      (fixes #838)
    • {1} is now {p1} (or {P1}) for compatibility with report links
      (fixes #117)


  • "mailto:" links:
    • Support e-mail obfuscation (related to #T153).
      Note that this requires [trac 5817].
  • "file:" links added for UNC paths (those links work for IExplorer only;
    you'll need the LocalLink extension in
    order to get a contextual menu for them in Firefox)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wikigoodiesplugin/0.11/goodies/__init__.py

    r774 r2439  
    44from mozilla import Mozilla 
    55from mailto import MailToLink 
     6from unc_paths import UNCPathLink 
    67 
    78 
  • wikigoodiesplugin/0.11/goodies/mailto.py

    r1568 r2439  
    1313 
    1414from trac.core import implements, Component 
     15from trac.web.chrome import Chrome 
    1516from trac.wiki import IWikiSyntaxProvider 
    16  
    1717 
    1818class MailToLink(Component): 
     
    2525     
    2626    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) 
    2932 
    3033    def get_link_resolvers(self): 
  • wikigoodiesplugin/0.11/goodies/smileys.py

    r1568 r2439  
    1515 
    1616from genshi.builder import tag 
     17 
     18from pkg_resources import resource_filename 
    1719 
    1820from trac.core import implements, Component 
     
    4850    "<!>": "attention.png", 
    4951    '/!\\': "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", 
    5358    "{o}": "star_off.png", 
    5459    "{*}": "star_on.png", 
     
    6570 
    6671    def get_htdocs_dirs(self): 
    67         from pkg_resources import resource_filename 
    6872        return [('smileys', resource_filename(__name__, 'htdocs/modern/img'))] 
    6973                 
     
    7478 
    7579    def get_wiki_syntax(self): 
    76         yield (prepare_regexp(SMILEYS), self._format_smiley) 
     80        yield (r"(?<!\w)(?:%s)" % prepare_regexp(SMILEYS), self._format_smiley) 
    7781 
    7882    def get_link_resolvers(self): 
     
    9397                "(defaults 3).") 
    9498 
    95     def render_macro(self, req, name, content): 
     99    def expand_macro(self, formatter, name, content): 
    96100        return render_table(SMILEYS.keys(), content, 
    97                             lambda s: self._format_smiley(req, s, None)) 
     101                            lambda s: self._format_smiley(formatter, s, None)) 
    98102 
  • wikigoodiesplugin/0.11/goodies/unc_paths.py

    r1568 r2439  
    1616 
    1717 
    18 class MailToLink(Component): 
     18class UNCPathLink(Component): 
    1919 
    2020    implements(IWikiSyntaxProvider) 
     
    2222    # IWikiSyntaxProvider methods 
    2323 
    24     _email_regexp = r"<[^@]+@[^>]+>
     24    _unc_path_regexp = r"\\\\[^\s\\]+(?:\\[^\s\\]*)*
    2525     
    2626    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('\\', '/')))) 
    2930 
    3031    def get_link_resolvers(self): 
  • wikigoodiesplugin/0.11/README.txt

    r248 r2439  
    55This plugin extends the Trac Wiki in several ways: 
    66 * 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 
    1012   (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 
     18Each feature can be disabled individually if needed. 
     19 
     20In 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]. 
     22Here, the "file:" links are user-oriented and can't be embedded in a <img> 
     23or Javascript code, I don't really see what could be the risk, so I think  
     24it's OK to enable this feature. 
     25Firefox users can use the [http://locallink.mozdev.org/ LocalLink] plugin 
     26([https://addons.mozilla.org/en-US/firefox/addon/281 install]).  
     27Of course, if someone can demonstrate that this feature presents 
     28a security risk, I'll disable it by default in future releases. 
    1129 
    1230 
     
    1634[report:9?COMPONENT=WikiGoodiesPlugin here]. 
    1735 
    18 If you have any issues, create a  
    19 [http://trac-hacks.swapoff.org/newticket?component=WikiGoodiesPlugin&owner=cboos new ticket]. 
     36Short list of known defects: 
     37[[TicketQuery(status!=closed&component=WikiGoodiesPlugin&type=defect)]] 
     38 
     39If you have any new issue of feature request, create a  
     40[http://trac-hacks.org/newticket?component=WikiGoodiesPlugin&owner=cboos new ticket]. 
    2041 
    2142== Download == 
    2243 
    23 Download the zipped source from [download:wikigoodiesplugin here]. 
     44Download 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] || 
    2448 
    2549== Source == 
    2650 
    27 You can check out the source for WikiGoodiesPlugin from Subversion at http://trac-hacks.swapoff.org/svn/wikigoodiesplugin. 
     51You can check out the source for WikiGoodiesPlugin from Subversion at http://trac-hacks.org/svn/wikigoodiesplugin. 
    2852 
    2953== Example == 
     
    3559(e.g. in WikiFormatting): 
    3660{{{ 
    37 == Additional Goodies == 
    38 === Smileys === 
     61=== Additional Goodies === 
     62==== Smileys ==== 
    3963[[ShowSmileys(5)]] 
    40 === Entities === 
    41 [[ShowEntities(5)]] 
    42 === Symbols === 
     64==== Entities ==== 
     65[[ShowEntities(4)]] 
     66==== Symbols ==== 
    4367[[ShowSymbols(5)]] 
     68 
    4469}}} 
    4570''(the argument is the number of columns to be used in the displayed table)'' 
    4671 
     72For the entities, only the named ones are shown. 
     73For help on using the numerical entities, see for example those 
     74[http://home.tiscali.nl/t876506/entitiesTips.html tips]. 
    4775 
    4876=== 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, this  
    55 additional patch is required: 
    56 {{{ 
    57 Index: trac/wiki/formatter.py 
    58 =================================================================== 
    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_rules 
    63  
    64      _pre_rules = [ 
    65 -        r"(?P<htmlescape>[&<>])", 
    66          # Font styles 
    67          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:stgt 
    75          r"(?P<shref>!?((?P<sns>%s):(?P<stgt>%s|%s(?:%s*%s)?)))" \ 
    76          % (LINK_SCHEME, QUOTED_STRING, 
    77 }}} 
    7877 
    7978 
  • wikigoodiesplugin/0.11/setup.py

    r1568 r2439  
    66      description='Plugin for Trac which extends the Wiki with some goodies', 
    77      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', 
    1010      license='BSD', 
    1111      author='Christian Boos', 
     
    1717      Single words surrounded by "*", "/" or "_" characters are tranformed 
    1818      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. 
    1922 
    2023      It also comes with a set of 3 macros that can be used