On Friday, February 6, 2015 at 12:45:40 AM UTC-2, Lex Trotman wrote:
>
> [...] 
> > 
> > It is the default asciidoc stuff. Here's the relevant part 
> > asciidoc_html.conf: 
> > 
> > 
> > [literal-inlinemacro] 
> > <code>{passtext}</code> 
> > 
> > [regex-inlinemacro] 
> > <code class='regex'>{passtext}</code> 
>
> The above is never used because you don't have anything in the [macros] 
> section. 
>
>
Okay, but I was taking a look at html5.conf that comes with asciidoc, and 
it doesn't seem to
have a macro for [literal-inlinemacro]. That or I missed where it is 
defined.
 

> > 
> > [replacements] 
> > ``(.+)``=<code class='regex'>\1</code> 
> > 
> > \[\.regex\]`(.+?)`=<code class='regex'>\1</code> 
>
> Just this should preserve the spaces fine (it does for me). 
>
> What is happening is that having the .regex start with a dot makes the 
> [.regex] not be recognised as an attribute list (attributes can't 
> start with dot) so its kept as just text so the single quote is not 
> preceded by a character that is allowed there (] is not allowed), so 
> it isn't recognised as a quote command so its kept as just text so the 
> whole thing is still there for the replacements to find and replace. 
>
> Note, quoting is processed before replacements so you need to make it 
> *NOT* a legal quote so it is still available for the replacement to 
> recognise, and your dot does that.  Its all perfectly legal 
> customisation of Asciidoc, but boy its very dependent on 
> implementation specifics.  If they change then you have a problem. 
>
>
Okay, that make me understand things a little more.
 

> > 
> > And now I realized I have \. inside [ ]. Sorry about that. 
> > 
> >> 
> >> 
> >> > 
> >> > Then, in the asciidoc file I write 
> >> > 
> >> >     some text [.regex]`{spc}{spc}this ` more text 
> >> 
> >> This is not legal syntax, having the dot, so its undefined what it 
> >> does, it may change at any time a change is made to Asciidoc.  Don't 
> >> rely on it. 
> >> 
> >> > 
> >> > and it translates to 
> >> > 
> >> >     <code class='regex'>  this </code> more text 
> >> > 
> >> > Note that I have to use [.regex]. Simply [regex] does not work. Also, 
> >> > simply 
> >> > using &#160; instead 
> >> > of {spc} works, but using the {nbsp} doesn't work (no spaces are 
> kept). 
> >> 
> >> The ` is a constrained quote, that is the text inside it cannot begin 
> >> and end with spaces, thats the definition of constrained quotes.  You 
> >> are basically fighting the asciidoc processor here. 
> >> 
> > Okay, but not problem if I can just use &#160; or my {spc} definition. 
>
> As I said above, I'm not sure why you need this, the ` is not being 
> processed as a quote, and the spaces are preserved in the replacement. 
>
>
I tried to create this [regex]`code here` stuff because I saw that it works 
in asciidoctor. By the way,
I am using -f asciidoc_html.conf with asciidoc. Would it also work with 
asciidoctor (I can't seem to
make it work, that is why I ask).
 

> Cheers 
> Lex 
>
> PS just a request, in the future please provide *all* customisations 
> you have made, it hard to tell what is happening if information is 
> missing and that wastes all our time. 
>
> Sure, I will. 

> >> 
> >> 
> >> Cheers 
> >> Lex 
> >> 
> >> > 
> >> > 
> >> > On Thursday, February 5, 2015 at 9:13:54 PM UTC-2, Lex Trotman wrote: 
> >> >> 
> >> >> On 6 February 2015 at 09:20, Fernando Basso <[email protected]> 
> >> >> wrote: 
> >> >> > I swear to god I'm reading the user guide a lot. Still, I cannot 
> >> >> > figure 
> >> >> > out 
> >> >> > how to write a macro or create customize asciidoc for my need. 
> >> >> > 
> >> >> > I also found this example: 
> >> >> > 
> >> >> > http://mojavelinux.github.io/decks/asciidoc-with-pleasure/#42.0 
> >> >> > 
> >> >> > In that example, are the two pieces of code? 
> >> >> > 
> >> >> > What if I want to write something that allows me to write this in 
> an 
> >> >> > asciidoc file: 
> >> >> > 
> >> >> >     some text [.regex]` foo bar   ` more text... 
> >> >> 
> >> >> Well 
> >> >> 
> >> >> some text [regex]++ foo bar  ++ more text 
> >> >> 
> >> >> produces 
> >> >> 
> >> >> some text <code><span class="regex"> foo bar  </span></code> more 
> text 
> >> >> 
> >> >> Is that close enough? 
> >> >> 
> >> >> Cheers 
> >> >> Lex 
> >> >> 
> >> >> 
> >> >> > 
> >> >> > And make it translate to 
> >> >> > 
> >> >> >     <code class='regex'>[space]foo bar[space][space]</code> 
> >> >> > 
> >> >> > 
> >> >> > I don't know. The docs seem to lack examples. But I feel it is my 
> >> >> > fault 
> >> >> > nonetheless because other 
> >> >> > people have learned to do wonderful things with it anyway. 
> >> >> > 
> >> >> > Thanks in advance for any help or insights. 
> >> >> > 
> >> >> > -- 
> >> >> > 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/d/optout. 
> >> > 
> >> > -- 
> >> > 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/d/optout. 
> > 
> > -- 
> > 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] <javascript:>. 
> > To post to this group, send email to [email protected] 
> <javascript:>. 
> > Visit this group at http://groups.google.com/group/asciidoc. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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/d/optout.

Reply via email to