ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* problems with XML export
@ 2017-11-11 17:30 Henning Hraban Ramm
  2017-11-11 18:46 ` Pablo Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Henning Hraban Ramm @ 2017-11-11 17:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Here are a few problems that I encountered in my current ePub projects:

* \color[]{} leaves no trace in export.

* As soon as I activate export, my PDFs get two pages more, i.e. page breaking changes somehow, I didn’t yet track how.

* For quotability, I’d like to set markers in my HTML, where the print version has page breaks. But the exported XML doesn’t contain anything like that. Is it possible to add?

* Some spacing like \, gets lost. I’m sure there’s an appropriate Unicode glyph. Would it be possible to add that?

* Errors in exported XML:

(1)
<registerentry>
        <registercontent>Brecht, Bertolt</registercontent>
        <registerpages><registerpage><link destination="internal(358)" location="358" prefix="c_anhang">53</link></registerpage><registerseparator>,</registerseparator><registerpagerange>–</registerpagerange><registerseparator>,</registerseparator><registerpage><link destination="internal(635)" location="635" prefix="c_anhang">88</link></registerpage></registerpages>
       </registerentry>

Here we have a register entry with (only) a page range. There should be no <registerseparator> (it’s unneccessarily complicated to filter that out if there’s also a <registerpagerange>).
I.e. text content has ",–," instead of just "–".

(2)
\def\SC#1{\dostarttagged{highlight}{scaps}{\sc\lowercase{#1}}\dostoptagged}

\starttabulate[|lw(1cm)|p|]
\NC AFG\NC \SC{SED}, Akademie für Gesellschaftswissenschaften, Schriftenverzeichnis\NC\NR
\NC BER\crlf\color[white]{dummy}\NC Hochschule der Deutschen Gewerkschaften \quotation{Fritz Heckert} in Bernau, Schriftenverzeichnis\NC\NR
\stoptabulate

leads to

        <tabulate>
         <tabulaterow>
          <tabulatecell align="flushleft">AFG</tabulatecell>
          <break/>
<highlight detail="scaps"><tabulatecell>sed</tabulatecell>, Akademie für Gesellschaftswissenschaften, Schriftenverzeichnis</highlight>         </tabulaterow>
         <tabulaterow>
          <tabulatecell align="flushleft">BERdummy</tabulatecell>
           <tabulatecell>Hochschule der Deutschen Gewerkschaften <delimited detail="quotation-1"><delimitedsymbol symbol="left">»</delimitedsymbol><delimitedcontent>Fritz Heckert</delimitedcontent><delimitedsymbol symbol="right">«</delimitedsymbol></delimited> in Bernau, Schriftenverzeichnis</tabulatecell>
         </tabulaterow>
        </tabulate>

- <break /> is nonsense
- <highlight> breaks <tabulatecell> (maybe my \SC definition is bad, but nobody answered to my according question)


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: problems with XML export
  2017-11-11 17:30 problems with XML export Henning Hraban Ramm
@ 2017-11-11 18:46 ` Pablo Rodriguez
  2017-11-12  8:33   ` Henning Hraban Ramm
  2017-11-12 16:06   ` Alan Braslau
  0 siblings, 2 replies; 6+ messages in thread
From: Pablo Rodriguez @ 2017-11-11 18:46 UTC (permalink / raw)
  To: ntg-context

On 11/11/2017 06:30 PM, Henning Hraban Ramm wrote:
> Here are a few problems that I encountered in my current ePub projects:
> 
> * \color[]{} leaves no trace in export.

Hi Hraban,

this works with PDF, it should work with ePub:

  \definehighlight[read][color=red, style=\sc]
  \starttext
  \starthighlight[read] rot\stophighlight
  \stoptext

I guess you have to use this instead of \color[]{}.

> * As soon as I activate export, my PDFs get two pages more, i.e.
> page breaking changes somehow, I didn’t yet track how.

Without minimal sample and invocation command, it is rather hard to
reproduce the issue.

> * For quotability, I’d like to set markers in my HTML, where the print
> version has page breaks. But the exported XML doesn’t contain anything
> like that. Is it possible to add?

Just out of curiosity, I wonder how this could be achieved.

Do you have other approach than the following?

1. Complete PDF compilation with saving of page breaks.

2. Add the markers in XML code generation.

> * Errors in exported XML:
> [...]
> (2)
> \def\SC#1{\dostarttagged{highlight}{scaps}{\sc\lowercase{#1}}\dostoptagged}
> [...]
> - <highlight> breaks <tabulatecell> (maybe my \SC definition is bad,
> but nobody answered to my according question)

Try the approach proposed above. I think it should work.

I hope it helps,

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: problems with XML export
  2017-11-11 18:46 ` Pablo Rodriguez
@ 2017-11-12  8:33   ` Henning Hraban Ramm
  2017-11-12 10:29     ` Pablo Rodriguez
  2017-11-12 16:06   ` Alan Braslau
  1 sibling, 1 reply; 6+ messages in thread
From: Henning Hraban Ramm @ 2017-11-12  8:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 2017-11-11 um 19:46 schrieb Pablo Rodriguez <oinos@gmx.es>:

> On 11/11/2017 06:30 PM, Henning Hraban Ramm wrote:
>> Here are a few problems that I encountered in my current ePub projects:
>> 
>> * \color[]{} leaves no trace in export.
> 
> Hi Hraban,
> 
> this works with PDF, it should work with ePub:
> 
>  \definehighlight[read][color=red, style=\sc]
>  \starttext
>  \starthighlight[read] rot\stophighlight
>  \stoptext
> 
> I guess you have to use this instead of \color[]{}.

Yes, I guess too. I remembered highlight suits color after sending, but that means I need to define a new highlight for every color - as semantic as that may be, it’s a PITA.

>> * As soon as I activate export, my PDFs get two pages more, i.e.
>> page breaking changes somehow, I didn’t yet track how.
> 
> Without minimal sample and invocation command, it is rather hard to
> reproduce the issue.

Of course. I still didn’t check what changes at all.

>> * For quotability, I’d like to set markers in my HTML, where the print
>> version has page breaks. But the exported XML doesn’t contain anything
>> like that. Is it possible to add?
> 
> Just out of curiosity, I wonder how this could be achieved.
> 
> Do you have other approach than the following?
> 
> 1. Complete PDF compilation with saving of page breaks.
> 
> 2. Add the markers in XML code generation.

At the state where it exports XML, ConTeXt already knows about page breaks, doesn’t it?

>> * Errors in exported XML:
>> [...]
>> (2)
>> \def\SC#1{\dostarttagged{highlight}{scaps}{\sc\lowercase{#1}}\dostoptagged}
>> [...]
>> - <highlight> breaks <tabulatecell> (maybe my \SC definition is bad,
>> but nobody answered to my according question)
> 
> Try the approach proposed above. I think it should work.

No, that was my question in the thread "insert tags in export xml".
\definehighlight only supports style and color, but not command.
I tried to understand its definition and found \dostarttagged, but I guess I used it the wrong way, since it breaks the tabulation.


Greetlings, Hraban
---
http://www.fiee.net
http://wiki.contextgarden.net
GPG Key ID 1C9B22FD

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: problems with XML export
  2017-11-12  8:33   ` Henning Hraban Ramm
@ 2017-11-12 10:29     ` Pablo Rodriguez
  0 siblings, 0 replies; 6+ messages in thread
From: Pablo Rodriguez @ 2017-11-12 10:29 UTC (permalink / raw)
  To: ntg-context

On 11/12/2017 09:33 AM, Henning Hraban Ramm wrote:
> Am 2017-11-11 um 19:46 schrieb Pablo Rodriguez:
>> \definehighlight[read][color=red, style=\sc]
>> [...]
>> I guess you have to use this instead of \color[]{}.
> 
> Yes, I guess too. I remembered highlight suits color after sending,
> but that means I need to define a new highlight for every color - as
> semantic as that may be, it’s a PITA.

I wonder whether Hans would accept a patch with these definitions to be
applied in the ConTeXt source.

> [...]
> At the state where it exports XML, ConTeXt already knows about page
> breaks, doesn’t it?

You are right. I have almost no experience generating ePubs with ConTeXt
(trying your sample was one of my first attempts to generate an ePub
document with ConTeXt [I use pandoc for that]).

>> [...]
>> Try the approach proposed above. I think it should work.
> 
> No, that was my question in the thread "insert tags in export xml".

Sorry, I overlooked that message.

> \definehighlight only supports style and color, but not command.

I wonder whether this is the right approach.

I mean, you could only (ab)use the style option:

  \setupbackend[export=yes]

  \definehighlight[read][style=\word\sc]
  \starttext
  \starthighlight[read] ROT ROT ROT\stophighlight
  \stoptext

Other approach would be to use your own CSS file:

  .read { text-transform: lowercase; font-variant: small-caps; }

In any case, you need to add the small caps to the class definition in
the CSS file. ConTeXt doesn’t seem to export \sc to anything in the CSS
file.

> I tried to understand its definition and found \dostarttagged, but I
> guess I used it the wrong way, since it breaks the tabulation.

I guess custom CSS is an easier approach.

Just in case it helps,

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: problems with XML export
  2017-11-11 18:46 ` Pablo Rodriguez
  2017-11-12  8:33   ` Henning Hraban Ramm
@ 2017-11-12 16:06   ` Alan Braslau
  2017-11-12 16:49     ` Pablo Rodriguez
  1 sibling, 1 reply; 6+ messages in thread
From: Alan Braslau @ 2017-11-12 16:06 UTC (permalink / raw)
  To: Pablo Rodriguez, Henning Hraban Ramm; +Cc: mailing list for ConTeXt users

Hans made some changes a while ago.

Enabling export, floats are handled differently, notably side floats
become location=here. Hans tells me that this derives from how the xml
export is constructed, and this makes handling certain bugs with the
export possible.

I have urged Hans to consider, if this need be so, that the PDF file
produced when export is enabled NOT overwrite a PDF that might have
been produced in a run where export was not enabled. The easiest in my
opinion would be for this PDF to be placed in the filename-export/
sub-directory, leaving filename.pdf (if exists) untouched. Hans
answered that he would have to think about this as it would break his
present workflow where he runs context from his (Scite) editor and
relies looking at the PDF to see certain results.

Whereas I might want to export systematically, Hans suggests that one
should export in a separate run using modes for example. This is not a
bad idea, but I would NOT want to have to then make a third run to fix
the "broken" PDF. This would be a nightmare in bookkeeping and prone to
errors.

Alan



On Sat, 11 Nov 2017 19:46:21 +0100
Pablo Rodriguez <oinos@gmx.es> wrote:

> On 11/11/2017 06:30 PM, Henning Hraban Ramm wrote:
> > Here are a few problems that I encountered in my current ePub
> > projects:
> > 
> > * \color[]{} leaves no trace in export.
> 
> Hi Hraban,
> 
> this works with PDF, it should work with ePub:
> 
>   \definehighlight[read][color=red, style=\sc]
>   \starttext
>   \starthighlight[read] rot\stophighlight
>   \stoptext
> 
> I guess you have to use this instead of \color[]{}.
> 
> > * As soon as I activate export, my PDFs get two pages more, i.e.
> > page breaking changes somehow, I didn’t yet track how.
> 
> Without minimal sample and invocation command, it is rather hard to
> reproduce the issue.
> 
> > * For quotability, I’d like to set markers in my HTML, where the
> > print version has page breaks. But the exported XML doesn’t contain
> > anything like that. Is it possible to add?
> 
> Just out of curiosity, I wonder how this could be achieved.
> 
> Do you have other approach than the following?
> 
> 1. Complete PDF compilation with saving of page breaks.
> 
> 2. Add the markers in XML code generation.
> 
> > * Errors in exported XML:
> > [...]
> > (2)
> > \def\SC#1{\dostarttagged{highlight}{scaps}{\sc\lowercase{#1}}\dostoptagged}
> > [...]
> > - <highlight> breaks <tabulatecell> (maybe my \SC definition is bad,
> > but nobody answered to my according question)
> 
> Try the approach proposed above. I think it should work.
> 
> I hope it helps,
> 
> Pablo

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: problems with XML export
  2017-11-12 16:06   ` Alan Braslau
@ 2017-11-12 16:49     ` Pablo Rodriguez
  0 siblings, 0 replies; 6+ messages in thread
From: Pablo Rodriguez @ 2017-11-12 16:49 UTC (permalink / raw)
  To: ntg-context

On 11/12/2017 05:06 PM, Alan Braslau wrote:
> [...]> Whereas I might want to export systematically, Hans suggests that one
> should export in a separate run using modes for example. This is not a
> bad idea, but I would NOT want to have to then make a third run to fix
> the "broken" PDF. This would be a nightmare in bookkeeping and prone to
> errors.

Hi Alan,

another approach would be to enable a --purgeall option (in mxtrun
--script epub) that also removes both the PDF document and the *-epub
and *-export subdirectories.

Just in case it helps,

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2017-11-12 16:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-11 17:30 problems with XML export Henning Hraban Ramm
2017-11-11 18:46 ` Pablo Rodriguez
2017-11-12  8:33   ` Henning Hraban Ramm
2017-11-12 10:29     ` Pablo Rodriguez
2017-11-12 16:06   ` Alan Braslau
2017-11-12 16:49     ` 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).