SubWiki page syntax

23 views
Skip to first unread message

Roger Oberholtzer

unread,
Aug 27, 2014, 7:27:46 AM8/27/14
to trac-...@googlegroups.com
I am trying to Include a sub-wiki page in a wiki page. If I have a page called 'here', the following works:

     [[Include(here/subPage)]]

but the following does not:

     [[Include(./subPage)]]

It complains that ./subPage cannot be found. According to the docs, the second syntax should be equivalent with the first.

I am running Trac 1.0.1

--
Roger Oberholtzer

Steffen Hoffmann

unread,
Aug 27, 2014, 3:52:09 PM8/27/14
to trac-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27.08.2014 13:27, Roger Oberholtzer wrote:
> I am trying to Include a sub-wiki page in a wiki page. If I have a page
> called 'here', the following works:
>
> [[Include(here/subPage)]]
>
> but the following does not:
>
> [[Include(./subPage)]]
>
> It complains that ./subPage cannot be found. According to the docs, the
> second syntax should be equivalent with the first.

With docs you refer to TracLinks, specifically the paragraph on relative
links [1]? Well, a short look at the current source code reveals, that
that wiki page name resolution is not implemented yet in IncludeMacro.
To implement it, one would have to use a wiki page link resolver syntax
like in WikiSystem component [2]. Unluckily that one is modular, but not
exposed for re-use by plugins, so we would need to copy it.

Steffen Hoffmann


[1] http://trac.edgewall.org/wiki/TracLinks#Relativelinks
[2] http://trac.edgewall.org/browser/trunk/trac/wiki/api.py?rev=12853#L405

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlP+NtYACgkQ31DJeiZFuHc0ugCfS5OMc9X3o3oKO+/c8eyXWMCI
UDwAoJKCiE3JUU3Mi0lpTsl6/8PbToSJ
=pSeJ
-----END PGP SIGNATURE-----

Roger Oberholtzer

unread,
Aug 27, 2014, 3:55:25 PM8/27/14
to trac-...@googlegroups.com
OK. It was not critical. It was going to simplify some boiler plate wiki pages we use.



--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.



--
Roger Oberholtzer

Peter Suter

unread,
Aug 27, 2014, 4:22:18 PM8/27/14
to trac-...@googlegroups.com
On 27.08.2014 21:51, Steffen Hoffmann wrote:
> Unluckily that one is modular, but not exposed for re-use by plugins,
> so we would need to copy it.

Actually it is a bit exposed now, since it is reused in TitleIndexMacro
[1]. (At least the requested, and IMO most useful part.)

I think it would be something like this:

if page_name and formatter.resource and
formatter.resource.realm == 'wiki':
page_name = formatter.wiki.resolve_relative_name(page_name,
formatter.resource.id)

Added just before retrieving the WikiPage [2].

[1] http://trac.edgewall.org/ticket/11455
[2]
http://trac-hacks.org/browser/includemacro/trunk/includemacro/macros.py#L84

Steffen Hoffmann

unread,
Aug 27, 2014, 9:22:06 PM8/27/14
to trac-...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 27.08.2014 22:22, Peter Suter wrote:
> On 27.08.2014 21:51, Steffen Hoffmann wrote:
>> Unluckily that one is modular, but not exposed for re-use by plugins,
>> so we would need to copy it.
>
> Actually it is a bit exposed now, since it is reused in TitleIndexMacro
> [1]. (At least the requested, and IMO most useful part.)
>
> I think it would be something like this:
>
> if page_name and formatter.resource and formatter.resource.realm
> == 'wiki':
> page_name = formatter.wiki.resolve_relative_name(page_name,
> formatter.resource.id)
>
> Added just before retrieving the WikiPage [2].

Right, I saw that. While this is a good thing for the future, it is a)
not too hard to include the full support and b) not
backwards-compatible. AFAIK current IncludeMacro still aims at 0.11
compatibility.

I've proposed a solution for the corresponding, rather old ticket [3],
saving a conditional import of the aforementioned method for .

Steffen Hoffmann


[3] http://trac-hacks.org/ticket/3591
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iEYEARECAAYFAlP+hCMACgkQ31DJeiZFuHd9KgCeOkY+fY2uFqAjy+6HqdjeFQTR
LgYAoLi8o9QQfO7/f+SejMy3HTurC4Fl
=jsJg
-----END PGP SIGNATURE-----
Reply all
Reply to author
Forward
0 new messages