Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
problem with dw2pdf and code plugin: no brackets
pdf export of code with a language tag produce ( instead of a bracket
Avatar
horstjens #1
Member since Jul 2009 · 14 posts · Location: Wien
Group memberships: Members
Show profile · Link to this post
Subject: problem with dw2pdf and code plugin: no brackets
I run into several problems using dw2pdf plugin togehter with code plugin.

most urgent: if i use the code plugin together with a language tag, like
<code pyhton> .... some code </code>
i get html  entities instead of brackets:
&#40;

I sent an email to the plugin authors but maybe some of you found a solution.

See full description below and test page with pdf to download:
http://pythongamebook.unkompliziert.org/en:resources:peopl…


Dear Dokuwiki plugin coding heroes,

i run into problems when using dw2pdf and code plugin togehter.

Problems:
  * brackets are not rendered in pdf inside <code python> blocks
  * some graphics are not rendered in pdf
  * commands inside a <nowwiki> block are not rendered in pdf

See attachment or
http://pythongamebook.unkompliziert.org/en:resources:peopl…

=================    brackets: ======================

As soon as i try to pdf-export an code block with "python" language, i
get html entities instead of brackets ():


pdf export ignore (some?) graphics and replaces all brackets ()[]{}
replaces brackets with html entities:
&#40;
&#41;
&#91;
&#93;
&#123;
&#125;


if selecting "printable version" graphics appear ok, but there is no
linebreak in <code> blocks, resulting in extremly long lines

textonly works fine

no colors



================ graphics ==================

It looks like the pdf exporter has trouble finding the graphic if the
graphic file is not located inside dokuwiki's media manager or if the
graphic file is located at another namespace than the current dokuwiki
page. See pdf attachment and compare with .odt attachment or with this
url:
http://pythongamebook.unkompliziert.org/en:resources:peopl…


================ nowiki ====================
at the beginning of the code blocks, those lines are used in the wiki
first code block:
<nowiki><code>...</code></nowiki>
second code block:
<nowiki><code python>...</code></nowiki>

in pdf, only the 3 dots are rendered.
==============================================

you would make me very happy by providing solutions, most urgent to the
brackets problem or hints how to avoid those problems. i try to write a
free programming-learning book used for kids in schools using dokuwiki.


greetings from Vienna,
 -Horst
http://www.spielend-programmieren.at
Avatar
polar #2
Member since Sep 2010 · 7 posts
Group memberships: Members
Show profile · Link to this post
A little late, but maybe this could help any future visitors:
The brackets problem with PDF-Export using dw2pdf can be solved in lib/plugins/dw2pdf/action.php .
Maybe this function helps:

    // Custom function for help in replacing &#039; &quot; &gt; &lt; &amp;
    function strip_htmlencodedchars($str) {
      $str = str_replace('&#039;', '\'', $str);
      $str = str_replace('&quot;', '"', $str);
      $str = str_replace('&gt;', '>', $str);
      $str = str_replace('&lt;', '<', $str);
      $str = str_replace('&amp;', '&', $str);
      $str = str_replace('&#40;', '(', $str);
      $str = str_replace('&#41;', ')', $str);
      $str = str_replace('&#123;', '{', $str);
      $str = str_replace('&#125;', '}', $str);
      $str = str_replace('&#91;' , '[', $str);
      $str = str_replace('&#93;' , ']', $str);
      return $str;
    }
    // Custom function for help in replacing &#039; &quot; &gt; &lt; &amp;

Hope this helps, cheers polar ;)
Avatar
Traptak #3
Member since Nov 2010 · 3 posts · Location: Poland
Group memberships: Members
Show profile · Link to this post
Yes! It works correctly. Thank you very much for this fix - it save me a lot of time.

best regards
Adam Siwoń
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-04-20, 00:34:23 (UTC +02:00)