Allow links in anchor affordance titles

This commit is contained in:
Saivann 2014-11-28 20:38:27 -05:00
parent 217ddb0701
commit a9d2e73c1a
3 changed files with 3 additions and 11 deletions

View file

@ -128,11 +128,3 @@ check-for-duplicate-header-ids:
## report a false positive if we legitimately have an id ending in '-1', ## report a false positive if we legitimately have an id ending in '-1',
## but that should be easy to work around if it ever happens. ## but that should be easy to work around if it ever happens.
$S grep '<h[1-6][^>]\+id="[^"]\+-1"' _site/en/developer-* | eval $(ERROR_ON_OUTPUT) $S grep '<h[1-6][^>]\+id="[^"]\+-1"' _site/en/developer-* | eval $(ERROR_ON_OUTPUT)
check-for-headers-with-hrefs:
## Subheadings with Kramdown-generated id tags break anchor link
## affordance if their text includes any links (hrefs), so error if any
## links are detectd between <h[2-6]> and </h[2-6> header tags. If we
## ever do need a header with a link, we can revise the pattern below to
## only match Kramdown-generated id tags
$S grep '<\(h[2-6]\).*\?>[^>]\+href=.*</\1>' _site/en/developer-* | eval $(ERROR_ON_OUTPUT)

View file

@ -833,7 +833,7 @@ table td,table th{
.anchorAf{ .anchorAf{
position:relative; position:relative;
} }
.anchorAf a{ .anchorAf a:first-child{
display:none; display:none;
position:absolute; position:absolute;
width:24px; width:24px;
@ -842,7 +842,7 @@ table td,table th{
top:0; top:0;
background:url(/img/icons/mini_ico_anchor.svg) no-repeat center center; background:url(/img/icons/mini_ico_anchor.svg) no-repeat center center;
} }
.anchorAf:hover a{ .anchorAf:hover a:first-child{
display:block; display:block;
} }

View file

@ -408,7 +408,7 @@ for (var i = 0, n = tags.length; i < n; i++) {
} }
for (var i = 0, n = nodes.length; i < n; i++) { for (var i = 0, n = nodes.length; i < n; i++) {
if (!nodes[i].id) continue; if (!nodes[i].id) continue;
if (nodes[i].getElementsByTagName('A').length > 0) return; if (nodes[i].getElementsByTagName('A').length > 0 && nodes[i].getElementsByTagName('A')[0].innerHTML == '') return;
addClass(nodes[i], 'anchorAf'); addClass(nodes[i], 'anchorAf');
var anc = document.createElement('A'); var anc = document.createElement('A');
anc.href = '#' + nodes[i].id; anc.href = '#' + nodes[i].id;