@thegetty/quire-11ty
Advanced tools
Comparing version 1.0.0-rc.0 to 1.0.0-rc.1
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
const path = require('path') | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { oneLine } = require('~lib/common-tags') | ||
const { oneLine } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ module.exports = function(eleventyConfig) { |
const { html } = require('common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const logger = chalkFactory('Figure Annotations UI') | ||
@@ -4,0 +4,0 @@ |
@@ -1,38 +0,5 @@ | ||
const { html } = require('~lib/common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
const { html } = require('#lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
const logger = chalkFactory('Figure Video') | ||
const audioElements = { | ||
soundcloud({ id, mediaId }) { | ||
if (!mediaId) { | ||
logger.error(`Cannot render SoundCloud component without 'media_id'. Check that figures data for id: ${id} has a valid 'media_id'`) | ||
return '' | ||
} | ||
const src = new URL('https://w.soundcloud.com/player/') | ||
const params = new URLSearchParams({ | ||
auto_play: 'false', | ||
color: encodeURIComponent('#ff5500'), | ||
hide_related: 'true', | ||
show_comments: 'false', | ||
show_reposts: 'false', | ||
show_teaser: 'false', | ||
show_user: 'false', | ||
url: encodeURIComponent(`https://api.soundcloud.com/tracks/${mediaId}`) | ||
}) | ||
src.search = `?${params.toString()}` | ||
return html` | ||
<iframe | ||
allow="autoplay" | ||
frameborder="no" | ||
height="166" | ||
scrolling="no" | ||
src="${src.href}" | ||
width="100%" | ||
></iframe> | ||
` | ||
} | ||
} | ||
/** | ||
@@ -45,3 +12,4 @@ * Renders an embedded soundcloud audio player | ||
* @param {String} id The id of the figure | ||
* @param {String} mediaId An id for a soundcloud embed | ||
* @param {String} mediaId An id for a soundcloud embed | ||
* @param {String} mediaType The type of tag video ('video', 'vimeo' or 'youtube') | ||
* | ||
@@ -51,5 +19,27 @@ * @return {String} An embedded soundcloud player | ||
module.exports = function (eleventyConfig) { | ||
const figureMediaEmbedUrl = eleventyConfig.getFilter('figureMediaEmbedUrl') | ||
const audioElements = { | ||
soundcloud({ id, mediaId, mediaType }) { | ||
if (!mediaId) { | ||
logger.error(`Cannot render SoundCloud component without 'media_id'. Check that figures data for id: ${id} has a valid 'media_id'`) | ||
return '' | ||
} | ||
const { embedUrl } = figureMediaEmbedUrl({ mediaId, mediaType }) | ||
return html` | ||
<iframe | ||
allow="autoplay" | ||
frameborder="no" | ||
height="166" | ||
scrolling="no" | ||
src="${embedUrl}" | ||
width="100%" | ||
></iframe> | ||
` | ||
} | ||
} | ||
return function ({ id, mediaId, mediaType }) { | ||
return audioElements[mediaType]({ id, mediaId }) | ||
return audioElements[mediaType]({ id, mediaId, mediaType }) | ||
} | ||
} |
@@ -1,30 +0,6 @@ | ||
const { html } = require('~lib/common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
/** | ||
* Renders an iframe element with the SoundCloud audio player | ||
* | ||
* @param {Object} eleventyConfig eleventy configuration | ||
* @param {Object} figure The figure | ||
* | ||
* @return {String} An embedded SoundCloud player and a caption | ||
*/ | ||
module.exports = function(eleventyConfig) { | ||
const figureCaption = eleventyConfig.getFilter('figureCaption') | ||
const figureImage = eleventyConfig.getFilter('figureImage') | ||
const figureLabel = eleventyConfig.getFilter('figureLabel') | ||
const figureAudioElement = eleventyConfig.getFilter('figureAudioElement') | ||
return function({ caption, credit, id, label, mediaId, mediaType }) { | ||
const audioElement = figureAudioElement({ id, mediaId, mediaType }) | ||
const labelElement = figureLabel({ caption, id, label }) | ||
const captionElement = figureCaption({ caption, content: labelElement, credit }) | ||
return html` | ||
<div class="q-figure__media-wrapper"> | ||
${audioElement} | ||
</div> | ||
${captionElement} | ||
` | ||
const renderOutputs = eleventyConfig.getFilter('renderOutputs') | ||
return function(params) { | ||
return renderOutputs(__dirname, params) | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
const { oneLine } = require('~lib/common-tags') | ||
const { oneLine } = require('#lib/common-tags') | ||
@@ -6,3 +6,3 @@ /** | ||
* @param {Object} eleventyConfig eleventy configuration | ||
* | ||
* | ||
* @param {Object} params | ||
@@ -15,6 +15,11 @@ * @property {String} figure | ||
const markdownify = eleventyConfig.getFilter('markdownify') | ||
return function({ caption, credit, content='' }) { | ||
const figureMediaEmbedUrl = eleventyConfig.getFilter('figureMediaEmbedUrl') | ||
return function({ caption, credit, content='', mediaId, mediaType}) { | ||
const { sourceUrl } = figureMediaEmbedUrl({ mediaId, mediaType }) | ||
const mediaSourceLink = sourceUrl | ||
? `<span class="q-figure__caption-embed-link"><a href="${sourceUrl}"><em>${sourceUrl}</em></a></span>` | ||
: '' | ||
return oneLine` | ||
<figcaption class="q-figure__caption"> | ||
${mediaSourceLink} | ||
${markdownify(content)} | ||
@@ -21,0 +26,0 @@ <span class="q-figure__caption-content">${markdownify(caption || '')}</span> |
@@ -1,3 +0,3 @@ | ||
const { html } = require('~lib/common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
const { html } = require('#lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -19,4 +19,6 @@ | ||
return function(figure) { | ||
const { alt, caption, credit, id, label, src='' } = figure | ||
const { alt, caption, credit, id, label, src } = figure | ||
if (!src) return '' | ||
const labelElement = figureLabel({ caption, id, label }) | ||
@@ -23,0 +25,0 @@ |
@@ -1,2 +0,2 @@ | ||
const { oneLine } = require('~lib/common-tags') | ||
const { oneLine } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ module.exports = function (eleventyConfig) { |
const path = require('path') | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -4,0 +4,0 @@ module.exports = function(eleventyConfig) { |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
@@ -1,66 +0,6 @@ | ||
const { html } = require('~lib/common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
const { html } = require('#lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
const path = require('path') | ||
const logger = chalkFactory('Figure Video') | ||
const videoElements = { | ||
video({ id, poster='', src }) { | ||
if (!src) { | ||
logger.error(`Cannot render Video without 'src'. Check that figures data for id: ${id} has a valid 'src'`) | ||
return '' | ||
} | ||
if (!poster) { | ||
logger.warn(`Figure '${id}' does not have a 'poster' property. A poster image for id: ${id} will not be rendered`) | ||
} | ||
const unsupported = 'Sorry, your browser does not support embedded videos.' | ||
return html` | ||
<video | ||
class="q-figure-video-element" | ||
controls | ||
poster="${poster}" | ||
> | ||
<source src="${src}" type="video/mp4"/> | ||
${unsupported} | ||
</video> | ||
` | ||
}, | ||
vimeo({ id, mediaId }) { | ||
if (!mediaId) { | ||
logger.error(`Cannot render Vimeo embed without 'media_id'. Check that figures data for id: ${id} has a valid 'media_id'`) | ||
return '' | ||
} | ||
// Sample Vimeo id: 672853278/b3f8d29d53 | ||
const embedId = mediaId.replace('/', '?h=') | ||
return html` | ||
<iframe | ||
allow="fullscreen; picture-in-picture" | ||
allowfullscreen | ||
class="q-figure-video-element q-figure-video-element--embed" | ||
frameborder="0" | ||
src="https://player.vimeo.com/video/${embedId}" | ||
></iframe> | ||
` | ||
}, | ||
youtube({ id, mediaId }) { | ||
if (!mediaId) { | ||
logger.error(`Cannot render Youtube component without 'media_id'. Check that figures data for id: ${id} has a valid 'media_id'`) | ||
return '' | ||
} | ||
return html` | ||
<iframe | ||
allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" | ||
allowfullscreen | ||
class="q-figure-video-element q-figure-video-element--embed" | ||
frameborder="0" | ||
src="https://www.youtube-nocookie.com/embed/${mediaId}" | ||
></iframe> | ||
` | ||
} | ||
} | ||
/** | ||
@@ -73,4 +13,4 @@ * Renders a native or embedded video player | ||
* @param {String} id The id of the figure | ||
* @param {String} mediaId An id for a youtube or vimeo embed | ||
* @param {String} mediaType The type of tag video ('video', 'vimeo' or 'youtube') | ||
* @param {String} mediaId An id for a youtube or vimeo embed | ||
* @param {String} mediaType The type of tag video ('video', 'vimeo' or 'youtube') | ||
* @param {String} poster Poster image url for a static video file | ||
@@ -83,3 +23,64 @@ * @param {String} src Source url for a static video file | ||
const { imageDir } = eleventyConfig.globalData.config.figures | ||
const figureMediaEmbedUrl = eleventyConfig.getFilter('figureMediaEmbedUrl') | ||
const videoElements = { | ||
video({ id, poster='', src }) { | ||
if (!src) { | ||
logger.error(`Cannot render Video without 'src'. Check that figures data for id: ${id} has a valid 'src'`) | ||
return '' | ||
} | ||
if (!poster) { | ||
logger.warn(`Figure '${id}' does not have a 'poster' property. A poster image for id: ${id} will not be rendered`) | ||
} | ||
const unsupported = 'Sorry, your browser does not support embedded videos.' | ||
return html` | ||
<video | ||
class="q-figure-video-element" | ||
controls | ||
poster="${poster}" | ||
> | ||
<source src="${src}" type="video/mp4"/> | ||
${unsupported} | ||
</video> | ||
` | ||
}, | ||
vimeo({ id, mediaId, mediaType }) { | ||
if (!mediaId) { | ||
logger.error(`Cannot render Vimeo embed without 'media_id'. Check that figures data for id: ${id} has a valid 'media_id'`) | ||
return '' | ||
} | ||
const { embedUrl } = figureMediaEmbedUrl({ mediaId, mediaType }) | ||
return html` | ||
<iframe | ||
allow="fullscreen; picture-in-picture" | ||
allowfullscreen | ||
class="q-figure-video-element q-figure-video-element--embed" | ||
frameborder="0" | ||
src="${embedUrl}" | ||
></iframe> | ||
` | ||
}, | ||
youtube({ id, mediaId, mediaType }) { | ||
if (!mediaId) { | ||
logger.error(`Cannot render Youtube component without 'media_id'. Check that figures data for id: ${id} has a valid 'media_id'`) | ||
return '' | ||
} | ||
const { embedUrl } = figureMediaEmbedUrl({ mediaId, mediaType }) | ||
return html` | ||
<iframe | ||
allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" | ||
allowfullscreen | ||
class="q-figure-video-element q-figure-video-element--embed" | ||
frameborder="0" | ||
src="${embedUrl}" | ||
></iframe> | ||
` | ||
} | ||
} | ||
return function ({ | ||
@@ -99,4 +100,4 @@ id, | ||
return videoElements[mediaType]({ id, mediaId, poster, src }) | ||
return videoElements[mediaType]({ id, mediaId, mediaType, poster, src }) | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
/** | ||
@@ -3,0 +3,0 @@ * Renders a native or embedded video player with a caption |
@@ -1,3 +0,3 @@ | ||
const { html } = require('~lib/common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
const { html } = require('#lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
const path = require('path') | ||
@@ -21,3 +21,12 @@ | ||
return function({ aspect_ratio: aspectRatio, caption, credit, id, label, mediaType, poster=''}) { | ||
return function({ | ||
aspect_ratio: aspectRatio, | ||
caption, | ||
credit, | ||
id, | ||
label, | ||
mediaId, | ||
mediaType, | ||
poster='' | ||
}) { | ||
if (!poster) { | ||
@@ -31,7 +40,9 @@ logger.warn(`Figure '${id}' does not have a 'poster' property. Print media will not render a fallback image for id: ${id}`) | ||
const labelElement = figureLabel({ caption, id, label }) | ||
const captionElement = figureCaption({ caption, content: labelElement, credit }) | ||
const captionElement = figureCaption({ caption, content: labelElement, credit, mediaId, mediaType }) | ||
const trimLeadingSlash = (string) => string.startsWith('/') ? string.substr(1) : string | ||
return html` | ||
<div class="q-figure__media-wrapper--${ aspectRatio || 'widescreen' }"> | ||
<img src="${posterSrc}" /> | ||
<img src="${trimLeadingSlash(posterSrc)}" /> | ||
</div> | ||
@@ -38,0 +49,0 @@ ${captionElement} |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
const fs = require('fs') | ||
const path = require('path') | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -5,0 +5,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -24,2 +24,3 @@ /** | ||
figureModalLink: require('./figure/modal-link'), | ||
figureMediaEmbedUrl: require('./figure/media-embed-url'), | ||
figureOption: require('./figure/annotations-ui/option'), | ||
@@ -26,0 +27,0 @@ figurePlaceholder: require('./figure/placeholder'), |
const path = require('path') | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -4,0 +4,0 @@ module.exports = function(eleventyConfig) { |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ module.exports = function(eleventyConfig) { |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { oneLine } = require('~lib/common-tags') | ||
const { oneLine } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
const truncate = require('~lib/truncate') | ||
const { html } = require('~lib/common-tags') | ||
const truncate = require('#lib/truncate') | ||
const { html } = require('#lib/common-tags') | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
const path = require ('path') | ||
const { html, oneLine } = require('~lib/common-tags') | ||
const { html, oneLine } = require('#lib/common-tags') | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html, oneLine } = require('~lib/common-tags') | ||
const { html, oneLine } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
const path = require('path') | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
/** | ||
@@ -43,3 +43,3 @@ * Renders a TOC List | ||
return html` | ||
<ol class="toc-list"> | ||
<ol class="table-of-contents-list"> | ||
${otherPages.map(listItem)} | ||
@@ -51,7 +51,7 @@ </ol> | ||
return html` | ||
<div class="menu-list"> | ||
<nav class="table-of-contents menu-list"> | ||
${renderList(navigation)} | ||
</div> | ||
</nav> | ||
` | ||
} | ||
} |
const path = require('path') | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
@@ -35,3 +35,3 @@ /** | ||
${this.navigation(data)} | ||
<main id="${pageId}" class="quire-page ${pageClasses}" data-output-path="${outputPath}"> | ||
<main class="quire-page ${pageClasses}" data-output-path="${outputPath}" data-page-id="${pageId}" > | ||
${content} | ||
@@ -38,0 +38,0 @@ </main> |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const Processor = require('simple-cite') | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
@@ -3,0 +3,0 @@ const logger = chalkFactory('plugins:collections') |
@@ -1,5 +0,5 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const mime = require('mime-types') | ||
const path = require('path') | ||
const titleCase = require('~plugins/filters/titleCase') | ||
const titleCase = require('#plugins/filters/titleCase') | ||
@@ -6,0 +6,0 @@ const logger = chalkFactory('Figures:Annotation') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const Annotation = require('../annotation') | ||
@@ -3,0 +3,0 @@ const AnnotationFactory = require('../annotation/factory') |
@@ -10,4 +10,5 @@ const path = require('path') | ||
module.exports = function(figure) { | ||
const { src='' } = figure | ||
const { src } = figure | ||
if (!src) return false | ||
return path.parse(src) === 'info.json' | ||
} |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
@@ -1,5 +0,5 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
const path = require('path') | ||
const titleCase = require('~plugins/filters/titleCase') | ||
const titleCase = require('#plugins/filters/titleCase') | ||
const Writer = require('./writer') | ||
@@ -6,0 +6,0 @@ const { globalVault } = require('@iiif/vault') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
@@ -3,0 +3,0 @@ const path = require('path') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
@@ -3,0 +3,0 @@ const path = require('path') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
@@ -3,0 +3,0 @@ const path = require('path') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const FigureFactory = require('./figure/factory') | ||
@@ -3,0 +3,0 @@ const iiifConfig = require('./iiif/config') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
@@ -3,0 +3,0 @@ const logger = chalkFactory('filters:getContributor') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
@@ -3,0 +3,0 @@ const logger = chalkFactory('filters:getObject') |
@@ -16,2 +16,3 @@ // Quire data filters | ||
const removeHTML = require('./removeHTML') | ||
const slugifyIds = require('./slugifyIds') | ||
const titleCase = require('./titleCase') | ||
@@ -42,3 +43,4 @@ | ||
eleventyConfig.addFilter('removeHTML', (string) => removeHTML(string)) | ||
eleventyConfig.addFilter('slugifyIds', (string) => slugifyIds(string, eleventyConfig)) | ||
eleventyConfig.addFilter('titleCase', (string) => titleCase(string)) | ||
} |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
@@ -3,0 +3,0 @@ const logger = chalkFactory('filters:keywords') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
@@ -3,0 +3,0 @@ const path = require('path') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
@@ -3,0 +3,0 @@ const path = require('path') |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
@@ -3,0 +3,0 @@ const logger = chalkFactory('plugins:linters') |
@@ -25,4 +25,7 @@ const MarkdownIt = require('markdown-it') | ||
* @see https://github.com/valeriangalliat/markdown-it-anchor#usage | ||
* To prevent duplicate element IDs from slugified headings, we are only generating anchor links for level 1 headings | ||
*/ | ||
const anchorOptions = {} | ||
const anchorOptions = { | ||
level: [1] | ||
} | ||
@@ -29,0 +32,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
@@ -3,0 +3,0 @@ const path = require('path') |
@@ -1,3 +0,3 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const { oneLine } = require('~lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
const { oneLine } = require('#lib/common-tags') | ||
const logger = chalkFactory(`Shortcodes:Annoref`) | ||
@@ -4,0 +4,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
const { html } = require('~lib/common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
const { html } = require('#lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
@@ -58,5 +58,3 @@ const logger = chalkFactory('configuration:bibliography') | ||
const bibliographyHeading = () => heading | ||
? `<h2 id="${slugify(heading)}">${heading}</h2>` | ||
: '' | ||
const bibliographyHeading = () => heading ? `<h2>${heading}</h2>` : '' | ||
@@ -63,0 +61,0 @@ const definitionList = () => html` |
@@ -1,3 +0,3 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const { renderOneLine, stripIndent } = require('~lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
const { renderOneLine, stripIndent } = require('#lib/common-tags') | ||
@@ -4,0 +4,0 @@ const logger = chalkFactory('shortcodes:cite') |
@@ -1,3 +0,3 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const { html } = require('~lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
const { html } = require('#lib/common-tags') | ||
@@ -4,0 +4,0 @@ const logger = chalkFactory('shortcodes:contributors') |
@@ -1,3 +0,3 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const { oneLine } = require('~lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
const { oneLine } = require('#lib/common-tags') | ||
@@ -4,0 +4,0 @@ const logger = chalkFactory('shortcodes:figure') |
@@ -1,3 +0,3 @@ | ||
const { html } = require('~lib/common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
const { html } = require('#lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
const figure = require('./figure') | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
const { oneLineCommaListsAnd } = require('~lib/common-tags') | ||
const chalkFactory = require('~lib/chalk') | ||
const { oneLineCommaListsAnd } = require('#lib/common-tags') | ||
const chalkFactory = require('#lib/chalk') | ||
@@ -4,0 +4,0 @@ const logger = chalkFactory('shortcodes:figureRef') |
@@ -1,2 +0,2 @@ | ||
const { oneLine } = require('~lib/common-tags') | ||
const { oneLine } = require('#lib/common-tags') | ||
@@ -3,0 +3,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
const { html, oneLine } = require('~lib/common-tags') | ||
const { html, oneLine } = require('#lib/common-tags') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const path = require('path') | ||
@@ -3,0 +3,0 @@ const prettier = require('prettier') |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
module.exports = ({ body, language, title }) => { | ||
@@ -3,0 +3,0 @@ const stylesheets = '' |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const path = require('path') | ||
@@ -80,3 +80,3 @@ | ||
const stylesheets = () => { | ||
return [path.join('css', 'epub.css')] | ||
return [path.join('_assets', 'epub.css')] | ||
} | ||
@@ -95,2 +95,22 @@ | ||
/** | ||
* Collect resources for the publication | ||
*/ | ||
let resources = [] | ||
for (const url of stylesheets()) { | ||
resources.push({ | ||
url: url, | ||
encodingFormat: 'text/css' | ||
}) | ||
} | ||
const coverUrl = cover() | ||
for (const asset of assets) { | ||
let item = { url: asset } | ||
if (asset === coverUrl) { | ||
item.rel = 'cover-image' | ||
} | ||
resources.push(item) | ||
} | ||
return { | ||
@@ -101,8 +121,7 @@ '@context': [ | ||
], | ||
// css: stylesheets(), | ||
conformsTo: 'https://www.w3.org/TR/pub-manifest/', | ||
contributors: contributors('secondary'), | ||
cover: cover(), | ||
cover: coverUrl, | ||
creators: contributors('primary'), | ||
date: pubDate, | ||
dateModifed: pubDate, | ||
description: removeHTML(description.full).replace(/\r?\n|\r/g, ' '), | ||
@@ -113,8 +132,7 @@ id: isbn, | ||
readingOrder: readingOrder.sort(), | ||
resources: assets, | ||
resources: resources, | ||
rights: copyright, | ||
title: pubTitle(), | ||
type: 'Book', | ||
url | ||
type: 'Book' | ||
} | ||
} |
@@ -17,2 +17,3 @@ const filterOutputs = require('../filter.js') | ||
const slugify = eleventyConfig.getFilter('slugify') | ||
const slugifyIds = eleventyConfig.getFilter('slugifyIds') | ||
const { imageDir } = eleventyConfig.globalData.config.figures | ||
@@ -54,3 +55,3 @@ const { language } = eleventyConfig.globalData.publication | ||
const page = collections.epub[index] | ||
const { document } = new JSDOM(epubContent).window | ||
const { document, window } = new JSDOM(epubContent).window | ||
const mainElement = document.querySelector('main[data-output-path]') | ||
@@ -68,8 +69,40 @@ const title = pageTitle(page.data) | ||
/** | ||
* Add epub-specific attributes to TOC element | ||
*/ | ||
const tableOfContents = body.querySelector('.table-of-contents') | ||
if (tableOfContents) { | ||
tableOfContents.setAttribute('role', 'doc-toc') | ||
tableOfContents.setAttribute('epub:type', 'toc') | ||
} | ||
/** | ||
* Sequence and write files | ||
*/ | ||
const name = slugify(this.url) || path.parse(this.inputPath).name | ||
const targetLength = collections.epub.length.toString().length | ||
const sequence = index.toString().padStart(targetLength, 0) | ||
epubContent = layout({ body: body.outerHTML, language, title }) | ||
const serializer = new window.XMLSerializer() | ||
const xml = slugifyIds(serializer.serializeToString(body)) | ||
epubContent = layout({ body: xml, language, title }) | ||
const filename = `${sequence}_${name}.xhtml` | ||
readingOrder.push(filename) | ||
const item = { | ||
url: filename, | ||
encodingFormat: 'application/xhtml+xml' | ||
} | ||
switch (page.data.layout) { | ||
case 'table-of-contents': | ||
item.rel = 'contents' | ||
break | ||
case 'cover': | ||
item.rel = 'cover' | ||
break | ||
} | ||
readingOrder.push(item) | ||
write(filename, epubContent) | ||
@@ -76,0 +109,0 @@ } |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
@@ -3,0 +3,0 @@ const path = require('path') |
@@ -12,2 +12,3 @@ const filterOutputs = require('../filter.js') | ||
module.exports = function(eleventyConfig, collections, content) { | ||
const slugifyIds = eleventyConfig.getFilter('slugifyIds') | ||
/** | ||
@@ -30,3 +31,3 @@ * Remove pages excluded from this output type | ||
registerWebComponents(dom) | ||
content = dom.serialize() | ||
content = slugifyIds(dom.serialize()) | ||
} | ||
@@ -33,0 +34,0 @@ |
const jsdom = require('jsdom') | ||
const filterOutputs = require('../filter.js') | ||
const truncate = require('~lib/truncate') | ||
const truncate = require('#lib/truncate') | ||
const writer = require('./write') | ||
@@ -84,3 +84,3 @@ | ||
// set an id for anchor links to each section | ||
sectionElement.setAttribute('id', mainElement.getAttribute('id')) | ||
sectionElement.setAttribute('id', mainElement.dataset.pageId) | ||
@@ -97,3 +97,3 @@ // transform relative links to anchor links | ||
* Once this transform has been called for each PDF page | ||
* every item in the collection will have `sectionConent` | ||
* every item in the collection will have `sectionContent` | ||
*/ | ||
@@ -100,0 +100,0 @@ if (collections.pdf.every(({ sectionElement }) => !!sectionElement)) { |
@@ -1,2 +0,2 @@ | ||
const chalkFactory = require('~lib/chalk') | ||
const chalkFactory = require('#lib/chalk') | ||
const fs = require('fs-extra') | ||
@@ -14,2 +14,3 @@ const jsdom = require('jsdom') | ||
module.exports = (eleventyConfig) => { | ||
const slugifyIds = eleventyConfig.getFilter('slugifyIds') | ||
const { input, output } = eleventyConfig.dir | ||
@@ -47,2 +48,5 @@ const { JSDOM } = jsdom | ||
/** | ||
* Rewrite image src attributes to be relative | ||
*/ | ||
document.querySelectorAll('[src]').forEach((asset) => { | ||
@@ -53,4 +57,11 @@ const src = asset.getAttribute('src') | ||
document.querySelectorAll('[style*="background-image"]').forEach((element) => { | ||
const backgroundImageUrl = element.style.backgroundImage.match(/[\(](.*)[\)]/)[1] || '' | ||
element.style.backgroundImage = `url('${trimLeadingSlash(backgroundImageUrl)}')` | ||
}) | ||
const content = slugifyIds(dom.serialize()) | ||
try { | ||
fs.writeFileSync(outputPath, dom.serialize()) | ||
fs.writeFileSync(outputPath, content) | ||
} catch (error) { | ||
@@ -57,0 +68,0 @@ logger.error(`Eleventy transform for PDF error writing combined HTML output for PDF. ${error}`) |
@@ -1,2 +0,2 @@ | ||
const { html } = require('~lib/common-tags') | ||
const { html } = require('#lib/common-tags') | ||
const fs = require('fs-extra') | ||
@@ -8,5 +8,4 @@ const jsdom = require('jsdom') | ||
/** | ||
* Iterate over output files `epub.js`, html.js`, `pdf.js`, and `print.js`; | ||
* initialize with `eleventyConfig` and render each with the `data-outputs-include` | ||
* attribute | ||
* Iterate over output files and render with a `data` attribute | ||
* that allows tranforms to filter elements from output formats. | ||
*/ | ||
@@ -18,5 +17,3 @@ module.exports = function (eleventyConfig, dir, params, page) { | ||
const filePath = path.join(dir, output) | ||
return (!fs.existsSync(`${filePath}.js`)) | ||
? [] | ||
: filePath | ||
return (!fs.existsSync(`${filePath}.js`)) ? [] : filePath | ||
}) | ||
@@ -23,0 +20,0 @@ |
@@ -1,3 +0,1 @@ | ||
require('module-alias/register') | ||
const copy = require('rollup-plugin-copy') | ||
@@ -17,20 +15,20 @@ const fs = require('fs-extra') | ||
const EleventyVitePlugin = require('@11ty/eleventy-plugin-vite') | ||
const citationsPlugin = require('~plugins/citations') | ||
const collectionsPlugin = require('~plugins/collections') | ||
const componentsPlugin = require('~plugins/components') | ||
const dataExtensionsPlugin = require('~plugins/dataExtensions') | ||
const citationsPlugin = require('#plugins/citations') | ||
const collectionsPlugin = require('#plugins/collections') | ||
const componentsPlugin = require('#plugins/components') | ||
const dataExtensionsPlugin = require('#plugins/dataExtensions') | ||
const directoryOutputPlugin = require('@11ty/eleventy-plugin-directory-output') | ||
const figuresPlugin = require('~plugins/figures') | ||
const filtersPlugin = require('~plugins/filters') | ||
const frontmatterPlugin = require('~plugins/frontmatter') | ||
const globalDataPlugin = require('~plugins/globalData') | ||
const i18nPlugin = require('~plugins/i18n') | ||
const lintersPlugin = require('~plugins/linters') | ||
const markdownPlugin = require('~plugins/markdown') | ||
const figuresPlugin = require('#plugins/figures') | ||
const filtersPlugin = require('#plugins/filters') | ||
const frontmatterPlugin = require('#plugins/frontmatter') | ||
const globalDataPlugin = require('#plugins/globalData') | ||
const i18nPlugin = require('#plugins/i18n') | ||
const lintersPlugin = require('#plugins/linters') | ||
const markdownPlugin = require('#plugins/markdown') | ||
const navigationPlugin = require('@11ty/eleventy-navigation') | ||
const pluginWebc = require('@11ty/eleventy-plugin-webc') | ||
const searchPlugin = require('~plugins/search') | ||
const shortcodesPlugin = require('~plugins/shortcodes') | ||
const searchPlugin = require('#plugins/search') | ||
const shortcodesPlugin = require('#plugins/shortcodes') | ||
const syntaxHighlightPlugin = require('@11ty/eleventy-plugin-syntaxhighlight') | ||
const transformsPlugin = require('~plugins/transforms') | ||
const transformsPlugin = require('#plugins/transforms') | ||
@@ -227,3 +225,14 @@ const inputDir = 'content' | ||
targets: [ | ||
{ src: 'public/*', dest: '_site' } | ||
{ | ||
src: 'public/*', | ||
dest: outputDir, | ||
}, | ||
{ | ||
src: path.join(inputDir, '_assets', 'images', '*'), | ||
dest: path.join(outputDir, '_assets', 'images') | ||
}, | ||
{ | ||
src: path.join(inputDir, '_assets', 'fonts', '*'), | ||
dest: path.join(outputDir, '_assets', 'fonts') | ||
} | ||
] | ||
@@ -230,0 +239,0 @@ }) |
{ | ||
"name": "@thegetty/quire-11ty", | ||
"version": "1.0.0-rc.0", | ||
"version": "1.0.0-rc.1", | ||
"description": "Quire 11ty static site generator", | ||
@@ -46,4 +46,11 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"bulma": "^0.9.3", | ||
"core-js": "2.5.0", | ||
"lit": "^2.6.1", | ||
"lunr": "^2.3.9", | ||
"template-polyfill": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"@11ty/eleventy": "^2.0.0-canary.18", | ||
"@11ty/eleventy": "^2.0.0-beta.1", | ||
"@11ty/eleventy-img": "^2.0.1", | ||
@@ -54,26 +61,26 @@ "@11ty/eleventy-navigation": "^0.3.5", | ||
"@11ty/eleventy-plugin-vite": "^2.0.0-canary.2", | ||
"@11ty/eleventy-plugin-webc": "^0.7.0", | ||
"@11ty/eleventy-plugin-webc": "^0.8.1", | ||
"@11ty/is-land": "^3.0.0", | ||
"@iiif/parser": "^1.1.0", | ||
"@iiif/vault": "^0.9.19", | ||
"camelize": "^1.0.0", | ||
"@iiif/vault": "^0.9.20", | ||
"camelize": "^1.0.1", | ||
"chalk": "^4.1.2", | ||
"common-tags": "^2.0.0-alpha.1", | ||
"cpy-cli": "^4.1.0", | ||
"cpy-cli": "^4.2.0", | ||
"cross-env": "^7.0.3", | ||
"del-cli": "^4.0.1", | ||
"eslint": "^8.28.0", | ||
"del-cli": "^5.0.0", | ||
"eslint": "^8.32.0", | ||
"exifr": "^7.1.3", | ||
"fs-extra": "^11.0.0", | ||
"fs-extra": "^11.1.0", | ||
"iiif-builder": "^1.0.6", | ||
"js-yaml": "^4.1.0", | ||
"jsdom": "^20.0.0", | ||
"json5": "^2.2.1", | ||
"jsdom": "^21.0.0", | ||
"json5": "^2.2.3", | ||
"liquid-args": "^1.0.0", | ||
"liquidjs": "^10.0.0", | ||
"liquidjs": "^10.4.0", | ||
"locale-en-us": "^0.0.2", | ||
"loglevel": "^1.8.0", | ||
"loglevel": "^1.8.1", | ||
"markdown-it": "^13.0.1", | ||
"markdown-it-anchor": "^8.6.4", | ||
"markdown-it-attrs": "^4.1.4", | ||
"markdown-it-anchor": "^8.6.6", | ||
"markdown-it-attrs": "^4.1.6", | ||
"markdown-it-bracketed-spans": "^1.0.1", | ||
@@ -83,5 +90,4 @@ "markdown-it-deflist": "^2.1.0", | ||
"mime-types": "^2.1.35", | ||
"module-alias": "^2.2.2", | ||
"path": "^0.12.7", | ||
"prettier": "^3.0.0-alpha.0", | ||
"prettier": "^3.0.0-alpha.4", | ||
"remove-markdown": "^0.5.0", | ||
@@ -91,19 +97,9 @@ "rollup-plugin-copy": "^3.4.0", | ||
"sass": "^1.54.5", | ||
"sharp": "^0.31.2", | ||
"sharp": "^0.31.3", | ||
"simple-cite": "^0.2.1", | ||
"toml": "^3.0.0" | ||
}, | ||
"dependencies": { | ||
"bulma": "^0.9.3", | ||
"core-js": "2.5.0", | ||
"lit": "^2.4.0", | ||
"lunr": "^2.3.9", | ||
"template-polyfill": "^2.0.0" | ||
}, | ||
"_moduleAliases": { | ||
"~includes": "./_includes", | ||
"~layouts": "./_layouts", | ||
"~lib": "./_lib", | ||
"~plugins": "./_plugins" | ||
"engines": { | ||
"node": ">=14.16" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Found 1 instance in 1 package
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
498011
43
216
13268
0
29
1
Updatedlit@^2.6.1