On Wed, Jan 6, 2016 at 5:57 PM, Eduard Moraru <enygma2002(a)gmail.com> wrote:
Hi devs,
As XWIKI-12920 [1] mentions, we need to hide "WebHome" references in the
wiki syntax for links and images (for now) in order to be consistent with
what we did in the UI.
What this means is that [[label>>Page.WebHome]] should be equivalent to
[[label>>Page]].
The plan is to apply the same logic as we did for URLs and detailed by
Vincent in "Solution 2" in his comment on the issue [2].
In order to achieve this, Vincent proposed to introduce a new "space:"
resource type and make this new type the default instead of "doc:" which is
the current default.
Before:
[[label>>Page]] => [[label>>doc:Page]]
After:
[[label>>Page]] => [[label>>space:Page]] if "Page.WebHome"
exists,
or => [[label>>doc:Page]] if
"<currentSpace>.Page"
exists,
or => wanted link to create "Page.WebHome" when
clicked.
Using either the "doc:" or the "space:" versions manually will
resolve the
requested resource, without doing any fallback resolution (which is applied
only for the no-prefix version).
For the same consistency reason, we need to apply the same fallback to the
"attach:" resource type, e.g:
[[attach:Page@file.ext]] => [[label>>attach:space:Page@file.ext]] ||
[[label>>attach:doc:Page@file.ext]]
However, a resource is defined as ((type:) resource) so for attachments we
would need to extend the type's definition to allow it to contain ":" in
the type name (i.e. "attach:doc" and "attach:space") so that more
variations are tested when resolving a link reference before treating it as
a generic/untyped reference (this is where the fallback mechanism kicks in).
There is also the image syntax that needs to be extended to support the
same fallback logic, so something like:
image:Page => image:space:Page || image:doc:Page
In all these cases:
* link space: prefix,
* link attach:doc and attach:space prefixes and
* image space: and doc: prefix
... we would be breaking backwards compatibility in the sense that if a
wiki with the name "space" (and/or "doc", depending on which case of
the
above you are) already existed in the wiki farm, any links pointing to
documents in that wiki from other wikis will be broken, because, for
example [[label>>space:Page]] no longer points to the document
"space:Page.WebHome" (from wiki "space"), but to the document
"Page.WebHome" from the current wiki (where the link is made). To fix this,
one would have to write [[label>>space:space:Page]] instead.
"[[label>>space:Page]]" does not mean "space:Page.WebHome" right
now
but "<currentwiki>:<currentpscae>.space:Page"
I guess we could/should write a migrator to try to fix most of these cases
automatically (like we fix links to a document that was renamed), but a
couple of links will be unfixable if they are built programatically (e.g.
by velocity scripts) and the process could prove to be extremely lengthy
one (due to the parsing, processing, serialization and resaving of each
document).
Please feel free to comment on the above described approach.
Thanks,
Eduard
P.S.: I did not mention macro parameter references which would also need a
solution for hiding the "WebHome" part, but I`d prefer it if we handle that
another time / in another thread.
----------
[1]
http://jira.xwiki.org/browse/XWIKI-12920
[2]
http://jira.xwiki.org/browse/XWIKI-12920?focusedCommentId=89129&page=co…
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Thomas Mortagne