Edgewall Software
Modify

Ticket #1755 (closed enhancement: fixed)

Opened 7 years ago

Last modified 5 years ago

Allow lhref without argument

Reported by: Shun-ichi Goto <gotoh@…> Owned by: cboos
Priority: normal Milestone: 0.9
Component: wiki system Version: none
Severity: normal Keywords:
Cc:
Release Notes:
API Changes:

Description

I propose the enhancement of the lhref syntax on wiki formatting.
For example, new expression like [wiki:pagename] is
equivalent to [wiki:pagename pagename].
Thr reason of this enhancement is... Japanese users want to use wiki-pagename with kanji
characters and kanji character doesn't have upper/lower variation, thus we should type
same word twice on every entries like [wiki:pagename pagename].
I beleve that this syntax (using 'ltgt' part as 'label') is reasonable.

## Yes, Wikiname is not so grateful in kanji (CJK) document.

Index: formatter.py
===================================================================
--- formatter.py	(revision 1906)
+++ formatter.py	(working copy)
@@ -138,7 +138,7 @@
                   r"(?P<inlinecode2>!?`(?P<inline2>.*?)`)",
                   r"(?P<htmlescapeentity>!?&#\d+;)"]
     _post_rules = [r"(?P<shref>!?((?P<sns>\w+):(?P<stgt>'[^']+'|((\|(?=[^| ])|[^| ])*[^|'~_\., \)]))))",
-                   r"(?P<lhref>!?\[(?P<lns>\w+):(?P<ltgt>[^ ]+) (?P<label>.*?)\])",
+                   r"(?P<lhref>!?\[(?P<lns>\w+):(?P<ltgt>[^\] ]+)(?: (?P<label>.*?))?\])",
                    r"(?P<macro>!?\[\[(?P<macroname>[\w/+-]+)(\]\]|\((?P<macroargs>.*?)\)\]\]))",
                    r"(?P<heading>^\s*(?P<hdepth>=+)\s.*\s(?P=hdepth)\s*$)",
                    r"(?P<list>^(?P<ldepth>\s+)(?:\*|\d+\.) )",
@@ -278,6 +278,6 @@
     def _lhref_formatter(self, match, fullmatch):
         ns = fullmatch.group('lns')
         target = fullmatch.group('ltgt') 
-        label = fullmatch.group('label')
+        label = fullmatch.group('label') or fullmatch.group('ltgt')
         if ns in self.link_resolvers:
             return self._link_resolvers[ns](self, ns, target, label)

Attachments

Change History

comment:1 Changed 7 years ago by cboos

  • Owner changed from jonas to cboos
  • Status changed from new to assigned

Looks good, and will be also useful for wiki pages names
that don't match the WikiPageNames rules, e.g.:

[wiki:ISO9000] -> ISO9000?

comment:2 Changed 7 years ago by cboos

  • Resolution set to fixed
  • Status changed from assigned to closed

Applied in r1907, thanks!

comment:3 Changed 5 years ago by cboos

  • Milestone set to 0.9
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.