On 07/11/13 00:24, Dan Allen wrote:
> Hey Axel & Stuart,
> 
> Another way is to enable the attributes subs on the listing block.
> 
> By default, a listing block has the subs specialcharacters and callouts.
> You can modify this set as follows:
> 
> [source,javascript]
> [subs="specialcharacters,attributes,callouts"]
> ----
> ... = '{cow}';
> ----
> 
> Another option is to enable macros and use a pass:[] macro to allow the
> char reference to go through untouched. However, I've observed conflicts
> between escaped placeholders and syntax highlighting.

You need to use postsubs instead of subs to ensure it's done after the
highlighter has executed (subs is an alias for presubs), but that still
won't fix it because Attribute Entry values are substituted for special
characters (see 'Attribute Entries'
(http://asciidoc.org/userguide.html#X18)).

Neither will putting pass:[🐄] in the listing because, again, the
highlighter will escape the ampersand.

The only way I can think of to ensure the ampersand is not escaped is to
use a replacement e.g.

:replacements.COW: 🐄

[source,javascript]
[presubs="none"]
[postsubs="replacements"]
----
var str = 'COW';
----


Cheers, Stuart


> 
> If inserting the Unicode character directly fits your requirements,
> that's definitely the simplest option.
> 
> I hope those options help get you closer.
> 
> Cheers,
> 
> -Dan
> 
> On Nov 5, 2013 3:12 PM, "Stuart Rackham" <[email protected]
> <mailto:[email protected]>> wrote:
> 
>     Hi Axel
> 
>     On 11/10/13 04:42, Axel Rauschmayer wrote:
>     > I’d like to use the Unicode character šŸ„ inside normal text and
>     inside a
>     > listing block. Directly referring to the character did not work,
>     but the
>     > following got me quite close:
>     >
>     > :cow: &#x1F404;
>     >
>     > This is a cow: {cow}
>     >
>     > [source,javascript]
>     > ----
>     > var str = '{cow}';
>     > ----
>     >
>     > Any tips for how to best make the cow appear inside the listing block?
> 
>     It will not work because the source-highlight filter escapes special
>     characters, so &#x1F404; is translated to &amp;#x1F404;
> 
>     One way round this might be to paste the Unicode character directly into
>     the source text.
> 
>     Cheers, Stuart
> 
>     >
>     > --
>     > 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]
>     <mailto:asciidoc%[email protected]>.
>     > To post to this group, send email to [email protected]
>     <mailto:[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]
>     <mailto:asciidoc%[email protected]>.
>     To post to this group, send email to [email protected]
>     <mailto:[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.

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