Multiple anchor definitions

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

Multiple anchor definitions

Jeremie Bresson

One example that works:
----
Some [[first]][[second]][[third]] text
----

And produces (tested chrome => 1.5.4.100) this output:
====
<div class="paragraph">
<p>Some <a id="first"></a><a id="second"></a><a id="third"></a> text</p>
</div>
====

The same is not possible with the anchor form:

----
Some anchor:first[] anchor:second[] anchor:third[] text
----

Produces:
====
<div class="paragraph">
<p>Some <a id="first"></a> <a id="third"></a> text</p>
</div>
====

As you see, each second anchor definition is lost.

The workaround:
----
Some anchor:first[] anchor:lost1[] anchor:second[] anchor:lost1[] anchor:third[] text
----

In my opinion this is a bug.
Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchor definitions

mojavelinux
Administrator
Sure enough, the regular expression is missing a | character, which is causing every other inline anchor macro with an empty attribute list from being skipped. Could you file an issue in core?

Note that if you added reftext to each anchor, then the anchors would not be skipped.

----
Some anchor:first[first] anchor:second[second] anchor:third[third] text
----

That helped me pinpoint the missing character in the match expression. And we are missing a test for this case.

Cheers,

-Dan

On Thu, Feb 4, 2016 at 4:38 AM, Jeremie Bresson [via Asciidoctor :: Discussion] <[hidden email]> wrote:

One example that works:
----
Some [[first]][[second]][[third]] text
----

And produces (tested chrome => 1.5.4.100) this output:
====
<div class="paragraph">
<p>Some <a id="first"></a><a id="second"></a><a id="third"></a> text</p>
</div>
====

The same is not possible with the anchor form:

----
Some anchor:first[] anchor:second[] anchor:third[] text
----

Produces:
====
<div class="paragraph">
<p>Some <a id="first"></a> <a id="third"></a> text</p>
</div>
====

As you see, each second anchor definition is lost.

The workaround:
----
Some anchor:first[] anchor:lost1[] anchor:second[] anchor:lost1[] anchor:third[] text
----

In my opinion this is a bug.


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Multiple-anchor-definitions-tp4263.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
Reply | Threaded
Open this post in threaded view
|

Re: Multiple anchor definitions

Jeremie Bresson