groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Question about .substring


From: Steffen Nurpmeso
Subject: Re: [Groff] Question about .substring
Date: Fri, 28 Nov 2014 21:11:01 +0100
User-agent: s-nail v14.7.8-73-g5bf9347

 |I think his point is[.]

No, it works fine in practice:

  CLEAN UP <\&Os\&>
  1st substr <\&> (of <\&Os\&>)
  1st substr starts with \&: <\&Os\&> new <Os\&>
  2nd substr <\&> (of <\&Os\&>)
  2nd substr ends with \&: <\&Os\&> new <Os>
  CLEANUP RETURNS <Os> (for <\&Os\&>)

It was generated with this piece of code:

  . \" TODO doc-mx-cleanup-string: replace with .stringof, if d
  .de doc-mx-cleanup-string
  .tm1 CLEAN UP <\$1>
  . ds doc-mx-cleans \$1
  . ds doc-mx-c-s##s \$1
  . \" XXX This only works because GNU troff works like that :)
  . substring doc-mx-c-s##s 0 0
  .tm1 1st substr <\*[doc-mx-c-s##s]> (of <\$1>)
  . if '\&'\*[doc-mx-c-s##s]' \{\
  .   substring doc-mx-cleans 1
  .tm1 1st substr starts with \&: <\$1> new <\*[doc-mx-cleans]>
  . \}
  . ds doc-mx-c-s##s \$1
  . \" XXX This only works because GNU troff works like that :)
  . substring doc-mx-c-s##s -1
  .tm1 2nd substr <\*[doc-mx-c-s##s]> (of <\$1>)
  . if '\&'\*[doc-mx-c-s##s]' \{\
  .   substring doc-mx-cleans 0 -2
  .tm1 2nd substr ends with \&: <\$1> new <\*[doc-mx-cleans]>
  . \}
  .tm1 CLEANUP RETURNS <\*[doc-mx-cleans]> (for <\$1>)
  ..

But quirkiness is of course loveable.

P.S.: i need more time for mdocmx(7).  My desire is that it covers
a lot of existing manuals even today (with the preprocessor).
Ciao -- and have a nice weekend!

--steffen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]