Hi,

I have a well-established DocBook toolchain, documenting coding tools in 
various languages. I'm evaluating AsciiDoc to make authoring simple enough 
to expand to additional authors within my company who definitely have no 
DocBook skills.

One challenge I haven't found a solution for is embedding links within code 
samples. This is particularly useful when displaying language-specific 
configuration file that links to the discussion of each configuration entry.

For example, if I am describing PHP configuration like this:

<?php
    return array(
        "widget" => array(
            "foo" => 1,
            "bar" => "string",
        ),
    );

I need to have "widget" linked to the discussion of "widget". This works 
great in DocBook, because <programlisting> tags allow embedded <xref> or 
<link> tags.

In AsciiDoc, I've tried this:

[source,php,subs="macros"]
----
<?php
    return array(
    "xref:widget[widget]" => array(
        "foo" => 1,
"bar" => "string",
),
);
----

which loses everything before "widget".

If I escape the question mark on the first line, like this:

[source,php,subs="macros"]
----
<\?php
    return array(
    "xref:widget[widget]" => array(
        "foo" => 1,
"bar" => "string",
),
);
----

Almost everything renders correctly: all of the content is included, 
"widget" is linked to the appropriate section, syntax highlighting (with 
highlightjs) works well. The only problem is that the first line renders as:

<\?php

Which is invalid PHP code.

I've tried lots of alternatives, but I can't find a combination that 
renders the code block correctly, including the functional link, without 
making the code invalid. Can anyone provide a solution?

Thanks!

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