Recent Changes
Recent Changes · Search:

Quotations | HomePage | Need Some Space

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"%

bnfterm ::= <localanchor> | <anotherpage> | <anotherpageanchor>

<localanchor> ::= [ this.[that.[the other]]]




These are 3 pipe problems.

Support for styles in Wikipublisher is limited to simple attributes like text colour. This is because:

  1. translating the full set of HTML style attributes into LATEX equivalents is a pig of a problem
  2. styles are often surrogates for structure and LATEX works better with structured content; many people think HTML does too
  3. nobody has ever wanted full style support badly enough to provide the resources (time or money) to develop it

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(‘[[|’,’<[[‘,
   “ ‘<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”.

Page last modified on 20 December 2008 at 09:27 AM