# Re: [NTG-context] redefining paragraph breaks

Am 03.01.2012 um 20:31 schrieb Chris Lott:

> I know I could do it manually, but that makes the source ugly, so is
> there a way to redefine paragraph breaks so that instead of actual
> breaks in the output they are kept as running text separate by a
> paragraph symbol, e.g.:
>
> This is paragraph 1.
>
> This is paragraph 2.
>
> Becomes in the typeset document:
>
> This is paragraph 1. ¶ This is paragraph 2.


You can save the text in a buffer and replace the empty lines with the
paragraph symbol.

\startluacode

userdata = userdata or { }

function userdata.specialparagraph()
local text = buffers.getcontent("specialparagraph")
text = string.gsub(text,"\n\n"," ¶ ")
context(text)
end

\stopluacode

\def\startspecialparagraph

{\dostartbuffer[specialparagraph][startspecialparagraph][stopspecialparagraph]}

\def\stopspecialparagraph
{\ctxlua{userdata.specialparagraph()}}

\starttext

This is paragraph 1.

\startspecialparagraph
This is paragraph 2.

This is paragraph 3.
\stopspecialparagraph

This is paragraph 4.

\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________