ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* redefining paragraph breaks
@ 2012-01-03 19:31 Chris Lott
  2012-01-03 20:14 ` Wolfgang Schuster
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chris Lott @ 2012-01-03 19:31 UTC (permalink / raw)
  To: Mailing list for ConTeXt users

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.

?

c
--
Chris Lott <chris@chrislott.org>
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: redefining paragraph breaks
  2012-01-03 19:31 redefining paragraph breaks Chris Lott
@ 2012-01-03 20:14 ` Wolfgang Schuster
  2012-01-04 10:04 ` Hans Hagen
  2012-01-06  4:09 ` Michael Talbot-Wilson
  2 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2012-01-03 20:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: redefining paragraph breaks
  2012-01-03 19:31 redefining paragraph breaks Chris Lott
  2012-01-03 20:14 ` Wolfgang Schuster
@ 2012-01-04 10:04 ` Hans Hagen
  2012-01-06  4:09 ` Michael Talbot-Wilson
  2 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2012-01-04 10:04 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 3-1-2012 20:31, Chris Lott wrote:
> 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.:

only with a lot of side effects

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: redefining paragraph breaks
  2012-01-03 19:31 redefining paragraph breaks Chris Lott
  2012-01-03 20:14 ` Wolfgang Schuster
  2012-01-04 10:04 ` Hans Hagen
@ 2012-01-06  4:09 ` Michael Talbot-Wilson
  2012-01-06 12:54   ` Michael Talbot-Wilson
  2012-01-06 16:17   ` Hans Hagen
  2 siblings, 2 replies; 6+ messages in thread
From: Michael Talbot-Wilson @ 2012-01-06  4:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 473 bytes --]

On Tue, 3 Jan 2012, Chris Lott wrote:

> 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.
>
> ?
>
> c

Can't you use plain's \everypar?

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: redefining paragraph breaks
  2012-01-06  4:09 ` Michael Talbot-Wilson
@ 2012-01-06 12:54   ` Michael Talbot-Wilson
  2012-01-06 16:17   ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Talbot-Wilson @ 2012-01-06 12:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

[-- Attachment #1: Type: TEXT/PLAIN, Size: 723 bytes --]

On Fri, 6 Jan 2012, Michael Talbot-Wilson wrote:

> On Tue, 3 Jan 2012, Chris Lott wrote:
>
>> 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.
>> 
>
> Can't you use plain's \everypar?

Not plain, built-in, but it's not the thing.  The thing's \let.

\starttext
\let\oldp=\par
\def\par{\P}
In case you

can't tell,

this is a test.
\let\par=\oldp

\stoptext

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: redefining paragraph breaks
  2012-01-06  4:09 ` Michael Talbot-Wilson
  2012-01-06 12:54   ` Michael Talbot-Wilson
@ 2012-01-06 16:17   ` Hans Hagen
  1 sibling, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2012-01-06 16:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 6-1-2012 05:09, Michael Talbot-Wilson wrote:
> On Tue, 3 Jan 2012, Chris Lott wrote:
>
>> 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.
>>
>> ?
>>
>> c
>
> Can't you use plain's \everypar?

don't touch that one if you don't want to loose functionality (some day 
it will be more heavily protected)

\EveryPar is a user hook

but even then, it comes to late for this purpose as the new paragraoh 
has already been started

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-06 16:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-03 19:31 redefining paragraph breaks Chris Lott
2012-01-03 20:14 ` Wolfgang Schuster
2012-01-04 10:04 ` Hans Hagen
2012-01-06  4:09 ` Michael Talbot-Wilson
2012-01-06 12:54   ` Michael Talbot-Wilson
2012-01-06 16:17   ` Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).