Gabe,

A possible solution here is to create an attribute to represent a dollar
that has a value that's dependent on the backend.

ifdef::basebackend-html[:d: \$]
ifdef::basebackend-docbook[:d: $]

[subs="attributes,specialcharacters"]
[source,perl]
----
{d}foo = "bar";
----

You can avoid the explicit subs on every source block by overriding the
default subs for a source block in asciidoc.conf.

If another solution comes to mind, I'll be sure to mention it.

-Dan
On Oct 18, 2013 9:19 AM, <[email protected]> wrote:

> Hi Dan,
>
> Thanks for the response. I tried Pygments and it works with the html5 if I
> use "\$", but this breaks the pdf - now that shows the literal "\$" and
> doesn't treat the "\" as an escape character.
>
> Is there a way to get a consistent behavior for the same document in both
> pdf and html5? I'm hesitant to fiddle with the generated JavaScript (I
> don't want to redo it by hand and I'm hesitant to go digging for whatever
> auto-generates the code).
>
> Thanks!
>
> pax
> Gabe
>
>
>
> On Thursday, October 17, 2013 2:16:44 PM UTC-5, Dan Allen wrote:
>>
>> The problem you are encountering is that the latexmath JavaScript is
>> interpreting those dollar signs as the start of a math expression. That
>> also explains why it only happens in the html5 output (all the rest of the
>> backends go through the DocBook toolchain and don't use the latexmath
>> JavaScript).
>>
>> The proper way to insert a dollar sign is to use \$. However, if you make
>> that change in your example, the dollar still isn't rendered. That's
>> because the syntax highlighter is separating the backslash and the dollar,
>> so latexmath still sees the dollar sign.
>>
>> One option is to switch the source highlighter to pygments, which seems
>> to leave the \$ alone.
>>
>> A better option may be to hack up the latexmath script to leave listing
>> blocks alone. You need to look at the JavaScript function AMprocessNodeR.
>>
>> -Dan
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "asciidoc" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/asciidoc.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/asciidoc.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to