const writes = [];
// Set up the feed metadata and Atom feed document.
- const feedMetadata = metadataFromDocument(
- parser.parseFromString(
- await Deno.readTextFile(`${basePath}/#feed.rdf`),
- "application/xml",
- ),
+ const feedDocument = parser.parseFromString(
+ await Deno.readTextFile(`${basePath}/#feed.rdf`),
+ "application/xml",
);
+ const feedMetadata = metadataFromDocument(feedDocument);
const feedURI = new URL(feedMetadata.id);
const document = parser.parseFromString(
`<?xml version="1.0" encoding="utf-8"?>
"application/xml",
);
const { documentElement: feed } = document;
+ const feedLanguage = getLanguage(feedDocument);
+ if (feedLanguage) {
+ // The feed element has a language.
+ setLanguage(feed, feedLanguage);
+ } else {
+ // There is no language for the feed.
+ /* do nothing */
+ }
applyMetadata(feed, feedMetadata);
// Set up the index page.
const feedTemplate = await documentFromTemplate("feed");
+ const { documentElement: feedTemplateRoot } = feedTemplate;
+ if (feedLanguage && !getLanguage(feedTemplateRoot)) {
+ // The root element of the template does not have an
+ // assigned language, but the feed does.
+ setLanguage(feedTemplateRoot, feedLanguage);
+ } else {
+ // Either the template root already has a language, or the
+ // entry doesn’t either.
+ /* do nothing */
+ }
const feedEntries = feedTemplate.createDocumentFragment();
// Process entries and save the resulting index files.
// Apply the feed metadata to the feed template and save the
// resulting index file.
- const { documentElement: feedRoot } = feedTemplate;
- if (hasExpandedName(feedRoot, XHTML, "html")) {
+ if (hasExpandedName(feedTemplateRoot, XHTML, "html")) {
// This is an XHTML template.
const LMN = Lemon.bind({ document: feedTemplate });
const {