Skip to content

Commit 6ce672a

Browse files
committed
Update local dfns to not be links by removing data-cite.
Fixes #233.
1 parent f4f25bc commit 6ce672a

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

common/common.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,23 @@ function restrictReferences(utils, content) {
3333
return (base.innerHTML);
3434
}
3535

36-
// add a handler to come in after all the definitions are resolved
37-
//
38-
// New logic: If the reference is within a 'dl' element of
39-
// class 'termlist', and if the target of that reference is
40-
// also within a 'dl' element of class 'termlist', then
41-
// consider it an internal reference and ignore it.
4236
require(["core/pubsubhub"], (respecEvents) => {
4337
"use strict";
38+
39+
// remote data-cite on where the citation is to ourselves.
40+
respecEvents.sub('end', (message) => {
41+
const selfDfns = document.querySelectorAll("dfn[data-cite^='" + respecConfig.shortName.toUpperCase() + "']");
42+
for (const dfn of selfDfns) {
43+
delete dfn.dataset.cite;
44+
}
45+
});
46+
47+
// add a handler to come in after all the definitions are resolved
48+
//
49+
// New logic: If the reference is within a 'dl' element of
50+
// class 'termlist', and if the target of that reference is
51+
// also within a 'dl' element of class 'termlist', then
52+
// consider it an internal reference and ignore it.
4453
respecEvents.sub('end', (message) => {
4554
if (message === 'core/link-to-dfn') {
4655
// all definitions are linked; find any internal references

0 commit comments

Comments
 (0)