[NTG-context] ConTeXt features in pandoc 3

2023-01-20 Thread Albert Krewinkel via ntg-context
Hello,

a new version of pandoc, the universal document converter, was
released two days ago; pandoc 3 comes with new ConTeXt-related
features on which we've spend a good bit of time:

- *Syntax highlighting*: Pandoc makes use of the syntax
  definitions and styles created by the KDE project to highlight
  source code. This already worked with HTML, LaTeX, and formats
  like docx, and is now also supported for ConTeXt.

- *Inline code*: older versions of pandoc had some weird behavior
  wrt inline code in ConTeXt, switching between `\type` and
  `\mono`, which made it difficult to customize the output. This
  has been fixed.

- *Tagging-focused output*: Calling pandoc with
  `--to=context+tagging` creates markup that is geared towards the
  creation of tagged PDFs. This can be combined with `-V pdfa=3a`
  to produce accessible PDFs from various input sources.

- *Unlisted/unnumbered headings*: Headings with class "unnumbered"
  are not numbered; those with class "unlisted" get omitted from
  the ToC.

- *Figures*: We have improved support for figures considerably,
  and now also support subfigures. This is currently most
  noticeable when converting from HTML to ConTeXt.

Downloads and full changelog:
https://github.com/jgm/pandoc/releases/tag/3.0

I'm grateful for any and all feedback, including tips on how to
improve pandoc further.

Cheers,
Albert

-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Set up external figure for particular image type

2022-07-12 Thread Albert Krewinkel via ntg-context

Thangalin via ntg-context  writes:

> The source comes from Markdown, which is converted to XML, then typeset
> using ConTeXt. There's no Markdown-specific mechanism to relate images
> to a particular external figure definition, unfortunately. All images
> use the same syntax and are treated the same way. The only part that
> differs is the file name extension (and header within the file).

The below is likely overkill and a good bit of work to setup, but it is
also very flexible. Maybe it suits your needs.

The Markdown-to-XML conversion can be tuned to include all the relevant
information. E.g., you could use pandoc with a custom writer to produce
the XML format of your choice. The link below is an example XML writer
that can be tuned as needed.


With that setup, one can modify the `Image` function to produce the
output you need. E.g., match on the file name extension use the library
function `pandoc.path.split_extension` and then change the element type
depending on the extension.

This way you'd have all the important information in your XML.
More info:  and
.

Of course, you could also use pandoc to go directly to ConTeXt; that is
currently my preferred way of producing PDF from Markdown.

Cheers,
Albert

-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___


Re: [NTG-context] Improving pandoc's ConTeXt output

2022-06-08 Thread Albert Krewinkel via ntg-context

Albert Krewinkel via ntg-context  writes:

> I'm currently trying to improve the ConTeXt output generated by pandoc,
> the document convert. There are two questions that we haven't decided
> on, and I'd be grateful to receive some feedback from ConTeXt experts on
> these issues:
>
> 1. As far as I understand, the `\section` syntax currently produced by
>pandoc should be considered mkii legacy syntax. We're likely going to
>switch to the modern `\startsection`/`\stopsection` syntax instead.
>Are there any concerns about retiring the old syntax?
>(Side note: pandoc already produces the new syntax, but only when
>called with `--section-divs`.)
>
> 2. Similarly, I'd like to start wrapping paragraphs with
>`\startparagraph`/`\stopparagraph`. It is important for me to get
>properly tagged PDF, but this would also make the output more
>verbose. Is that something that you would find bothering, or do you
>see adding the extra environment by default as an acceptable
>practice?
>
> Of course, I'd also be happy to get other suggestions on how to improve
> pandoc's ConTeXt support.

A big "thank you" for everyone's feedback! We've implemented the first
point as suggested, with the second still in discussion. The next pandoc
version will also feature better table support for ConTeXt.

Thanks again, ConTeXt is a wonderful tool!

Best,
Albert



PS: For completeness, this is the pull requests for better table
support: https://github.com/jgm/pandoc/pull/8116

-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
___
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
___


Re: [NTG-context] Improving pandoc's ConTeXt output

2022-06-05 Thread Albert Krewinkel via ntg-context

Wolfgang Schuster via ntg-context  writes:

> Hans Hagen via ntg-context schrieb am 05.06.2022 um 12:01:
>> On 6/5/2022 9:07 AM, Albert Krewinkel via ntg-context wrote:
>>> Hi all,
>>>
>>> I'm currently trying to improve the ConTeXt output generated by pandoc,
>>> the document convert. There are two questions that we haven't decided
>>> on, and I'd be grateful to receive some feedback from ConTeXt experts on
>>> these issues:
>>>
>>> 2. Similarly, I'd like to start wrapping paragraphs with
>>>     `\startparagraph`/`\stopparagraph`. It is important for me to get
>>>     properly tagged PDF, but this would also make the output more
>>>     verbose. Is that something that you would find bothering, or do you
>>>     see adding the extra environment by default as an acceptable
>>>     practice?
>>
>> I assume not that many users see (or manipulate) the output so it is 
>> harmless.
>
> \startparagraph can lead to unwanted side effects (I can't remember the 
> details)
> and \bpar ... \epar is the safer alternative to add tags.

Thank you Wolfgang, I wasn't aware! Searching the wiki brought me to
<https://wiki.contextgarden.net/Epub_Sample>. It states:

> In places where \startparagraph does not work, such as itemizations,
> where it causes a blank line after the bullet and before the item
> text, use \bpar (and closing \epar) to tag paragraphs.

It's probably more consistent then to use \bpar ... \epar everywhere.


-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
___
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
___


Re: [NTG-context] Improving pandoc's ConTeXt output

2022-06-05 Thread Albert Krewinkel via ntg-context
Dear juh,

juh via ntg-context  writes:

> great to hear that, as my cooperative uses pandoc to produce print stuff
> with ConTeXt, we are always happy, when there are improvements.

I'd love to learn more about your workflow, if you have time to share at
some point!

We chose ConTeXt as the intermediate format for the next iteration of
the JOSS pipeline (the current pipeline is described here:
https://www.ncbi.nlm.nih.gov/books/NBK579698/)

Big thanks to Denis Maier for convincing me to try and go that route :)

> Am Sun, Jun 05, 2022 at 09:07:37AM +0200 schrieb Albert Krewinkel via 
> ntg-context:
>> 2. Similarly, I'd like to start wrapping paragraphs with
>>`\startparagraph`/`\stopparagraph`. It is important for me to get
>>properly tagged PDF, but this would also make the output more
>>verbose. Is that something that you would find bothering, or do you
>>see adding the extra environment by default as an acceptable
>>practice?
>
> A similiary question came up in the org-mode mailinglist some weeks ago.
>
> (Background: Org-mode is a markup used with Emacs to make single source
> publishing possible)
>
> Someone who maintains an export programme for ConTeXt uses 
> sectionlevels.
>
> You get the incremental subsections and subsubsection like this.
>
> \startsectionlevel
>   \startsectionlevel
> \startsectionlevel
> \stopsectionlevel
>   \stopsectionlevel
> \stopsectionlevel
>
> This makes it possible to ignore the part-chapter-section naming
> convention and be more flexible. You can leave it to the style files to
> decide which level is a part, chapter, section etc...
>
> As I do not use this in production – only playing around with emacs and
> org-mode – I cannot say if this is a good way.
>
> Have you considered sectionlevel?
> What is your opinion?

I absolutely see the appeal of that method, and I'd like for pandoc to
support it. The main question is probably whether the default should be
`\startsection` or `\startsectionlevel`. I lean towards making
`\startsectionlevel` the new default, but that might need some more
discussing. I think Denis linked to the respective GitHub issue in his
mail, more comments and opinions are definitely welcome.

-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
___
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
___


[NTG-context] Improving pandoc's ConTeXt output

2022-06-05 Thread Albert Krewinkel via ntg-context
Hi all,

I'm currently trying to improve the ConTeXt output generated by pandoc,
the document convert. There are two questions that we haven't decided
on, and I'd be grateful to receive some feedback from ConTeXt experts on
these issues:

1. As far as I understand, the `\section` syntax currently produced by
   pandoc should be considered mkii legacy syntax. We're likely going to
   switch to the modern `\startsection`/`\stopsection` syntax instead.
   Are there any concerns about retiring the old syntax?
   (Side note: pandoc already produces the new syntax, but only when
   called with `--section-divs`.)

2. Similarly, I'd like to start wrapping paragraphs with
   `\startparagraph`/`\stopparagraph`. It is important for me to get
   properly tagged PDF, but this would also make the output more
   verbose. Is that something that you would find bothering, or do you
   see adding the extra environment by default as an acceptable
   practice?

Of course, I'd also be happy to get other suggestions on how to improve
pandoc's ConTeXt support.

Thanks in advance,

Albert


-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
___
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
___