Embedding html/ java snippets in asciidoctor

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Embedding html/ java snippets in asciidoctor

I almost finished a project that is aimed on learning IT skills to children in Dutch primary schools.

I want to enable speech-support with a project called Readspeaker.

To enable speech-support I have to embed html and java code in html.

I use asciidoctor to generate the learning modules.

Best way for me to embed Readspeker code is to include it in the source. The reason for me to include the snippets in in the source is to avoid copying and pasting the snippet after a change in the source document.

I followed asciidoctor documentation and information about embedding plain html and java:

This is what I found (in my own words):

"Use ---- to skip parsing code blocks that should be transfered directly to the production doocument"
"Use :docinfo: tags to include external defined source blocks"

Both methods does not seem to work for me.

The code snippet for the <head> section is:

<script src="//f1-eu.readspeaker.com/script/5/ReadSpeaker.js?pids=embhl" type="text/javascript"></script>
The code snippet that has to be included in the body part of the production environment is:

<div id="readspeaker-button1" class="rs_skip rsbtn rs_preserve">
    <a rel="nofollow" class="rsbtn_play" accesskey="L" title="Laat de tekst voorlezen met ReadSpeaker"
        <span class="rsbtn_left rsimg rspart">Lees voor

So my question is:
How to include these snippets in my asciidoctor source document?

Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Re: Embedding html/ java snippets in asciidoctor

The obvious solution for inline literal inclusion is:

[source, html]
<div> xxxx </div>

(or instead of 'html' you might want 'php', or just use nothing if you don't have a syntax colouriser enabled).

To include from another file, you can do as in this file (look for the 'source' blocks).

You can do inclusion of parts of files as well, see the manual.

Hope this helps.