[pmwiki-users] preformatted text block *with* formatting? (bug in [@..@] ?)

Patrick R. Michaud pmichaud at pobox.com
Wed May 24 13:45:47 CDT 2006


On Wed, May 24, 2006 at 10:29:33AM -0700, Jo Rhett wrote:
> It would appear that [@...@] also assumes [=...=].  This isn't documented
> clearly.

It does.  [@...@] at one time was really a shortcut for @@[=...=]@@.

> It also presents problems for creating documentation, where variables and
> such are italicized.  I need to do large blocks of text like so
> 
> [@
> $ run this command
> ''see this italicized output''
> $ run this command
> see this 'italicized word'' in a larger output
> see this clickable http://link/to/somewhere in the output
> $ run this command with an ''italicized word'' in the middle
> see this normal output
> @]
> 
> I really need the ability to get a monospaced font over a large block of
> text *but with normal pmwiki formatting*.   How can I do this?

Well, the simple way to do it is to just preceed each line with whitespace:

      $ run this command
      ''see this italicized output''
      $ run this command
      see this 'italicized word'' in a larger output
      see this clickable http://link/to/somewhere in the output
      $ run this command with an ''italicized word'' in the middle
      see this normal output

But another way to do it is using font-family:monospace :

    (:linebreaks:)
    >>font-family:monospace<<
    $ run this command
    ''see this italicized output''
    $ run this command
    see this 'italicized word'' in a larger output
    see this clickable http://link/to/somewhere in the output
    $ run this command with an ''italicized word'' in the middle
    see this normal output
    >><<

Another way of doing it is to define a local css class in pub/css/local.css:

    .pre { font-family:monospace; white-space:pre; }

and then do

    >>pre<<
    $ run this command
    ''see this italicized output''
    $ run this command
    see this 'italicized word'' in a larger output
    see this clickable http://link/to/somewhere in the output
    $ run this command with an ''italicized word'' in the middle
    see this normal output
    >><<

See each of the above at http://www.pmwiki.org/wiki/Test/PreWithFormatting.

> Honestly, I think that making [@ be different from @@ is a bug.  If you
> want monospaced font *and* no formatting, you can do this
> 
> [@ [= ... =] @]

Actually, that becomes @@[= ... =]@@, as mentioned before.

The purpose of [@...@] is to have large blocks of monospace text
with no formatting, because those occur quite frequently in pages.
The case you describe--display a block of monospace text where
formatting is honored is *much less* common.  (I speak from years
of experience here.)  At any rate, there are far too many sites
making use of the existing [@...@] markup for it to be changed now.

Pm




More information about the pmwiki-users mailing list