Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Add space to empty anchor tags to fix internal links. #2957

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add space to empty anchor tags to fix internal links. #2957

wants to merge 1 commit into from

Conversation

rpedela
Copy link

@rpedela rpedela commented May 19, 2016

Internal links (anchor tags) are not linked correctly when the anchor's content is empty.
This adds a space with a height of 0 when it is empty so that internal links are linked correctly.
Fixes issue #1554.

This PR targets master rather than 0.12.3.x like #2949 did.

I tested the following scenarios:

<a id="abc"></a>
<a id="abc" href=""></a>
<a name="abc"></a>
<a name="abc" href=""></a>
<div id="abc"></div>
<div name="abc"></div>

Internal links (anchor tags) are not linked correctly when the anchor's content is empty.
This adds a space with a height of 0 when it is empty so that internal links are linked correctly.
Fixes issue #1554.
@rpedela
Copy link
Author

rpedela commented May 19, 2016

The following code was added based on the assumption that <a id="abc"></a> should be handled identically to <a name="abc"></a>. Is that a safe assumption?

QString id=elm.attribute("id");
if (id.isEmpty()) id=elm.attribute("ns0:id");
if (id.startsWith("__WKANCHOR_")) anchors[id] = elm;

@rpedela
Copy link
Author

rpedela commented May 24, 2016

@ashkulz ready for review. I think I did all the things you asked for like targeting master, etc.

@ashkulz
Copy link
Member

ashkulz commented May 25, 2016

@rpedela: won't have time for a week or so, sorry about that.

@akerouanton
Copy link
Contributor

@ashkulz Could you take a look at this PR? It's been a while and some people still face this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants