
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@teipublisher/pb-eleventy-plugin
Advanced tools
An eleventy plugin to embed a static copy of TEI files transformed via TEI Publisher
A plugin for 11ty to embed a static view of TEI/XML resources transformed via TEI Publisher. 11ty is a popular static site generator written in Javascript. The plugin communicates with TEI Publisher's API to take a snapshot of some or all TEI documents, i.e. it basically creates a static version of the website by pre-generating all content. It does so by traversing the site's content via TEI Publishers public API, transforming all documents via the associated ODDs and storing the output into the file system. The result is a website without dynamic content: neither eXist-db nor TEI Publisher are required.
Obviously the generated website will lack some of the functionality, which requires a database backend, in particular:
On the upside, the resulting HTML files can be hosted on any webserver at small or no cost (e.g. using github pages). A static site is thus a viable option for small editions with a strong focus on the text presentation and requiring less advanced features.
And the best: most TEI Publisher webcomponents can be used as on a dynamic website!
The plugin consists of 3 parts:
tpdocuments.pb-view. For every pb-view the transformer pre-loads the content of all pages which would be displayed by the component.{% tpfetch %}, to pre-fetch other static content needed on a page, e.g. for a table of contents.In your existing 11ty project, install the package via npm:
npm install --save @teipublisher/pb-eleventy-plugin
and add the plugin in your .eleventy.js:
const pluginTP = require('@teipublisher/pb-eleventy-plugin');
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(pluginTP, {
/* Base URL of the app to retrieve data from */
remote: 'http://localhost:8080/exist/apps/tei-publisher/',
/* Browse collection contents */
collections: false,
/* Use caching for document lists and resources fetched via tpfetch */
useCache: process.env['TP_NO_CACHE'] !== 'true',
/* For debugging: limit number of pages retrieved per document or null for unlimited */
limit: null,
/* Limit the number of concurrent requests sent to the server */
concurrency: 2,
/**
* Use this to add entries to the `tpdata` global data object. Data will be retrieved from the URL
* given as property value. It must return JSON. The result will be stored to the global data object under
* the properties name.
*/
data: {}
});
};
Known options are:
remote <string>: the base URL of the TEI Publisher app you would like to retrieve TEI documents from. This can also be a custom app generated by TEI Publisher.collections <boolean>: if set to true, the plugin will scan the document collections provided by the TEI Publisher instance and save the collection listings. It also adds all documents found to a global data object (teidocuments), which can be used later to automatically output a page for each document.useCache <boolean>: the plugin can cache some resources which would otherwise take a longer time to retrieve, e.g. the global list of documentslimit <number>: for testing: only retrieve the first X pages for each document. This will speed up the build time.concurrency <number>: limits the number of concurrent requests sent to the server.data <object>: downloads JSON data from the server and adds it to the global data object named tpdata. Data will be loaded from the URL given as value of each property. It should be in JSON format. The result will be stored to the global data object under the properties' name. For example, the following data definition will retrieve JSON data from api/people and you can later use it in templates via the variable tpdata.people:
data: {
"people": "api/people"
}
You can use any of TEI Publisher's webcomponents within a 11ty template. The transformer installed by the plugin will automatically detect the relevant components and pre-load the required data to make them work in a static environment. The only requirements to pay attention to are:
pb-view in the page should reference a pb-document in its @src attribute, which defines the basic parameters needed to process the document, i.e. the relative path to the document in @path, the @odd to be used for the transformation and the @view mode ('page', 'div', 'single'). The pb-view may also overwrite the @odd and @view attributes defined on the pb-document.@odd and @view need to correspond to the actual ODD and view mode being used by TEI Publisher when transforming the document. This means: if your document overwrites those settings via a processing instruction, fetching the content may not work.pb-view and pb-browse-docs requires an additional attribute @static to signal the component that it operates in static mode.<script type="module" src="https://cdn.jsdelivr.net/npm/@teipublisher/pb-components@latest/dist/pb-components-bundle.js"></script>
Have a look at the provided demo templates:
This repository contains a simple demo website to generate a static copy of the default TEI Publisher website. Before starting the build, you should have a default TEI Publisher instance running on port 8080 (or change the port in .eleventy.js accordingly).
npm install oncenpm starthttp://localhost:8081 by default)FAQs
An eleventy plugin to embed a static copy of TEI files transformed via TEI Publisher
The npm package @teipublisher/pb-eleventy-plugin receives a total of 19 weekly downloads. As such, @teipublisher/pb-eleventy-plugin popularity was classified as not popular.
We found that @teipublisher/pb-eleventy-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.