Hello,
my idea to fix that issue is to kind of:
- get all macros on the page
- exec all macros (to get xwiki syntax content)
- pass this to Document
- get links from this document
This way even:
{{groovy}}
println "[[Page6]]"
{{/groovy}}
should be a link in document and so exported into PDF correctly.
If my way is sane, then unfortunately I'm stuck on the first step of
getting macros from the Document. It looks like:
All included macros are:<br>
#foreach($mmm in $pageDoc.getIncludedMacros())
$mmm<br>
#end
velocity code added into includeLinks macro produce empty output so
there is no macros returned from $pageDoc.getIncludedMacros() which
looks like a wrong result since on the page there is groovy macro which
is provided above. Is this a bug or do I understand semantics of
$pageDoc.getIncludedMacros() in a wrong way? I'm asking if I shall
report it or not.
Also is my way described above sane or is there any short-path available
in the XWiki code. What I need is to execute all macros on the Document
and then from this "pre-executed" Document get all links so that PDF
export velocity code works well.
Thanks!
Karel
On 12/17/14 11:52 AM, Karel Gardas wrote:
Hello,
I'm trying to debug those two issues:
http://jira.xwiki.org/browse/XPDFECA-11
http://jira.xwiki.org/browse/XPDFECA-12
to easy my debugging work, I've installed jetty-based 6.3 xwiki
enterprise distro and I'm editing files directly in it (so far just
velocity macros hacking).
Now I'm in templates/macros.vm which looks like it is kind of processed
into skins/flamingo/macros.vm -- so I'm editing directly this file and
restarting xwiki server after every change. I'm testing on a page:
<page code>
This is a page to test pdf export facility. Let's link all the pages here:
[[Page1]]
[[Page2]]
[[Page3]]
[[Page4]]
[[Page5]]
Now, let's test if we're able to pdf export groovy script output.
{{groovy}}
println 10;
println "[[Page6]]"
{{/groovy}}
</page code>
Now, the problem is that for this testing page I get just links to Page1
to Page5. The link to Page6 is missing. I've modified includeLinks to
include this code:
#macro(includeLinks $page $withPageBreaks)
hacked includeLinks is in effect -- 2 -- flamingo!!!!
What is clevel?: $clevel
#if($clevel && $clevel!=0)
we are working on a page: $page
#set($pageDoc = $xwiki.getDocument($page))
All links are:<br>
#foreach($child in $pageDoc.getLinks())
#set($childDocName = $child.getLink())
$childDocName<br>
#end
so I can see all the links. So it looks like to fix that I'll need to
kind of pre-render the page somehow and then obtain links from the
rendered data -- or kind of that. Is there some functionality for this
already presented in XWiki? If so, any hint where it is is highly
appreciated here!
Thanks a lot,
Karel
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs