m4-discuss
[Top][All Lists]
Advanced

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

patsubst: multiline text


From: clemens fischer
Subject: patsubst: multiline text
Date: Mon, 06 Sep 2010 17:57:43 +0200
User-agent: tin/1.9.6-20100313 ("Lochruan") (UNIX) (Linux/2.6.35.4-spott (i686))

Hi,

I need to do this:

changequote(`{', `}')
define({ml_text}, {
line 1
line 2
line 3
})
patsubst({ml_text}, {regex}, {subst}) ->
- line 1
  line 2
  line 3

What are proper values for {regex} and {subst}?

This is for a preprocessor "normalizing" different (wiki) markups like
asciidoc or docutils, where sometimes unordered lists need to have some
special character for the first line and all following lines must line
up withe text portion of the first line.

It is clear to me that the problem might need partitioning: first insert
the magic character before the first line, then spaces before all
following lines, thus two patsubst's could be needed.

My problem is with the newlines in the text, I'm unable to match the
portions before and after them.  I already tried a number of
combinations, with and without literal newlines in {regex}, using eg.
{^\(.+?\)\n} or {^\(.+?\)\\n} or {^\([^\\n]\)+} for {regex}, but the
statements in m4.info referring to the emacs regex syntax seem to need
qualification, so to speak.  I've also tried to "define({_nl_}, <literal
newline here>)" or using that literal directly, nothing helps.


clemens




reply via email to

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