Debugging issue in PDF export functionality.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging issue in PDF export functionality.

kgardas

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
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Debugging issue in PDF export functionality.

kgardas

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
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>

_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs
Reply | Threaded
Open this post in threaded view
|

Re: Debugging issue in PDF export functionality.

kgardas

Hello,

I'm pinging again with the issue described below. I'd like to fix that
issue myself since we need that in our xwiki application (project's
requirements definition/collection and export into pdf), but I'm not
well versed in this big amount of xwiki code. I expressed my idea about
how I see the issue may be fixed but with nobody reaction it's kind of
hard to work on that. Also with no advice where to touch or how to
attack that it's even harder. Any advice on this is highly appreciated!

Thanks a lot!
Karel

On 12/18/14 11:03 AM, Karel Gardas wrote:

>
> 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
>> [hidden email]
>> http://lists.xwiki.org/mailman/listinfo/devs
>>
>
> _______________________________________________
> devs mailing list
> [hidden email]
> http://lists.xwiki.org/mailman/listinfo/devs
>

_______________________________________________
devs mailing list
[hidden email]
http://lists.xwiki.org/mailman/listinfo/devs