Author: jure
Date: Tue Mar 12 09:06:01 2013
New Revision: 1455457
URL: http://svn.apache.org/r1455457
Log:
#390, compact product wiki syntax, patch
t390_r1453952_product_wikisyntax_compact.diff applied (from Olemis)
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-attachment-link-tests.short.txt
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.short.txt
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-milestone-link-tests.short.txt
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.short.txt
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-search-link-tests.short.txt
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-ticket-link-tests.short.txt
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.txt
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.txt
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wikisyntax.py
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py?rev=1455457&r1=1455456&r2=1455457&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/api.py
Tue Mar 12 09:06:01 2013
@@ -31,12 +31,13 @@ from trac.env import IEnvironmentSetupPa
from trac.perm import IPermissionRequestor, PermissionCache
from trac.resource import IResourceManager
from trac.ticket.api import ITicketFieldProvider
-from trac.util.text import to_unicode
+from trac.util.text import to_unicode, unquote_label
from trac.util.translation import _, N_
from trac.web.chrome import ITemplateProvider
from trac.web.main import FakePerm, FakeSession
from trac.wiki.api import IWikiSyntaxProvider
from trac.wiki.formatter import LinkFormatter
+from trac.wiki.parser import WikiParser
from multiproduct.model import Product, ProductResourceMap, ProductSetting
from multiproduct.util import EmbeddedLinkFormatter
@@ -340,11 +341,22 @@ class MultiProductSystem(Component):
# IWikiSyntaxProvider methods
- short_syntax_delimiter = u'->'
+ short_syntax_delimiter = u'~'
def get_wiki_syntax(self):
+ yield (r'(?<!\S)!?(?P<pid>(?!\d)\w+)' +
+ ''.join('[%s]' % c for c in self.short_syntax_delimiter) +
+ r'(?P<ptarget>%s:(?:%s)|%s|%s(?:%s*%s)?)' %
+ (WikiParser.LINK_SCHEME, WikiParser.QUOTED_STRING,
+ WikiParser.QUOTED_STRING, WikiParser.SHREF_TARGET_FIRST,
+ WikiParser.SHREF_TARGET_MIDDLE,
WikiParser.SHREF_TARGET_LAST),
+ lambda f, m, fm :
+ self._format_link(f, 'product',
+ '%s:%s' % (fm.group('pid'),
+
unquote_label(fm.group('ptarget'))),
+ fm.group(0), fm))
if self.env[ProductTicketModule] is not None:
- yield (r"(?<!\S)!?(?P<jtp>()(?!\d)\w+)-(?P<jtt>\d+)"
+ yield (r"(?<!\S)!?(?P<jtp>(?!\d)\w+)-(?P<jtt>\d+)"
r"(?P<jtf>[?#]\S+)?",
lambda f, m, fm :
self._format_link(f, 'product',
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-attachment-link-tests.short.txt
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-attachment-link-tests.short.txt?rev=1455457&view=auto
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-attachment-link-tests.short.txt
(added)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-attachment-link-tests.short.txt
Tue Mar 12 09:06:01 2013
@@ -0,0 +1,52 @@
+============================================================
+
+ Product attachment links
+
+============================== %(tc_title_prefix)s - attachment: link resolver
(deprecated)
+%(link_prefix)sattachment:wiki:WikiStart:file.txt (deprecated)
+%(link_prefix)sattachment:ticket:123:file.txt (deprecated)
+------------------------------
+<p>
+<a class="attachment"
href="%(path_prefix)s/attachment/wiki/WikiStart/file.txt" title="Attachment
'file.txt' in
WikiStart">%(link_prefix)sattachment:wiki:WikiStart:file.txt</a><a
class="trac-rawlink"
href="%(path_prefix)s/raw-attachment/wiki/WikiStart/file.txt"
title="Download"></a> (deprecated)
+<a class="attachment" href="%(path_prefix)s/attachment/ticket/123/file.txt"
title="Attachment 'file.txt' in Ticket
#123">%(link_prefix)sattachment:ticket:123:file.txt</a><a class="trac-rawlink"
href="%(path_prefix)s/raw-attachment/ticket/123/file.txt" title="Download"></a>
(deprecated)
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - attachment: "foreign"
links
+%(link_prefix)sattachment:file.txt:wiki:WikiStart
+%(link_prefix)sattachment:file.txt:ticket:123
+%(link_prefix)sattachment:foo.txt:wiki:SomePage/SubPage
+------------------------------
+<p>
+<a class="attachment"
href="%(path_prefix)s/attachment/wiki/WikiStart/file.txt" title="Attachment
'file.txt' in
WikiStart">%(link_prefix)sattachment:file.txt:wiki:WikiStart</a><a
class="trac-rawlink"
href="%(path_prefix)s/raw-attachment/wiki/WikiStart/file.txt"
title="Download"></a>
+<a class="attachment" href="%(path_prefix)s/attachment/ticket/123/file.txt"
title="Attachment 'file.txt' in Ticket
#123">%(link_prefix)sattachment:file.txt:ticket:123</a><a class="trac-rawlink"
href="%(path_prefix)s/raw-attachment/ticket/123/file.txt" title="Download"></a>
+<a class="attachment"
href="%(path_prefix)s/attachment/wiki/SomePage/SubPage/foo.txt"
title="Attachment 'foo.txt' in
SomePage/SubPage">%(link_prefix)sattachment:foo.txt:wiki:SomePage/SubPage</a><a
class="trac-rawlink"
href="%(path_prefix)s/raw-attachment/wiki/SomePage/SubPage/foo.txt"
title="Download"></a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - attachment: "local" links
+%(link_prefix)sattachment:file.txt
+------------------------------
+<p>
+<a class="attachment"
href="%(path_prefix)s/attachment/wiki/WikiStart/file.txt" title="Attachment
'file.txt' in WikiStart">%(link_prefix)sattachment:file.txt</a><a
class="trac-rawlink"
href="%(path_prefix)s/raw-attachment/wiki/WikiStart/file.txt"
title="Download"></a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - attachment: "missing"
links
+%(link_prefix)sattachment:foo.txt
+------------------------------
+<p>
+<a class="missing attachment">%(link_prefix)sattachment:foo.txt</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - attachment: "raw" links
+%(link_prefix)sraw-attachment:file.txt
+------------------------------
+<p>
+<a class="attachment"
href="%(path_prefix)s/raw-attachment/wiki/WikiStart/file.txt"
title="%(link_title_prefix)sAttachment 'file.txt' in
WikiStart">%(link_prefix)sraw-attachment:file.txt</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - attachment: raw format as
explicit argument
+%(link_prefix)sattachment:file.txt?format=raw
+------------------------------
+<p>
+<a class="attachment"
href="%(path_prefix)s/attachment/wiki/WikiStart/file.txt?format=raw"
title="Attachment 'file.txt' in
WikiStart">%(link_prefix)sattachment:file.txt?format=raw</a><a
class="trac-rawlink"
href="%(path_prefix)s/raw-attachment/wiki/WikiStart/file.txt?format=raw"
title="Download"></a>
+</p>
+------------------------------
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.short.txt
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.short.txt?rev=1455457&view=auto
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.short.txt
(added)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.short.txt
Tue Mar 12 09:06:01 2013
@@ -0,0 +1,18 @@
+============================================================
+
+ Product comment links
+
+============================== %(tc_title_prefix)s - comment: link resolver
(deprecated)
+%(link_prefix)scomment:ticket:123:2 (deprecated)
+------------------------------
+<p>
+<a href="%(path_prefix)s/ticket/123#comment:2"
title="%(link_title_prefix)sComment 2 for Ticket
#123">%(link_prefix)scomment:ticket:123:2</a> (deprecated)
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - comment: link resolver
+%(link_prefix)scomment:2:ticket:123
+------------------------------
+<p>
+<a href="%(path_prefix)s/ticket/123#comment:2"
title="%(link_title_prefix)sComment 2 for Ticket
#123">%(link_prefix)scomment:2:ticket:123</a>
+</p>
+------------------------------
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.txt
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.txt?rev=1455457&r1=1455456&r2=1455457&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.txt
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-comment-link-tests.txt
Tue Mar 12 09:06:01 2013
@@ -2,7 +2,7 @@
Product comment links
-============================== comment: link resolver (deprecated)
+============================== %(tc_title_prefix)s - comment: link resolver
(deprecated)
%(link_prefix)scomment:ticket:123:2 (deprecated)
[%(link_prefix)scomment:ticket:123:2 see above] (deprecated)
[%(link_prefix)scomment:ticket:123:description see descr] (deprecated)
@@ -13,7 +13,7 @@
<a href="%(path_prefix)s/ticket/123#comment:description"
title="%(link_title_prefix)sComment description for Ticket #123">see descr</a>
(deprecated)
</p>
------------------------------
-============================== comment: link resolver
+============================== %(tc_title_prefix)s - comment: link resolver
%(link_prefix)scomment:2:ticket:123
[%(link_prefix)scomment:2:ticket:123 see above]
[%(link_prefix)scomment:description:ticket:123 see descr]
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-milestone-link-tests.short.txt
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-milestone-link-tests.short.txt?rev=1455457&view=auto
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-milestone-link-tests.short.txt
(added)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-milestone-link-tests.short.txt
Tue Mar 12 09:06:01 2013
@@ -0,0 +1,18 @@
+============================================================
+
+ Product milestone links
+
+============================== %(tc_title_prefix)s - milestone: link resolver
+%(link_prefix)smilestone:foo
+------------------------------
+<p>
+<a class="missing milestone" href="%(path_prefix)s/milestone/foo"
rel="nofollow">%(link_prefix)smilestone:foo</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - milestone: link resolver
+ arguments
+%(link_prefix)smilestone:?action=new
+------------------------------
+<p>
+<a class="missing milestone" href="%(path_prefix)s/milestone/?action=new"
rel="nofollow">%(link_prefix)smilestone:?action=new</a>
+</p>
+------------------------------
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.short.txt
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.short.txt?rev=1455457&view=auto
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.short.txt
(added)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.short.txt
Tue Mar 12 09:06:01 2013
@@ -0,0 +1,50 @@
+============================================================
+
+ Product query links
+
+============================== %(tc_title_prefix)s - query: link resolver
+%(link_prefix)squery:?order=priority
+
+%(link_prefix)squery:?order=priority&owner=me
+
+%(link_prefix)squery:?type=résumé
+
+%(link_prefix)squery:status=new|reopened
+
+%(link_prefix)squery:reporter!=
+
+%(link_prefix)squery:reporter=joe|jack&owner=me
+
+%(link_prefix)squery:group=owner
+
+%(link_prefix)squery:verbose=1
+
+%(link_prefix)squery:summary=résumé
+------------------------------
+<p>
+<a class="query"
href="%(path_prefix)s/query?order=priority">%(link_prefix)squery:?order=priority</a>
+</p>
+<p>
+<a class="query"
href="%(path_prefix)s/query?order=priority&owner=me">%(link_prefix)squery:?order=priority&owner=me</a>
+</p>
+<p>
+<a class="query"
href="%(path_prefix)s/query?type=r%%C3%%A9sum%%C3%%A9">%(link_prefix)squery:?type=résumé</a>
+</p>
+<p>
+<a class="query"
href="%(path_prefix)s/query?status=new&status=reopened&order=priority">%(link_prefix)squery:status=new|reopened</a>
+</p>
+<p>
+<a class="query"
href="%(path_prefix)s/query?reporter=!&order=priority">%(link_prefix)squery:reporter!=</a>
+</p>
+<p>
+<a class="query"
href="%(path_prefix)s/query?owner=me&reporter=joe&reporter=jack&order=priority">%(link_prefix)squery:reporter=joe|jack&owner=me</a>
+</p>
+<p>
+<a class="query"
href="%(path_prefix)s/query?group=owner&order=priority">%(link_prefix)squery:group=owner</a>
+</p>
+<p>
+<a class="query"
href="%(path_prefix)s/query?order=priority&row=description">%(link_prefix)squery:verbose=1</a>
+</p>
+<p>
+<a class="query"
href="%(path_prefix)s/query?summary=r%%C3%%A9sum%%C3%%A9&order=priority">%(link_prefix)squery:summary=résumé</a>
+</p>
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.txt
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.txt?rev=1455457&r1=1455456&r2=1455457&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.txt
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-query-link-tests.txt
Tue Mar 12 09:06:01 2013
@@ -2,7 +2,7 @@
Product query links
-============================== query: link resolver
+============================== %(tc_title_prefix)s - query: link resolver
%(link_prefix)squery:?order=priority
%(link_prefix)squery:?order=priority&owner=me
@@ -49,42 +49,42 @@
<a class="query"
href="%(path_prefix)s/query?summary=r%%C3%%A9sum%%C3%%A9&order=priority">%(link_prefix)squery:summary=résumé</a>
</p>
------------------------------
-============================== TicketQuery macro: no results, list form
+============================== %(tc_title_prefix)s - TicketQuery macro: no
results, list form
Reopened tickets: [[TicketQuery(status=reopened)]]
------------------------------
<p>
Reopened tickets: <span class="query_no_results">No results</span>
</p>
------------------------------
-============================== TicketQuery macro: no results, count 0
+============================== %(tc_title_prefix)s - TicketQuery macro: no
results, count 0
Reopened tickets: [[TicketQuery(status=reopened, format=count)]]
------------------------------
<p>
Reopened tickets: <span class="query_count" title="0 tickets for which
status=reopened&max=0&order=id">0</span>
</p>
------------------------------
-============================== TicketQuery macro: no results, compact form
+============================== %(tc_title_prefix)s - TicketQuery macro: no
results, compact form
Reopened tickets: [[TicketQuery(status=reopened, format=compact)]]
------------------------------
<p>
Reopened tickets: <span class="query_no_results">No results</span>
</p>
------------------------------
-============================== TicketQuery macro: one result, list form
+============================== %(tc_title_prefix)s - TicketQuery macro: one
result, list form
New tickets: [[TicketQuery(status=new)]]
------------------------------
<p>
New tickets: </p><div><dl class="wiki compact"><dt><a class="new"
href="%(path_prefix)s/ticket/1" title="This is the summary">#1</a></dt><dd>This
is the summary</dd></dl></div><p>
</p>
------------------------------
-============================== TicketQuery macro: one result, count 1
+============================== %(tc_title_prefix)s - TicketQuery macro: one
result, count 1
New tickets: [[TicketQuery(status=new, format=count)]]
------------------------------
<p>
New tickets: <span class="query_count" title="1 tickets for which
status=new&max=0&order=id">1</span>
</p>
------------------------------
-============================== TicketQuery macro: one result, compact form
+============================== %(tc_title_prefix)s - TicketQuery macro: one
result, compact form
New tickets: [[TicketQuery(status=new, format=compact)]]
------------------------------
<p>
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-search-link-tests.short.txt
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-search-link-tests.short.txt?rev=1455457&view=auto
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-search-link-tests.short.txt
(added)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-search-link-tests.short.txt
Tue Mar 12 09:06:01 2013
@@ -0,0 +1,26 @@
+============================================================
+
+ Product search links
+
+============================== %(tc_title_prefix)s - search: link resolver
+%(link_prefix)ssearch:foo
+%(link_prefix_quote)ssearch:foo bar"
+------------------------------
+<p>
+<a class="search"
href="%(path_prefix)s/search?q=foo">%(link_prefix)ssearch:foo</a>
+<a class="search"
href="%(path_prefix)s/search?q=foo+bar">%(link_prefix_quote)ssearch:foo bar"</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - search: link resolver
with query arguments
+%(link_prefix)ssearch:foo?wiki=on
+%(link_prefix)ssearch:?q=foo&wiki=on
+%(link_prefix_quote)ssearch:foo bar?wiki=on"
+%(link_prefix_quote)ssearch:?q=foo bar&wiki=on"
+------------------------------
+<p>
+<a class="search"
href="%(path_prefix)s/search?q=foo&wiki=on">%(link_prefix)ssearch:foo?wiki=on</a>
+<a class="search"
href="%(path_prefix)s/search?q=foo&wiki=on">%(link_prefix)ssearch:?q=foo&wiki=on</a>
+<a class="search"
href="%(path_prefix)s/search?q=foo+bar&wiki=on">%(link_prefix_quote)ssearch:foo
bar?wiki=on"</a>
+<a class="search"
href="%(path_prefix)s/search?q=foo+bar&wiki=on">%(link_prefix_quote)ssearch:?q=foo
bar&wiki=on"</a>
+</p>
+------------------------------
Added:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-ticket-link-tests.short.txt
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-ticket-link-tests.short.txt?rev=1455457&view=auto
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-ticket-link-tests.short.txt
(added)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/product-ticket-link-tests.short.txt
Tue Mar 12 09:06:01 2013
@@ -0,0 +1,105 @@
+============================================================
+
+ Product ticket links
+
+============================== %(tc_title_prefix)s - ticket: link resolver
+%(link_prefix)sticket:1
+%(link_prefix)sticket:12
+%(link_prefix)sticket:abc
+------------------------------
+<p>
+<a class="new ticket" href="%(path_prefix)s/ticket/1"
title="%(link_title_prefix)sThis is the summary
(new)">%(link_prefix)sticket:1</a>
+<a class="missing ticket">%(link_prefix)sticket:12</a>
+<a class="missing ticket">%(link_prefix)sticket:abc</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - ticket: link resolver +
arguments
+%(link_prefix)sticket:1?format=csv
+%(link_prefix)sticket:1#comment:3
+------------------------------
+<p>
+<a class="new ticket" href="%(path_prefix)s/ticket/1?format=csv"
title="%(link_title_prefix)sThis is the summary
(new)">%(link_prefix)sticket:1?format=csv</a>
+<a class="new ticket" href="%(path_prefix)s/ticket/1#comment:3"
title="%(link_title_prefix)sThis is the summary
(new)">%(link_prefix)sticket:1#comment:3</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - ticket: link resolver
with ranges
+%(link_prefix)sticket:12-14,33
+%(link_prefix)sticket:12,33?order=created
+------------------------------
+<p>
+<a href="%(path_prefix)s/query?id=12-14%%2C33"
title="%(link_title_prefix)sTickets 12-14,
33">%(link_prefix)sticket:12-14,33</a>
+<a href="%(path_prefix)s/query?id=12%%2C33&order=created"
title="%(link_title_prefix)sTickets 12,
33">%(link_prefix)sticket:12,33?order=created</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - ticket link shorthand form
+%(link_prefix)s#1, #2
+%(link_prefix)s#12, #abc
+------------------------------
+<p>
+<a class="new ticket" href="%(path_prefix)s/ticket/1"
title="%(link_title_prefix)sThis is the summary (new)">#1</a>, <a
class="missing ticket">#2</a>
+<a class="missing ticket">#12</a>, #abc
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - ticket link shorthand
form with ranges
+%(link_prefix)s#1-5,42
+%(link_prefix)s#1,3,5,7
+------------------------------
+<p>
+<a href="%(path_prefix)s/query?id=1-5%%2C42"
title="%(link_title_prefix)sTickets 1-5, 42">#1-5,42</a>
+<a href="%(path_prefix)s/query?id=1%%2C3%%2C5%%2C7"
title="%(link_title_prefix)sTickets 1, 3, 5, 7">#1,3,5,7</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - ticket link shorthand
form with long ranges (#10111 regression)
+%(link_prefix)s#1-123456789012345678901234
+------------------------------
+<p>
+<a href="%(path_prefix)s/query?id=1-123456789012345678901234"
title="%(link_title_prefix)sTickets
1-123456789012345678901234">#1-123456789012345678901234</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - escaping the above
+!%(link_prefix)s#1
+------------------------------
+<p>
+%(link_prefix)s#1
+</p>
+------------------------------
+%(link_prefix)s#1
+============================== %(tc_title_prefix)s - InterTrac for tickets
+%(link_prefix)strac:ticket:2041
+%(link_prefix)s#T2041
+%(link_prefix)s#trac2041
+------------------------------
+<p>
+<a class="ext-link" href="http://trac.edgewall.org/intertrac/ticket%%3A2041"
title="%(link_title_prefix)sticket:2041 in Trac's Trac"><span
class="icon"></span>%(link_prefix)strac:ticket:2041</a>
+<a class="ext-link" href="http://trac.edgewall.org/intertrac/ticket%%3A2041"
title="%(link_title_prefix)sticket:2041 in Trac's Trac"><span
class="icon"></span>#T2041</a>
+<a class="ext-link" href="http://trac.edgewall.org/intertrac/ticket%%3A2041"
title="%(link_title_prefix)sticket:2041 in Trac's Trac"><span
class="icon"></span>#trac2041</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - Ticket InterTrac
shorthands
+%(link_prefix)sT:#2041
+%(link_prefix)strac:#2041
+------------------------------
+<p>
+<a class="ext-link" href="http://trac.edgewall.org/intertrac/%%232041"
title="%(link_title_prefix)s#2041 in Trac's Trac"><span
class="icon"></span>%(link_prefix)sT:#2041</a>
+<a class="ext-link" href="http://trac.edgewall.org/intertrac/%%232041"
title="%(link_title_prefix)s#2041 in Trac's Trac"><span
class="icon"></span>%(link_prefix)strac:#2041</a>
+</p>
+------------------------------
+============================== %(tc_title_prefix)s - ticket syntax with
unicode digits
+%(link_prefix)s#â´Â²
+%(link_prefix)s#1-âµ,42
+%(link_prefix)s#1,³,5,7
+%(link_prefix_quote)s#1"-âµ,42
+%(link_prefix_quote)s#1",³,5,7
+%(link_prefix)s#T²â°â´Â¹
+%(link_prefix)s#trac²â°â´Â¹
+------------------------------
+<p>
+%(link_prefix)s#â´Â²
+<a class="new ticket" href="%(path_prefix)s/ticket/1"
title="%(link_title_prefix)sThis is the summary (new)">#1</a>
+<a class="new ticket" href="%(path_prefix)s/ticket/1"
title="%(link_title_prefix)sThis is the summary (new)">#1</a>
+<a class="new ticket" href="%(path_prefix)s/ticket/1"
title="%(link_title_prefix)sThis is the summary (new)">#1</a>-âµ,42
+<a class="new ticket" href="%(path_prefix)s/ticket/1"
title="%(link_title_prefix)sThis is the summary (new)">#1</a>,³,5,7
+%(link_prefix)s#T²â°â´Â¹
+%(link_prefix)s#trac²â°â´Â¹
+</p>
+------------------------------
Modified:
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wikisyntax.py
URL:
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wikisyntax.py?rev=1455457&r1=1455456&r2=1455457&view=diff
==============================================================================
---
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wikisyntax.py
(original)
+++
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wikisyntax.py
Tue Mar 12 09:06:01 2013
@@ -69,6 +69,7 @@ def ticket_setup(tc):
ticket.insert()
+# Full syntax
PRODUCT_LINKS = to_unicode(pkg_resources.resource_string(
__name__, 'product-link-tests.txt'))
PRODUCT_ATTACHMENT_LINKS = to_unicode(pkg_resources.resource_string(
@@ -89,6 +90,23 @@ PRODUCT_QUERY2_LINKS = to_unicode(pkg_re
__name__, 'product-query2-link-tests.txt'))
PRODUCT_COMMENT_LINKS = to_unicode(pkg_resources.resource_string(
__name__, 'product-comment-link-tests.txt'))
+
+# Compact syntax
+PRODUCT_ATTACHMENT_SHORTLINKS = to_unicode(pkg_resources.resource_string(
+ __name__, 'product-attachment-link-tests.short.txt'))
+PRODUCT_SEARCH_SHORTLINKS = to_unicode(pkg_resources.resource_string(
+ __name__, 'product-search-link-tests.short.txt'))
+PRODUCT_TICKET_SHORTLINKS = to_unicode(pkg_resources.resource_string(
+ __name__, 'product-ticket-link-tests.short.txt'))
+#PRODUCT_REPORT_SHORTLINKS = to_unicode(pkg_resources.resource_string(
+# __name__, 'product-report-link-tests.short.txt'))
+PRODUCT_MILESTONE_SHORTLINKS = to_unicode(pkg_resources.resource_string(
+ __name__, 'product-milestone-link-tests.short.txt'))
+PRODUCT_QUERY_SHORTLINKS = to_unicode(pkg_resources.resource_string(
+ __name__, 'product-query-link-tests.short.txt'))
+PRODUCT_COMMENT_SHORTLINKS = to_unicode(pkg_resources.resource_string(
+ __name__, 'product-comment-link-tests.short.txt'))
+
PRODUCT_NOMATCH_LINKS = to_unicode(pkg_resources.resource_string(
__name__, 'product-nomatch-link-tests.txt'))
@@ -135,22 +153,22 @@ def link_mp_setup(_setup):
# load_products : optional product prefixes list to load at setup time
# *_product_name : target product name (e.g. setup_product_name )
TEST_PRODUCT_CONTEXTS = [
-# {'tc_title_prefix' : 'product: links',
-# 'link_prefix' : 'product:tp1:',
-# 'link_prefix_quote' : 'product:"tp1:',
-# 'path_prefix' : '/products/tp1',
-# 'main_product' : 'tp2',
-# 'setup_product' : 'tp1',
-# 'link_title_prefix' : '[tp1] ',
-# },
-# {'tc_title_prefix' : 'product: links unicode prefix',
-# 'link_prefix' : u'product:xü:',
-# 'link_prefix_quote' : u'product:"xü:',
-# 'path_prefix' : '/products/x%C3%BC',
-# 'main_product' : 'tp2',
-# 'setup_product' : u'xü',
-# 'link_title_prefix' : u'[xü] ',
-# },
+ {'tc_title_prefix' : 'product: links',
+ 'link_prefix' : 'product:tp1:',
+ 'link_prefix_quote' : 'product:"tp1:',
+ 'path_prefix' : '/products/tp1',
+ 'main_product' : 'tp2',
+ 'setup_product' : 'tp1',
+ 'link_title_prefix' : '[tp1] ',
+ },
+ {'tc_title_prefix' : 'product: links unicode prefix',
+ 'link_prefix' : u'product:xü:',
+ 'link_prefix_quote' : u'product:"xü:',
+ 'path_prefix' : '/products/x%C3%BC',
+ 'main_product' : 'tp2',
+ 'setup_product' : u'xü',
+ 'link_title_prefix' : u'[xü] ',
+ },
# Ignored as TracLinks resolver won't match expression
#{'tc_title_prefix' : 'product:: refs to global',
@@ -161,26 +179,35 @@ TEST_PRODUCT_CONTEXTS = [
# 'link_title_prefix' : '<global> '
# },
-# {'tc_title_prefix' : 'global: links',
-# 'link_prefix' : 'global:',
-# 'link_prefix_quote' : 'global:"',
-# 'path_prefix' : '',
-# 'main_product' : 'tp2',
-# 'setup_product' : '',
-# 'link_title_prefix' : '<global> ',
-# },
+ {'tc_title_prefix' : 'global: links',
+ 'link_prefix' : 'global:',
+ 'link_prefix_quote' : 'global:"',
+ 'path_prefix' : '',
+ 'main_product' : 'tp2',
+ 'setup_product' : '',
+ 'link_title_prefix' : '<global> ',
+ },
+ ]
+
+TEST_PRODUCT_CONTEXTS_COMPACT = [
{'tc_title_prefix' : 'short product syntax',
'link_prefix' : 'tp1' + PRODUCT_SYNTAX_DELIMITER,
+ 'link_prefix_quote' : 'tp1%s"' %
PRODUCT_SYNTAX_DELIMITER,
'path_prefix' : '/products/tp1',
'main_product' : 'tp2',
+ 'setup_product' : 'tp1',
+ 'link_title_prefix' : '[tp1] ',
},
{'tc_title_prefix' : 'short product syntax unicode
prefix',
'link_prefix' : u'xü' + PRODUCT_SYNTAX_DELIMITER,
+ 'link_prefix_quote' : u'xü%s"' %
PRODUCT_SYNTAX_DELIMITER,
'path_prefix' : '/products/x%C3%BC',
'main_product' : 'tp2',
'setup_product' : u'xü',
+ 'link_title_prefix' : u'[xü] ',
},
]
+
for _ctx in TEST_PRODUCT_CONTEXTS:
_product_names = {}
for k,v in _ctx.iteritems():
@@ -228,8 +255,6 @@ def test_suite():
teardown=attachment_teardown,
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS)
-
-
suite.addTests(formatter.test_suite(PRODUCT_TICKET_LINKS % ctx,
link_mp_setup(ticket_wikisyntax.ticket_setup),
__file__,
@@ -274,6 +299,53 @@ def test_suite():
mpctx=ctx)
for ctx in TEST_PRODUCT_CONTEXTS)
+
+ # Compact syntax
+ suite.addTests(formatter.test_suite(PRODUCT_SEARCH_SHORTLINKS % ctx,
+ file=__file__,
+ setup=clear_base_href_setup,
+ mpctx=ctx)
+ for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
+ suite.addTests(formatter.test_suite(PRODUCT_ATTACHMENT_SHORTLINKS % ctx,
+ file=__file__,
+ context=('wiki', 'WikiStart'),
+ setup=link_mp_setup(attachment_setup),
+ teardown=attachment_teardown,
+ mpctx=ctx)
+ for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
+ suite.addTests(formatter.test_suite(PRODUCT_TICKET_SHORTLINKS % ctx,
+
link_mp_setup(ticket_wikisyntax.ticket_setup),
+ __file__,
+ # No need to invoke it anymore
+ # ticket_wikisyntax.ticket_teardown,
+ mpctx=ctx)
+ for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
+
+# suite.addTests(formatter.test_suite(PRODUCT_REPORT_SHORTLINKS % ctx,
+#
link_mp_setup(ticket_wikisyntax.report_setup),
+# __file__,
+# mpctx=ctx)
+# for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
+ suite.addTests(formatter.test_suite(PRODUCT_MILESTONE_SHORTLINKS % ctx,
+
link_mp_setup(ticket_wikisyntax.milestone_setup),
+ __file__,
+ ticket_wikisyntax.milestone_teardown,
+ mpctx=ctx)
+ for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
+ suite.addTests(formatter.test_suite(PRODUCT_QUERY_SHORTLINKS % ctx,
+ link_mp_setup(ticket_setup),
+ __file__,
+ ticket_wikisyntax.ticket_teardown,
+ mpctx=ctx)
+ for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
+ suite.addTests(formatter.test_suite(PRODUCT_COMMENT_SHORTLINKS % ctx,
+ clear_base_href_setup,
+ __file__,
+ mpctx=ctx)
+ for ctx in TEST_PRODUCT_CONTEXTS_COMPACT)
+
+
+ # Unmatched expressions
suite.addTest(formatter.test_suite(PRODUCT_NOMATCH_LINKS,
file=__file__))