[pmwiki-users] Alternative markup resolution within "code" sections for PDF printing (Nigel Thomas)

john.rankin at affinity.co.nz john.rankin at affinity.co.nz
Fri Dec 19 14:09:27 CST 2008


> JR
>
> See
> Examples/HyperlinkedCode<http://wikipublisher.org/wiki/?n=Examples.HyperlinkedCode>
> for
> the example, which I hope is self-explanatory.

Hello Nigel

Have another look at:
http://wikipublisher.org/wiki/Examples/HyperlinkedCode


The simplest solution is to treat [[text -> link]] differently from
[[link | text]] markup, when the format is pdf. I haven't enabled
this on wikipublisher.org, but you can easily test it.

If we reserve [[link | text]] markup for syntax blocks, then we can
create a special PDF markup rule in local/config.php before loading
the wikipublisher extensions:

  ## [[target | text]]
  if ($format=='pdf') Markup('[[|','<[[',
    "/(?>\\[\\[([^|\\]]*)\\|\\s*)(.*?)\\s*\\]\\]($SuffixPattern)/e",
    " '<tbook:visual markup=\'tt\'>' . Keep(PSS('$2').'$3','L') .
'</tbook:visual>' ");

I haven't had time to test this. If it works, we can then look at
smartening it to make the links clickable in the PDF, without
adding the print-friendly extensions. But first let's prove the
concept. Note that the monotype font is now applied as a
consequence of the semantics of the content, rather than being
a separate style.

>
> The ideal would be for the PDF to include the links, without changing the
> code / syntax by adding extraneous (confusing) text like [below], (w),
> (w#anchor) etc. And in monotype.

The above solution should do all that, it doesn't require any new
markup, but it does mean using pmwiki's 2 link schemes for
distinct purposes.
>
> The next best would be for some markup that simply converted the thing to
> a
> code block and dumped the links, without needing two different
> representations.
>
> I think I understand that your suggestion would cause all links to (local?
> or remote as well?) anchors to be removed. That would also affect links in
> the narrative text, wouldn't it?

Not now that we use the 2 pmwiki link options to distinguish between
the 2 forms.
>
> Thanks for your help
>
> Nigel
>
> 2008/12/19 John Rankin <john.rankin at affinity.co.nz>
>
>> Hope this helps
>> JR
>>
>






More information about the pmwiki-users mailing list