diff --git a/bibhtml/deno.json b/bibhtml/deno.json
index 580b8ba..8cf1db4 100644
--- a/bibhtml/deno.json
+++ b/bibhtml/deno.json
@@ -1,6 +1,6 @@
{
"name": "@celine/bibhtml",
- "version": "0.16.0",
+ "version": "1.0.0",
"license": "MIT",
"exports": "./mod.ts"
}
diff --git a/bibhtml/index.html b/bibhtml/index.html
index c4a34be..c2415a1 100644
--- a/bibhtml/index.html
+++ b/bibhtml/index.html
@@ -68,14 +68,15 @@
@celine/bibhtml
@celine/bibhtml is a Web
Components-based referencing system for HTML documents. It aims to provide a similar user experience to
referencing in LaTeX/BibTeX. It's a thin wrapper around Citation.jswillighagen2019 and
+ href="https://citation.js.org/">Citation.js[#?] and
gracefully degrades when citations and references are malformed or JavaScript is disabled.
@celine/bibhtml takes significant inspiration from @citation-js/replacer, References Web Componentavellar2021 and References Web Component[#?] and Nota's
- citationscrichton2021nota.
+ citations[#?].
+
@@ -121,7 +122,7 @@ Installation
Add the following script to your HTML file's <head>
element:
-
+
- If we cite a missing referencefreud2012 that is
- not in the HTML document, the inner text of the element is displayed as a fallback:
+ The <bh-cite>
element:
+
+ - Replaces the first
#?
contained within an <a>
with the reference number
+ - Unhides the reference
+ - Adds a backlink from the corresponding reference to the citation
+
+
+
+
+ If we cite a missing reference[#?] that is
+ not in the HTML document, the inner text of the element is displayed unchanged.
-
-
-
- We can use <bh-cite>
's href
attribute with a reference ID to force the inner text to always be displayed.
-
-
- This permits us to cite references with flexible inline citation formatting, like (Birol et al., 2013) or Birol et al. [2013].
-
+ or (Birol et al., 2013)
-
-
- We can still use an inner fallback link with the href
attribute: [Birol et al. 2013].
-
+ or Birol et al. [2013].
-
- This expands to reference , and is backed by @citation-js/plugin-bibtex.
+ This expands to reference [#?], and is backed by @citation-js/plugin-bibtex.
Unstructured text
@@ -294,7 +293,7 @@ Unstructured text
- Observe that the reference dunbar2017 is unchanged.
+ Observe that the reference [#?] is unchanged.
DOI
@@ -307,7 +306,7 @@ DOI
- This expands to reference , and is backed by @citation-js/plugin-doi.
+ This expands to reference [#?], and is backed by @citation-js/plugin-doi.
Wikidata
@@ -320,7 +319,7 @@ Wikidata
- This expands to reference , and is backed by @citation-js/plugin-wikidata.
+ This expands to reference [#?], and is backed by @citation-js/plugin-wikidata.
<bh-bibliography>
@@ -347,7 +346,7 @@ <bh-bibliography>
Extras
- <bh-cite> has an appropriate implementation of disconnectedCallback
to remove the citation from the bibliography when the <bh-cite>
element is removed from the DOM.
+ <bh-cite>
has an appropriate implementation of disconnectedCallback
to remove the citation from the bibliography when the <bh-cite>
element is removed from the DOM.
diff --git a/bibhtml/mod.ts b/bibhtml/mod.ts
index 2b8c64a..c77717f 100644
--- a/bibhtml/mod.ts
+++ b/bibhtml/mod.ts
@@ -108,7 +108,7 @@ export class BibhtmlCite extends HTMLElement {
// get the cloned first link
const clonedA = this.shadowRoot!.querySelector('a');
// swap ? for the reference index
- clonedA!.innerText = clonedA!.innerText.replace('?', (this._referenceIndex + 1).toString());
+ clonedA!.innerText = clonedA!.innerText.replace('#?', (this._referenceIndex + 1).toString());
}
}
@@ -173,6 +173,7 @@ export class BibhtmlReference extends HTMLElement {
if (this._citationCount == 0) {
// clear the shadow root
this.shadowRoot!.replaceChildren();
+ return;
}
// gracefully degrade