Opened 18 years ago
Closed 18 years ago
#3757 closed defect (fixed)
Changeset 3610 changes ReST formatter behaviour
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | normal | Milestone: | 0.10 |
Component: | wiki system | Version: | 0.10b1 |
Severity: | minor | Keywords: | reStructuredText |
Cc: | alastair@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
I've just upgraded a trac installation to 0.10b1 and discovered that reST links that previously worked were marked as "broken trac links." I trawled through at the code, I traced it down to [3610].
Previously, if a link was not in CamelCase, the reST formatter would make it into a "to be added" link, rather than a warning box. Similarly, if a link was in non-conforming CamelCase such as "AddingMySQLAccounts", it would still link to the right page. With the refactoring patch in [3610], all this behaviour has changed. Instead, these links will now cause a warning box to show up.
I'm not sure what the best way to approach it is, but it seems some more thought on the rst.py refactoring is needed.
Attachments (0)
Change History (6)
comment:1 by , 18 years ago
Owner: | changed from | to
---|---|
Severity: | normal → minor |
follow-up: 3 comment:2 by , 18 years ago
Cc: | added |
---|
Sorry, I didn't realise that being the reporter doesn't mean I get email when this ticket get's updated.
Adding the wiki prefix is ugly and doesn't behave the same way as the regular TracWiki syntax behaves. I think the way the ReST way of parsing links should follow as closely as what TracWiki does. Given in 0.10, the default behaviour is to default to a wiki page when no prefix is specified, I think the old behaviour should be restored. Or, at the very least, the outputted HTML should not have "wiki:" in it.
comment:3 by , 18 years ago
Keywords: | reStructuredText added |
---|---|
Milestone: | → 0.10.1 |
Replying to alastair@liquidx.net:
Adding the wiki prefix is ugly and doesn't behave the same way as the regular TracWiki syntax behaves. I think the way the ReST way of parsing links should follow as closely as what TracWiki does.
It's exactly what happens, actually.
Given in 0.10, the default behaviour is to default to a wiki page when no prefix is specified,
Only if the target is a WikiPageName. You might have been confused by a short period of time during 0.10 development in which any target not otherwise recognized was interpreted as a Wiki link, but this behavior has been reverted, as it triggered too many "false positives".
I think the old behaviour should be restored.
That being said, the reST link syntax is certainly less ambiguous than the TracLinks [...]
one, and I think we could turn any unrecognized target into a Wiki link.
Can you please try out the following change:
Index: rst.py =================================================================== --- rst.py (revision 3774) +++ rst.py (working copy) @@ -59,14 +59,20 @@ def trac_get_reference(rawtext, target, text): link = wiki_to_link(target, self.env, req) + uri = None + missing = False if isinstance(link, Element): - uri = link.attr.get('href', '') - if uri: - reference = nodes.reference(rawtext, text or target) - reference['refuri']= uri - if 'missing' in link.attr.get('class', ''): - reference.set_class('missing') - return reference + uri = link.attr.get('href', '') + missing = 'missing' in link.attr.get('class', '') + else: + uri = req.href.wiki(target) + missing = not WikiSystem(self.env).has_page(target) + if uri: + reference = nodes.reference(rawtext, text or target) + reference['refuri']= uri + if missing: + reference.set_class('missing') + return reference return None def trac(name, arguments, options, content, lineno,
(targetting for 0.10.1, but depending on feedback and timeframe, this might eventually end-up in 0.10)
comment:4 by , 18 years ago
Thanks for the quick reply. It just applied the patch along with the change from trac.util.markup to trac.util.html and it is working like it used to.
It would be great if this was in 0.10.0.
comment:5 by , 18 years ago
Milestone: | 0.10.1 → 0.10 |
---|
comment:6 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
[3785:3786] are two more bug fixes related to WikiRestructuredTextLinks.
Well, you can still link to your non-conforming CamelCase links, by using the
wiki:
link resolver prefix, as you would in TracWiki.e.g.
renders as:
wiki:AddingMySQLAccounts
However we could also decide to link to a Wiki page by default, if the target is not otherwise detected as a TracLinks. The "risk" would then be that a malformed TracLinks would not be immediately identifiable.