This page gives an example of BNF syntax being displayed in monotype — like code — but with links to terms that may be defined either locally in this page, or remotely in another page. These syntax examples are surrounded with text that itself may make links locally (eg to the Example) or to a remote page or page anchor. These links (and the links in the syntax) may be to the current group (which represents a book, defined by a wikitrail) or to another group.
In the PDF example, the link to #localanchor includes the unwanted [below] link. Also the syntax style shown below is only partially observed — the block is not in monotype.
%define=syntax block font-family="monospace" margin-left="30px" margin-right="30px" bgcolor='#99ccff' border="1px dotted grey"% %define=code block font-family="monospace" margin-left="30px" margin-right="30px" bgcolor='#99ccff' border="1px dotted grey"%
These are 3 pipe problems.
Support for styles in Wikipublisher is limited to simple attributes like text colour. This is because:
Changing the behaviour of link display based on context — stylistic context at that, not even structural context — is at first sight an impenetrable problem. However, we can do anything™ so it’s just a question of finding the way in.
The easiest solution is to discriminate between link | text and text → link markup. 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>’ “);
That should work… Note that the typewriter font gets applied as a consequence of the semantics of the content, rather than as a style. There may also be a way to make the link text clickable in the PDF, without adding the visual embellishments like “below”.