Rendering [[foobar]] : diffferences between asciidoctor and asciidoc

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

Rendering [[foobar]] : diffferences between asciidoctor and asciidoc

RichardH

    Last year I used asciidoc to make my webpage
      http://users.skynet.be/watermael/crapauds_2015.html

    This year I decided to switch to Asciidoctor
      http://users.skynet.be/watermael/crapauds_2016.html

    But Asciidoctor is not giving the result I expected;
    anchors and links seem to be treated in one way by
    Asciidoc, in another by Asciidoctor

    ASCIIDOC: The html-by-asciidoc (crapauds_2015.html) reads

            Sur cette page vous trouverez
            une [carte] des lieux d’activité
            des [liens] vers les pages des années précédentes

    where [carte] and [liens] are clicky links
    to anchors in the same html


    ASCIIDOCTOR: The html-by-asciidoctor (crapauds_2016.html) reads

            Sur cette page vous trouverez
            une Pour activer la carte, clickez dans l’image des lieux
d’activité
                --------------------------------------------
            des Les années précédentes vers les pages des années précédentes
                ----------------------

    i.e. Asciidoctor has replaced the link text
       "[anchor name]" by "[the caption of the anchor] "

    These different results even though Asciidoctor and
    Asciidoc were both reading the same adoc file.
    The relevant bits of that file are pasted in below[1]

    What am I getting wrong?

    RichardH

    [1] The asciidoc text reads

Sur cette page vous trouverez

1.    une <<carte>> des lieux d'activité
2.    des <<liens>> vers les pages des années précédentes
...snip...

[[carte]]
.Pour activer la carte, clickez dans l'image
image::http://users.skynet.be/watermael/ScreenshotOpenStreetMap.png["Rouge
Cloître",width=552,height=553,link="http://www.openstreetmap.org/#map=14/50.8156/4.4399"]


== Les années précédentes [[liens]] ==
...snip...

     ===============================================
Reply | Threaded
Open this post in threaded view
|

Re: Rendering [[foobar]] : diffferences between asciidoctor and asciidoc

Jeremie Bresson
I am sorry I do not know anything about the python asciidoc...

I have tried to write here how the Asciidoctor library works:
http://asciidoctor.org/docs/user-manual/#xref

If I understood your question and your example, you have noticed a difference in the link text, called xreflabel.
As you wrote if nothing is defined "the caption of the anchor" is used by default Asciidoctor.

You can change the text:
A/ in the link:
une <<carte, carte>> des lieux d'activité 
or:
lien vers <<carte, une carte des lieux d'activité>> 

B/ in the anchor definition (this defines an other default that will be used everywhere instead of the caption):
[[carte,la carte]]
.Voici une carte des lieux
image::carte2015.png[]

and the link:
une <<carte>> des lieux d'activité

will be rendered as link with the text: "la carte".

Do not hesitate to continue the discussion if I did not understood it weel.
Reply | Threaded
Open this post in threaded view
|

Re: Rendering [[foobar]] : diffferences between asciidoctor and asciidoc

RichardH
    Many thanks for your helpful reply

    Following your advice
    "...You can change the text: A/ in the link: ...",

    I just tried changing the text from
        1.    une <<carte>>  des lieux d'activité
        2.    des <<liens>> vers les pages des années précédentes
    To
        1.    une <<carte,carte>>  des lieux d'activité
        2.    des <<liens,liens>> vers les pages des années précédentes


    Resulting html:
    where the original adoc rendered as <a link>CAPTION OF ANCHOR</a>:-

        <p>une <a href="#carte">Pour activer la carte, clickez dans
l&#8217;image</a>  des lieux d&#8217;activité</p>
        ...
        <p>des <a href="#liens">Les années précédentes</a> vers les
pages des années précédentes</p>


    The changed lines give <a link>TEXT OF LINK</a> :-

        <p>une <a href="#carte">carte</a>  des lieux d&#8217;activité</p>
        ...
        <p>des <a href="#liens">liens</a> vers les pages des années
précédentes</p>

    Purrrrfect!

    Richard H


Reply | Threaded
Open this post in threaded view
|

Re: Rendering [[foobar]] : diffferences between asciidoctor and asciidoc

mojavelinux
Administrator
In reply to this post by RichardH
Thanks for the clarification Jérémie!

I'll add a few additional notes.

RichardH wrote:
> anchors and links seem to be treated in one way by Asciidoc, in another by Asciidoctor.  i.e. Asciidoctor has replaced the link text "[anchor name]" by "[the caption of the anchor] " 

Correct, Asciidoctor takes this a step further. Asciidoctor inserts smart references by using the title or xreflabel of the target at the reference point.

> What am I getting wrong? 

Nothing at all. You are observing Asciidoctor in action.


^ If there is something about this section that is unclear, please let us know and we'll update it.

Cheers,

-Dan

On Mon, Feb 22, 2016 at 10:32 AM, RichardH [via Asciidoctor :: Discussion] <[hidden email]> wrote:

    Last year I used asciidoc to make my webpage
      http://users.skynet.be/watermael/crapauds_2015.html

    This year I decided to switch to Asciidoctor
      http://users.skynet.be/watermael/crapauds_2016.html

    But Asciidoctor is not giving the result I expected;
    anchors and links seem to be treated in one way by
    Asciidoc, in another by Asciidoctor

    ASCIIDOC: The html-by-asciidoc (crapauds_2015.html) reads

            Sur cette page vous trouverez
            une [carte] des lieux d’activité
            des [liens] vers les pages des années précédentes

    where [carte] and [liens] are clicky links
    to anchors in the same html


    ASCIIDOCTOR: The html-by-asciidoctor (crapauds_2016.html) reads

            Sur cette page vous trouverez
            une Pour activer la carte, clickez dans l’image des lieux
d’activité
                --------------------------------------------
            des Les années précédentes vers les pages des années précédentes
                ----------------------

    i.e. Asciidoctor has replaced the link text
       "[anchor name]" by "[the caption of the anchor] "

    These different results even though Asciidoctor and
    Asciidoc were both reading the same adoc file.
    The relevant bits of that file are pasted in below[1]

    What am I getting wrong?

    RichardH

    [1] The asciidoc text reads

Sur cette page vous trouverez

1.    une <<carte>> des lieux d'activité
2.    des <<liens>> vers les pages des années précédentes
...snip...

[[carte]]
.Pour activer la carte, clickez dans l'image
image::http://users.skynet.be/watermael/ScreenshotOpenStreetMap.png["Rouge
Cloître",width=552,height=553,link="http://www.openstreetmap.org/#map=14/50.8156/4.4399"]


== Les années précédentes [[liens]] ==
...snip...

     ===============================================



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Rendering-foobar-diffferences-between-asciidoctor-and-asciidoc-tp4376.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen