ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* A "Lorem ipsum" module?
@ 2012-07-18  9:42 Marcin Borkowski
  2012-07-18 10:18 ` Marco
  2012-07-18 11:33 ` Philipp Gesang
  0 siblings, 2 replies; 11+ messages in thread
From: Marcin Borkowski @ 2012-07-18  9:42 UTC (permalink / raw)
  To: ConTeXt mailing list

Hi all,

in LaTeX, there is quite a useful package called "lipsum", for
typesetting varioud amounts of "Lorem ipsum" stuff.  Is there anything
like that in ConTeXt?  (I know about \input knuth, \input tufte etc.,
but that is not exactly what I have in mind, especially when giving a
sample of some design to a customer;).)

If not (as I suspect), what should I do to write such a module?  I
expect this shouldn't be too difficult, and I could learn a few things
(like using key-value syntax in ConTeXt, for instance); are there any
recommendations for people wanting to learn to write a (simple) module
for ConTeXt (other than the relevant wiki page)?  For example, which
existing modules might I want to take and read the source code of?

Best,

-- 
Marcin Borkowski
http://mbork.pl
___________________________________________________________________________________
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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-18  9:42 A "Lorem ipsum" module? Marcin Borkowski
@ 2012-07-18 10:18 ` Marco
  2012-07-18 11:33 ` Philipp Gesang
  1 sibling, 0 replies; 11+ messages in thread
From: Marco @ 2012-07-18 10:18 UTC (permalink / raw)
  To: ntg-context

On 2012-07-18 Marcin Borkowski <mbork@wmi.amu.edu.pl> wrote:

> in LaTeX, there is quite a useful package called "lipsum", for
> typesetting varioud amounts of "Lorem ipsum" stuff.  Is there anything
> like that in ConTeXt?  (I know about \input knuth, \input tufte etc.,
> but that is not exactly what I have in mind, especially when giving a
> sample of some design to a customer;).)

You can use the visual module for generating “fake” text or the dum
MP module for dummy figures. Example:

% fake words
\usemodule
  [visual]

% for colourful dummy figures
\useMPlibrary
  [dum]

\setupindenting
  [yes, medium]

\starttext

\fakenwords{100}{200}

\externalfigure [dummy]

% Rumours say, Mojca used this feature for her thesis
\simplethesis

\stoptext

> are there any recommendations for people wanting to learn to write
> a (simple) module for ConTeXt (other than the relevant wiki page)?

Have a look at the existing modules.

Marco


___________________________________________________________________________________
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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-18  9:42 A "Lorem ipsum" module? Marcin Borkowski
  2012-07-18 10:18 ` Marco
@ 2012-07-18 11:33 ` Philipp Gesang
  1 sibling, 0 replies; 11+ messages in thread
From: Philipp Gesang @ 2012-07-18 11:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1663 bytes --]

Hey Marcin,

···<date: 2012-07-18, Wednesday>···<from: Marcin Borkowski>···

> If not (as I suspect), what should I do to write such a module?  I
> expect this shouldn't be too difficult, and I could learn a few things
> (like using key-value syntax in ConTeXt, for instance); are there any
> recommendations for people wanting to learn to write a (simple) module
> for ConTeXt (other than the relevant wiki page)?  For example, which
> existing modules might I want to take and read the source code of?

Wolfgang’s fancybreak module is a good place to start, because it
demonstrates the current namespace syntax quite nicely. Also, it
is very specific wrt functionality, so it can be understood
completely by just reading the code. (Of course you should be
familiar with the module from a user perspective but that’s no
effort.)

  https://bitbucket.org/wolfs/fancybreak/src/20ec76c5e154/files/t-fancybreak.mkvi

Happy TeXing!
Philipp

> 
> Best,
> 
> -- 
> Marcin Borkowski
> http://mbork.pl
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

-- 
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

[-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --]

[-- 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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-19 11:08 ` Hans Hagen
  2012-07-19 14:42   ` Marco
  2012-07-19 15:17   ` Marco
@ 2012-07-19 23:20   ` Sietse Brouwer
  2 siblings, 0 replies; 11+ messages in thread
From: Sietse Brouwer @ 2012-07-19 23:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hans wrote:
> I've added a module m-ipsum.

Duly wikified, although heaven knows whether people will actually find
it that way. No matter: soon we will have navboxes and that will give
us a shot at coherent topic-based navigation. For now I've made a
pagelet at http://wiki.contextgarden.net/Dummy_text, as well as an
entry on the Modules page.

> I have no clue if it provides what one expects from such a module

Personally, I think the ability to write one's thesis is a reasonable
expectation. ;-)

% Shamelessly borrowed from
% http://repo.or.cz/w/context.git/blob/HEAD:/tex/context/base/m-visual.mkiv#l234

\unexpanded\def\ipsumthesis
  {\setupsystem[random=1234]
   \title{\ipsum[alternative=lines, n=1]} % the first line from the sample text
   \placelist[chapter,section]
   \dorecurse{3}
     {\chapter{\ipsum[alternative=lines, n=random]}  % random sentence
from the sample text
      \dorecurse{5}
        {\section{\ipsum[alternative=lines, n=random]}
         \dorecurse{4}
           {\dorecurse{3}{\ipsum[alternative=paragraph, n=random]\endgraf}
            \placefigure
              {\ipsum[alternative=lines,n=random]}
              {\fakeimage{5cm}{3cm}{10cm}{5cm}}
            \dorecurse{2}{\ipsum[alternative=paragraph, n=random]\endgraf}}}}}

Regards,

Sietse
___________________________________________________________________________________
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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-19 11:08 ` Hans Hagen
  2012-07-19 14:42   ` Marco
@ 2012-07-19 15:17   ` Marco
  2012-07-19 23:20   ` Sietse Brouwer
  2 siblings, 0 replies; 11+ messages in thread
From: Marco @ 2012-07-19 15:17 UTC (permalink / raw)
  To: ntg-context

Hi Hans

sorry for the false alarm. The code works.

I had an old file ipsum.tex in my temp directory that was used
instead of the module.

I was already wondering why none of the options provided to \ipsum
had any effect.

Marco


___________________________________________________________________________________
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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-19 14:52     ` Wolfgang Schuster
@ 2012-07-19 14:59       ` luigi scarso
  0 siblings, 0 replies; 11+ messages in thread
From: luigi scarso @ 2012-07-19 14:59 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 581 bytes --]

On Thu, Jul 19, 2012 at 4:52 PM, Wolfgang Schuster <
schuster.wolfgang@gmail.com> wrote:

>
> Am 19.07.2012 um 16:42 schrieb Marco:
>
> > On 2012-07-19 Hans Hagen <pragma@wxs.nl> wrote:
> >
> >> I've added a module m-ipsum. I have no clue if it provides what one
> >> expects from such a module
> >
> >> \ipsum[alternative=lines,n=random,before=\blank,after=\blank]
> >
> > This line throws:
> >
> > ! LuaTeX error <main ctx instance>:53: bad argument #2 to 'random'
> (interval is empty)
>
> The example works on my system without any problems.
>
> it's ok also here.


-- 
luigi

[-- Attachment #1.2: Type: text/html, Size: 1082 bytes --]

[-- 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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-19 14:42   ` Marco
@ 2012-07-19 14:52     ` Wolfgang Schuster
  2012-07-19 14:59       ` luigi scarso
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Schuster @ 2012-07-19 14:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Am 19.07.2012 um 16:42 schrieb Marco:

> On 2012-07-19 Hans Hagen <pragma@wxs.nl> wrote:
> 
>> I've added a module m-ipsum. I have no clue if it provides what one 
>> expects from such a module      	
> 
>> \ipsum[alternative=lines,n=random,before=\blank,after=\blank]
> 
> This line throws:
> 
> ! LuaTeX error <main ctx instance>:53: bad argument #2 to 'random' (interval is empty)

The example works on my system without any problems.

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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-19 11:08 ` Hans Hagen
@ 2012-07-19 14:42   ` Marco
  2012-07-19 14:52     ` Wolfgang Schuster
  2012-07-19 15:17   ` Marco
  2012-07-19 23:20   ` Sietse Brouwer
  2 siblings, 1 reply; 11+ messages in thread
From: Marco @ 2012-07-19 14:42 UTC (permalink / raw)
  To: ntg-context

On 2012-07-19 Hans Hagen <pragma@wxs.nl> wrote:

> I've added a module m-ipsum. I have no clue if it provides what one 
> expects from such a module      	

> \ipsum[alternative=lines,n=random,before=\blank,after=\blank]

This line throws:

! LuaTeX error <main ctx instance>:53: bad argument #2 to 'random' (interval is empty)


Marco


___________________________________________________________________________________
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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-19  1:27 Rogers, Michael K
  2012-07-19  5:30 ` Henning Hraban Ramm
@ 2012-07-19 11:08 ` Hans Hagen
  2012-07-19 14:42   ` Marco
                     ` (2 more replies)
  1 sibling, 3 replies; 11+ messages in thread
From: Hans Hagen @ 2012-07-19 11:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 19-7-2012 03:27, Rogers, Michael K wrote:
> On 2012-07-18 Marcin Borkowski <mbork@???> wrote:
>
>> in LaTeX, there is quite a useful package called "lipsum", for
>> typesetting varioud amounts of "Lorem ipsum" stuff. Is there anything
>> like that in ConTeXt? (I know about \input knuth, \input tufte etc.,
>> but that is not exactly what I have in mind, especially when giving a
>> sample of some design to a customer;).)
>
> The LaTeX lipsum seems to have been pre-download from lipsum.com<http://lipsum.com>.  ConTeXt makes this relatively easy.  The one problem that might be solved better is that the paragraphs come in a single xml node separated by single newlines.  I defined a lines environment to make these into paragraphs, which is not as pretty as I would like.
>
> \startxmlsetups xml:Lorem:base
> \xmlsetsetup{Lorem}{*}{-}
> \xmlsetsetup{Lorem}{feed|lipsum}{xml:Lorem:*}
> \stopxmlsetups
> \xmlregisterdocumentsetup{Lorem}{xml:Lorem:base}
> \startxmlsetups xml:Lorem:feed
>    \xmlflush{#1}
> \stopxmlsetups
> \startxmlsetups xml:Lorem:lipsum
>    \xmlflush{#1}
> \stopxmlsetups
> \definelines[LoremLines]
> \def\Lorem#1{% #1 = number of paragraphs to request
>    \startLoremLines
>    \xmlprocessfile{Lorem}{http://www.lipsum.com/feed/xml?amount=#1&what=paras&start=yes}{}
>    \stopLoremLines
> }
> \starttext
> \setupindenting[yes,20pt]
> \setuplines[LoremLines][command=\blank,indenting=yes]
> \Lorem{12}
> \stoptext

I've added a module m-ipsum. I have no clue if it provides what one 
expects from such a module      	

\usemodule[ipsum]
\setupbodyfont[dejavu,11pt]

\starttext

     \ipsum[alternative=paragraph,before=\blank,after=\blank]

     \ipsum[alternative=lines,n=2,right=\par,before=\blank,after=\blank]

     \ipsum[alternative=lines,n=random,before=\blank,after=\blank]

 
\ipsum[alternative=lines,before=\startitemize,after=\stopitemize,left=\startitem,right=\stopitem]

     \ipsum[alternative=words,left=(,right=),inbetween=\space]

     \page

     \defineipsum
       [ward]
       [file=ward,
        before=\blank,
        after=\blank]

     \defineipsum
       [ward:itemize]
       [ward]
       [alternative=lines,
        before={\startitemize[packed]},
        after=\stopitemize,
        left=\startitem,
        right=\stopitem]

     \defineipsum
       [ward:title]
       [ward]
       [alternative=lines,
        n=random]

     \subject{\directipsum{ward:title}}

     \ipsum[ward]
     \ipsum[ward:itemize]

\stoptext

Rather trivial code.

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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
  2012-07-19  1:27 Rogers, Michael K
@ 2012-07-19  5:30 ` Henning Hraban Ramm
  2012-07-19 11:08 ` Hans Hagen
  1 sibling, 0 replies; 11+ messages in thread
From: Henning Hraban Ramm @ 2012-07-19  5:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2012-07-19 um 03:27 schrieb Rogers, Michael K:

> On 2012-07-18 Marcin Borkowski <mbork@???> wrote:
>
> > in LaTeX, there is quite a useful package called "lipsum", for
> > typesetting varioud amounts of "Lorem ipsum" stuff. Is there  
> anything
> > like that in ConTeXt? (I know about \input knuth, \input tufte etc.,
> > but that is not exactly what I have in mind, especially when  
> giving a
> > sample of some design to a customer;).)
>
> The LaTeX lipsum seems to have been pre-download from lipsum.com.   
> ConTeXt makes this relatively easy.  The one problem that might be  
> solved better is that the paragraphs come in a single xml node  
> separated by single newlines.  I defined a lines environment to make  
> these into paragraphs, which is not as pretty as I would like.

I also love http://www.blindtextgenerator.de/ :)

For the WebCMS of my employer I wrote a macro that produces dummy text  
of a defined length (min, max) from a selection of different texts  
(blindtextgenerator’s, that is, plus some company advertising) to fill  
new customer’s sites. To get more different texts, it starts after a  
random full stop, delivers only complete words etc. (we often need  
short dummy text for headlines).
It’s not an example of brilliant programming, but we use freemarker  
templates, and its macro language is somewhat restricted... ;-)
Maybe that gives you some ideas...

Regarding ConTeXt, its included sample text (tufte, knuth, zapf etc.)  
plus \fakewords were good enough for me.


Greetlings, Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)

___________________________________________________________________________________
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] 11+ messages in thread

* Re: A "Lorem ipsum" module?
@ 2012-07-19  1:27 Rogers, Michael K
  2012-07-19  5:30 ` Henning Hraban Ramm
  2012-07-19 11:08 ` Hans Hagen
  0 siblings, 2 replies; 11+ messages in thread
From: Rogers, Michael K @ 2012-07-19  1:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1938 bytes --]

On 2012-07-18 Marcin Borkowski <mbork@???> wrote:

> in LaTeX, there is quite a useful package called "lipsum", for
> typesetting varioud amounts of "Lorem ipsum" stuff. Is there anything
> like that in ConTeXt? (I know about \input knuth, \input tufte etc.,
> but that is not exactly what I have in mind, especially when giving a
> sample of some design to a customer;).)

The LaTeX lipsum seems to have been pre-download from lipsum.com<http://lipsum.com>.  ConTeXt makes this relatively easy.  The one problem that might be solved better is that the paragraphs come in a single xml node separated by single newlines.  I defined a lines environment to make these into paragraphs, which is not as pretty as I would like.

\startxmlsetups xml:Lorem:base
\xmlsetsetup{Lorem}{*}{-}
\xmlsetsetup{Lorem}{feed|lipsum}{xml:Lorem:*}
\stopxmlsetups
\xmlregisterdocumentsetup{Lorem}{xml:Lorem:base}
\startxmlsetups xml:Lorem:feed
  \xmlflush{#1}
\stopxmlsetups
\startxmlsetups xml:Lorem:lipsum
  \xmlflush{#1}
\stopxmlsetups
\definelines[LoremLines]
\def\Lorem#1{% #1 = number of paragraphs to request
  \startLoremLines
  \xmlprocessfile{Lorem}{http://www.lipsum.com/feed/xml?amount=#1&what=paras&start=yes}{}
  \stopLoremLines
}
\starttext
\setupindenting[yes,20pt]
\setuplines[LoremLines][command=\blank,indenting=yes]
\Lorem{12}
\stoptext


________________________________

This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).

[-- Attachment #1.2: Type: text/html, Size: 3172 bytes --]

[-- 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] 11+ messages in thread

end of thread, other threads:[~2012-07-19 23:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-18  9:42 A "Lorem ipsum" module? Marcin Borkowski
2012-07-18 10:18 ` Marco
2012-07-18 11:33 ` Philipp Gesang
2012-07-19  1:27 Rogers, Michael K
2012-07-19  5:30 ` Henning Hraban Ramm
2012-07-19 11:08 ` Hans Hagen
2012-07-19 14:42   ` Marco
2012-07-19 14:52     ` Wolfgang Schuster
2012-07-19 14:59       ` luigi scarso
2012-07-19 15:17   ` Marco
2012-07-19 23:20   ` Sietse Brouwer

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).