diff --git a/.changeset/clever-days-do.md b/.changeset/clever-days-do.md new file mode 100644 index 000000000..d373b7731 --- /dev/null +++ b/.changeset/clever-days-do.md @@ -0,0 +1,5 @@ +--- +'myst-to-jats': patch +--- + +Add alt-title to JATS (as running-head) diff --git a/.changeset/plenty-planets-think.md b/.changeset/plenty-planets-think.md new file mode 100644 index 000000000..6de538c1c --- /dev/null +++ b/.changeset/plenty-planets-think.md @@ -0,0 +1,5 @@ +--- +'myst-frontmatter': patch +--- + +Remove restriction on short_title length from validation. diff --git a/packages/myst-frontmatter/src/frontmatter/validators.ts b/packages/myst-frontmatter/src/frontmatter/validators.ts index fb114e02e..e238800f0 100644 --- a/packages/myst-frontmatter/src/frontmatter/validators.ts +++ b/packages/myst-frontmatter/src/frontmatter/validators.ts @@ -1049,10 +1049,7 @@ export function validateSiteFrontmatterKeys(value: Record, opts: Va output.description = validateString(value.description, incrementOptions('description', opts)); } if (defined(value.short_title)) { - output.short_title = validateString(value.short_title, { - ...incrementOptions('short_title', opts), - maxLength: 40, - }); + output.short_title = validateString(value.short_title, incrementOptions('short_title', opts)); } if (defined(value.subtitle)) { output.subtitle = validateString(value.subtitle, incrementOptions('subtitle', opts)); diff --git a/packages/myst-to-jats/src/frontmatter.ts b/packages/myst-to-jats/src/frontmatter.ts index 10fd9ada9..9cf9730b9 100644 --- a/packages/myst-to-jats/src/frontmatter.ts +++ b/packages/myst-to-jats/src/frontmatter.ts @@ -61,7 +61,8 @@ export function getJournalMeta(): Element | null { export function getArticleTitle(frontmatter: ProjectFrontmatter): Element[] { const title = frontmatter?.title; const subtitle = frontmatter?.subtitle; - if (!title && !subtitle) return []; + const short_title = frontmatter?.short_title; + if (!title && !subtitle && !short_title) return []; const articleTitle: Element[] = [ { type: 'element', @@ -78,11 +79,21 @@ export function getArticleTitle(frontmatter: ProjectFrontmatter): Element[] { }, ] : []; + const articleShortTitle: Element[] = short_title + ? [ + { + type: 'element', + name: 'alt-title', + attributes: { 'alt-title-type': 'running-head' }, + elements: [{ type: 'text', text: short_title }], + }, + ] + : []; return [ { type: 'element', name: 'title-group', - elements: [...articleTitle, ...articleSubtitle], + elements: [...articleTitle, ...articleSubtitle, ...articleShortTitle], }, ]; }