ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* packed lists in XML
@ 2015-03-22 12:39 Pablo Rodriguez
  2015-03-23 12:01 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo Rodriguez @ 2015-03-22 12:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear list,

I have the following sample:

    \startbuffer[demo]
    <doc>
        <p>standard list:</p>
        <ul>
            <li>
                <p>item from loose list</p>
            </li>
            <li>
                <p>item from loose list</p>
            </li>
        </ul>
        <p>packed list:</p>
        <ul>
            <li>item from tight list</li>
            <li>item from tight list</li>
        </ul>
    </doc>
    \stopbuffer

    \startxmlsetups xml:initialize
        \xmlsetsetup{#1}{ul|li|p}{xml:*}
    \stopxmlsetups

    \xmlregistersetup{xml:initialize}

    \startxmlsetups xml:ul
        \startitemize
            \xmlflush{#1}
        \stopitemize
    \stopxmlsetups

    \startxmlsetups xml:ul:packed
        \startitemize[packed]
            \xmlflush{#1}
        \stopitemize
    \stopxmlsetups

    \startxmlsetups xml:li
        \startitem
            \xmlflush{#1}
        \stopitem
    \stopxmlsetups

    \startxmlsetups xml:p
        \xmldoifnotselfempty {#1} {
            \dontleavehmode
            \ignorespaces
            \xmlflush{#1}
            \removeunwantedspaces
        }
        \par
    \stopxmlsetups

    \starttext
         \xmlprocessbuffer{main}{demo}{}
    \stoptext

Standard lists are defined in XML code with ul/li/p and packed lists
remove the final /p from the path.

How can I associate the each XML list to its right ConTeXt code?

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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] 3+ messages in thread

* Re: packed lists in XML
  2015-03-22 12:39 packed lists in XML Pablo Rodriguez
@ 2015-03-23 12:01 ` Hans Hagen
  2015-03-23 16:54   ` Pablo Rodriguez
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2015-03-23 12:01 UTC (permalink / raw)
  To: ntg-context

On 3/22/2015 1:39 PM, Pablo Rodriguez wrote:
> Dear list,
>
> I have the following sample:
>
>      \startbuffer[demo]
>      <doc>
>          <p>standard list:</p>
>          <ul>
>              <li>
>                  <p>item from loose list</p>
>              </li>
>              <li>
>                  <p>item from loose list</p>
>              </li>
>          </ul>
>          <p>packed list:</p>
>          <ul>
>              <li>item from tight list</li>
>              <li>item from tight list</li>
>          </ul>
>      </doc>
>      \stopbuffer
>
>      \startxmlsetups xml:initialize
>          \xmlsetsetup{#1}{ul|li|p}{xml:*}
>      \stopxmlsetups
>
>      \xmlregistersetup{xml:initialize}
>
>      \startxmlsetups xml:ul
>          \startitemize
>              \xmlflush{#1}
>          \stopitemize
>      \stopxmlsetups
>
>      \startxmlsetups xml:ul:packed
>          \startitemize[packed]
>              \xmlflush{#1}
>          \stopitemize
>      \stopxmlsetups
>
>      \startxmlsetups xml:li
>          \startitem
>              \xmlflush{#1}
>          \stopitem
>      \stopxmlsetups
>
>      \startxmlsetups xml:p
>          \xmldoifnotselfempty {#1} {
>              \dontleavehmode
>              \ignorespaces
>              \xmlflush{#1}
>              \removeunwantedspaces
>          }
>          \par
>      \stopxmlsetups
>
>      \starttext
>           \xmlprocessbuffer{main}{demo}{}
>      \stoptext
>
> Standard lists are defined in XML code with ul/li/p and packed lists
> remove the final /p from the path.
>
> How can I associate the each XML list to its right ConTeXt code?

\startxmlsetups xml:ul
     \xmldoifelse{#1}{/li/p}{
         \startitemize
             \xmlflush{#1}
         \stopitemize
     } {
         \startitemize[packed]
             \xmlflush{#1}
         \stopitemize
     }
\stopxmlsetups



-- 

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

* Re: packed lists in XML
  2015-03-23 12:01 ` Hans Hagen
@ 2015-03-23 16:54   ` Pablo Rodriguez
  0 siblings, 0 replies; 3+ messages in thread
From: Pablo Rodriguez @ 2015-03-23 16:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 03/23/2015 01:01 PM, Hans Hagen wrote:
> On 3/22/2015 1:39 PM, Pablo Rodriguez wrote:
>> [...]
>> Standard lists are defined in XML code with ul/li/p and packed lists
>> remove the final /p from the path.
>>
>> How can I associate the each XML list to its right ConTeXt code?
> 
> \startxmlsetups xml:ul
>      \xmldoifelse{#1}{/li/p}{
>          \startitemize
>              \xmlflush{#1}
>          \stopitemize
>      } {
>          \startitemize[packed]
>              \xmlflush{#1}
>          \stopitemize
>      }
> \stopxmlsetups

Many thanks for your reply, Hans.

This code will help me to fix ordered lists too.

Many thanks for your help,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2015-03-23 16:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-22 12:39 packed lists in XML Pablo Rodriguez
2015-03-23 12:01 ` Hans Hagen
2015-03-23 16:54   ` Pablo Rodriguez

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