Embedding html/ java snippets in asciidoctor

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

Embedding html/ java snippets in asciidoctor

kezepema
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"
and
"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"
href="//app-eu.readspeaker.com/cgi-bin/rsent?customerid=5&lang=nl_nl&amp;voice=Ilse&re$
        <span class="rsbtn_left rsimg rspart">Lees voor
       
   
</div>

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

Reply | Threaded
Open this post in threaded view
|

Re: Embedding html/ java snippets in asciidoctor

wolandscat
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.