ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Max Chernoff via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Max Chernoff <mseven@telus.net>, mojca.miklavec.lists@gmail.com
Subject: Re: How to do code listings & sections from XML (AsciiDoc)
Date: Fri, 12 Aug 2022 16:30:29 -0600	[thread overview]
Message-ID: <a6a30de51fafe73e89cc2c7b56f75ab16a89181d.camel@telus.net> (raw)
In-Reply-To: <CALBOmsYOovebuf=ptKg9i0OBfp2XyOOFX_JstWDRaDxf1Fo7BQ@mail.gmail.com>

> Hi,
> 
> Hans helped me out with some asciidoc processing a while ago.
> 
> I played a bit further, but I'm currently facing two minor issues:
> 
> (a) I don't know how to turn program listing (verbatim code) from xml
> to (perhaps, vim-based) syntax highlighting (but most importantly, to
> make sure that line breaks work properly)


> Ad (a). The source that looks similar to this:
> 
> <programlisting language="cpp" linenumbering="unnumbered">
> int main()
> {
>     return 0;
> }
> </programlisting>
> 
> should be converted into some kind of equivalent of
> 
> % on top
> \usemodule[vim]
> \definevimtyping [CPP] [syntax=cpp]
> 
> \startCPP
> int main()
> {
>     return 0;
> }
> \stopCPP

> Any hints would be greatly appreciated.

This should get you pretty close:

   https://tex.stackexchange.com/a/652116/
   
You can look through the revision history for a few different versions if
the newest one doesn't quite work.
   
-- Max
___________________________________________________________________________________
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
___________________________________________________________________________________

      parent reply	other threads:[~2022-08-12 22:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 15:37 Mojca Miklavec via ntg-context
2022-08-12 21:20 ` Aditya Mahajan via ntg-context
2022-08-13  6:13   ` Mojca Miklavec via ntg-context
2022-08-13  6:15   ` Mojca Miklavec via ntg-context
2022-08-12 22:30 ` Max Chernoff via ntg-context [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a6a30de51fafe73e89cc2c7b56f75ab16a89181d.camel@telus.net \
    --to=ntg-context@ntg.nl \
    --cc=mojca.miklavec.lists@gmail.com \
    --cc=mseven@telus.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).