Implementing the equivalent of LaTeX \lstinline

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Implementing the equivalent of LaTeX \lstinline

rkeryell
Hello!
We are working on translating a big LateX specification https://www.khronos.org/registry/SYCL/specs/sycl-2020-provisional.pdf to AsciiDoctor and the results is now quite good in HTML and PDF except for a missing feature we use a lot: \lstinline to insert source code with highlighting.

\lstinline (described on page 4 of http://mirrors.ctan.org/macros/latex/contrib/listings/listings.pdf) provides 2 different syntax:
- \lstinline{some code}
- and when the code has some {} in it: \lstinline|some code|, where "|" is actually any character not appearing in "some code".

What is the simplest way to have this feature?

Generalizing [source] to allow a non-block interface, such as:
  some text [source]{some code} and [source]|some code| some text
?
Not clear to me how to do this by looking at asciidoctor/lib/asciidoctor/parser.rb where the parser assume this is in a block...

This problem has been already mentioned in https://discuss.asciidoctor.org/Passing-options-to-configuring-source-highlighters-tp8047.html

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Implementing the equivalent of LaTeX \lstinline

mojavelinux
Administrator
The issue you are looking for is this one:


It discusses the current state of the requirements and design and offers proposals for how to implement it in the meantime.

Best Regards,

-Dan

On Wed, Jan 13, 2021 at 7:35 AM rkeryell [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello!
We are working on translating a big LateX specification https://www.khronos.org/registry/SYCL/specs/sycl-2020-provisional.pdf to AsciiDoctor and the results is now quite good in HTML and PDF except for a missing feature we use a lot: \lstinline to insert source code with highlighting.

\lstinline (described on page 4 of http://mirrors.ctan.org/macros/latex/contrib/listings/listings.pdf) provides 2 different syntax:
- \lstinline{some code}
- and when the code has some {} in it: \lstinline|some code|, where "|" is actually any character not appearing in "some code".

What is the simplest way to have this feature?

Generalizing [source] to allow a non-block interface, such as:
  some text [source]{some code} and [source]|some code| some text
?
Not clear to me how to do this by looking at asciidoctor/lib/asciidoctor/parser.rb where the parser assume this is in a block...

This problem has been already mentioned in https://discuss.asciidoctor.org/Passing-options-to-configuring-source-highlighters-tp8047.html

Thank you.


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Implementing-the-equivalent-of-LaTeX-lstinline-tp8444.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Implementing the equivalent of LaTeX \lstinline

rkeryell
mojavelinux wrote
The issue you are looking for is this one:

https://github.com/asciidoctor/asciidoctor/issues/1043

It discusses the current state of the requirements and design and offers
proposals for how to implement it in the meantime.
Ah yes, this is exactly what I am looking for!
The problem is how to make progress on it as it looks stuck for 3+ years now...
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Implementing the equivalent of LaTeX \lstinline

mojavelinux
Administrator
My suggestion is to use the extension that @danyill shared (or port it to Ruby if necessary). This is not a good time to be making changes to the language as we are in the process of getting the AsciiDoc Language project going. But you don't need it to be added to core to make use of it. The Asciidoctor extension facility gives you (most) everything you need to implement it as a custom macro. (The caveats to watch out for are cited in the issue).

Best Regards,

-Dan

On Thu, Jan 14, 2021 at 4:10 AM rkeryell [via Asciidoctor :: Discussion] <[hidden email]> wrote:
mojavelinux wrote
The issue you are looking for is this one:

https://github.com/asciidoctor/asciidoctor/issues/1043

It discusses the current state of the requirements and design and offers
proposals for how to implement it in the meantime.
Ah yes, this is exactly what I am looking for!
The problem is how to make progress on it as it looks stuck for 3+ years now...
Thanks.



If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Implementing-the-equivalent-of-LaTeX-lstinline-tp8444p8446.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen (he, him, his) | @mojavelinux | https://twitter.com/mojavelinux