diff --git a/_quarto.yml b/_quarto.yml index 2328fd5..715b01d 100644 --- a/_quarto.yml +++ b/_quarto.yml @@ -5,9 +5,9 @@ project: # Quarto options for books # https://quarto.org/docs/reference/projects/books.html book: - title: "Baroque AI: Publication Prototype" - author: "Class participants" - date: "2023-04-14" + title: "Computational Publishing Service Demo" + author: "Simon Worthington" + date: "2024-03-22" # this section determines which files will be added to the book as chapters chapters: - index.qmd @@ -17,7 +17,7 @@ book: # - video.ipynb # - sw-collection.ipynb # - html-test.html - repo-url: https://github.com/NFDI4Culture/catalogue-003 + repo-url: https://github.com/NFDI4Culture/CPS-Demo repo-actions: [edit] downloads: [pdf,docx,epub] cover-image: cover-smallalt.jpg diff --git a/docs/Baroque-AI--Publication-Prototype.docx b/docs/Computational-Publishing-Service-Demo.docx similarity index 99% rename from docs/Baroque-AI--Publication-Prototype.docx rename to docs/Computational-Publishing-Service-Demo.docx index e167ec5..b5f1f34 100644 Binary files a/docs/Baroque-AI--Publication-Prototype.docx and b/docs/Computational-Publishing-Service-Demo.docx differ diff --git a/docs/Baroque-AI--Publication-Prototype.epub b/docs/Computational-Publishing-Service-Demo.epub similarity index 95% rename from docs/Baroque-AI--Publication-Prototype.epub rename to docs/Computational-Publishing-Service-Demo.epub index 6eaf1b3..c105d00 100644 Binary files a/docs/Baroque-AI--Publication-Prototype.epub and b/docs/Computational-Publishing-Service-Demo.epub differ diff --git a/docs/Baroque-AI--Publication-Prototype.pdf b/docs/Computational-Publishing-Service-Demo.pdf similarity index 98% rename from docs/Baroque-AI--Publication-Prototype.pdf rename to docs/Computational-Publishing-Service-Demo.pdf index a4a5889..612fdfa 100644 Binary files a/docs/Baroque-AI--Publication-Prototype.pdf and b/docs/Computational-Publishing-Service-Demo.pdf differ diff --git a/docs/collection003.html b/docs/collection003.html index d0e6483..f48a726 100644 --- a/docs/collection003.html +++ b/docs/collection003.html @@ -2,12 +2,12 @@ - + -Baroque AI: Publication Prototype - 3  Baroque painting +Computational Publishing Service Demo - Baroque painting @@ -57,7 +57,8 @@ "search-more-matches-text": "more matches in this document", "search-clear-button-title": "Clear", "search-detached-cancel-button-title": "Cancel", - "search-submit-button-title": "Submit" + "search-submit-button-title": "Submit", + "search-label": "Search" } } @@ -69,11 +70,16 @@
- @@ -81,41 +87,43 @@

Baroque paint
-
-

Baroque painting

+

Baroque painting

@@ -221,9 +230,23 @@

National variations { + for (const clz of el.classList) { + if (clz.startsWith('code-annotation-')) { + return true; + } + } + return false; + } const clipboard = new window.ClipboardJS('.code-copy-button', { - target: function(trigger) { - return trigger.previousElementSibling; + text: function(trigger) { + const codeEl = trigger.previousElementSibling.cloneNode(true); + for (const childEl of codeEl.children) { + if (isCodeAnnotation(childEl)) { + childEl.remove(); + } + } + return codeEl.innerText; } }); clipboard.on('success', function(e) { @@ -288,6 +311,92 @@

National variations { + let cellAttr = 'data-code-cell="' + cell + '"'; + let lineAttr = 'data-code-annotation="' + annotation + '"'; + const selector = 'span[' + cellAttr + '][' + lineAttr + ']'; + return selector; + } + const selectCodeLines = (annoteEl) => { + const doc = window.document; + const targetCell = annoteEl.getAttribute("data-target-cell"); + const targetAnnotation = annoteEl.getAttribute("data-target-annotation"); + const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation)); + const lines = annoteSpan.getAttribute("data-code-lines").split(","); + const lineIds = lines.map((line) => { + return targetCell + "-" + line; + }) + let top = null; + let height = null; + let parent = null; + if (lineIds.length > 0) { + //compute the position of the single el (top and bottom and make a div) + const el = window.document.getElementById(lineIds[0]); + top = el.offsetTop; + height = el.offsetHeight; + parent = el.parentElement.parentElement; + if (lineIds.length > 1) { + const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]); + const bottom = lastEl.offsetTop + lastEl.offsetHeight; + height = bottom - top; + } + if (top !== null && height !== null && parent !== null) { + // cook up a div (if necessary) and position it + let div = window.document.getElementById("code-annotation-line-highlight"); + if (div === null) { + div = window.document.createElement("div"); + div.setAttribute("id", "code-annotation-line-highlight"); + div.style.position = 'absolute'; + parent.appendChild(div); + } + div.style.top = top - 2 + "px"; + div.style.height = height + 4 + "px"; + let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter"); + if (gutterDiv === null) { + gutterDiv = window.document.createElement("div"); + gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter"); + gutterDiv.style.position = 'absolute'; + const codeCell = window.document.getElementById(targetCell); + const gutter = codeCell.querySelector('.code-annotation-gutter'); + gutter.appendChild(gutterDiv); + } + gutterDiv.style.top = top - 2 + "px"; + gutterDiv.style.height = height + 4 + "px"; + } + selectedAnnoteEl = annoteEl; + } + }; + const unselectCodeLines = () => { + const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"]; + elementsIds.forEach((elId) => { + const div = window.document.getElementById(elId); + if (div) { + div.remove(); + } + }); + selectedAnnoteEl = undefined; + }; + // Attach click handler to the DT + const annoteDls = window.document.querySelectorAll('dt[data-target-cell]'); + for (const annoteDlNode of annoteDls) { + annoteDlNode.addEventListener('click', (event) => { + const clickedEl = event.target; + if (clickedEl !== selectedAnnoteEl) { + unselectCodeLines(); + const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active'); + if (activeEl) { + activeEl.classList.remove('code-annotation-active'); + } + selectCodeLines(clickedEl); + clickedEl.classList.add('code-annotation-active'); + } else { + // Unselect the line + unselectCodeLines(); + clickedEl.classList.remove('code-annotation-active'); + } + }); + } const findCites = (el) => { const parentEl = el.parentElement; if (parentEl) { diff --git a/docs/colophon.html b/docs/colophon.html index 67bb588..e1eed6b 100644 --- a/docs/colophon.html +++ b/docs/colophon.html @@ -2,12 +2,12 @@ - + -Baroque AI: Publication Prototype - 2  Colophon +Computational Publishing Service Demo - Colophon @@ -57,7 +57,8 @@ "search-more-matches-text": "more matches in this document", "search-clear-button-title": "Clear", "search-detached-cancel-button-title": "Cancel", - "search-submit-button-title": "Submit" + "search-submit-button-title": "Submit", + "search-label": "Search" } } @@ -69,11 +70,16 @@
- @@ -81,41 +87,43 @@

Colophon
-