diff --git a/css/print.css b/css/print.css index 322b397c..9caed607 100644 --- a/css/print.css +++ b/css/print.css @@ -26,3 +26,8 @@ p { #spec-container > emu-annex { page-break-before: always; } + +a[data-print-href]::after { + content: ' <' attr(href) '>'; + color: initial; +} diff --git a/src/Spec.ts b/src/Spec.ts index 8bac5cdd..6cb124ea 100644 --- a/src/Spec.ts +++ b/src/Spec.ts @@ -535,6 +535,8 @@ export default class Spec { } this.log('Propagating effect annotations...'); this.propagateEffects(); + this.log('Annotating external links...'); + this.annotateExternalLinks(); this.log('Linking xrefs...'); this._xrefs.forEach(xref => xref.build()); this.log('Linking non-terminal references...'); @@ -814,6 +816,14 @@ export default class Spec { return null; } + private annotateExternalLinks(): void { + for (const a of this.doc.getElementsByTagName('a')) { + if (a.hostname !== '' && a.href !== a.textContent && a.protocol !== 'mailto:') { + a.setAttribute('data-print-href', ''); + } + } + } + private async buildMultipage(wrapper: Element, commonEles: Element[]) { let stillIntro = true; const introEles = [];