Build structured journal front matter for sn-jnl

This commit is contained in:
gloamxun committed 2026-10-20 01:08:37 +08:00
1 parent 82542740e7
commit 466abd4ce6
10 files changed
+684 -7

No files matched your search

+34
View File
@@ -63,6 +63,25 @@ pub enum TitleStyle {
Article,
/// Preprint-style title block with rules, an undertitle, and author columns.
Preprint,
/// Journal-style title block: title, author/affiliation columns, abstract,
/// and keywords.
Journal,
}
/// One author block in a structured front matter.
#[derive(Clone, Default, PartialEq, Eq)]
pub struct AuthorBlock {
pub runs: Vec<Run>,
/// One-based affiliation indices attached to this author.
pub affiliations: Vec<usize>,
pub email: Option<String>,
}
/// One numbered affiliation in a structured front matter.
#[derive(Clone, Default, PartialEq, Eq)]
pub struct Affiliation {
pub index: usize,
pub runs: Vec<Run>,
}
#[derive(Clone, Debug, Default, PartialEq, Eq)]
@@ -88,6 +107,16 @@ pub struct DocumentModel {
pub title_style: TitleStyle,
/// Optional line printed under the title rules, e.g. "A Preprint".
pub undertitle: Option<String>,
/// Short title from `\title[short]{long}`.
pub short_title: Option<String>,
/// Structured author blocks from `\author` / `\affil` / `\email`.
pub authors: Vec<AuthorBlock>,
/// Numbered affiliations from `\affil[n]{...}`.
pub affiliations: Vec<Affiliation>,
/// Body of `\abstract{...}` captured for journal title blocks.
pub abstract_runs: Vec<Run>,
/// Body of `\keywords{...}` captured for journal title blocks.
pub keywords: Vec<Run>,
pub page: PageSize,
pub parindent: common::Scaled,
/// Base font size selected by the document class (10, 11, or 12pt).
@@ -120,6 +149,11 @@ impl Default for DocumentModel {
date: String::new(),
title_style: TitleStyle::default(),
undertitle: None,
short_title: None,
authors: Vec::new(),
affiliations: Vec::new(),
abstract_runs: Vec::new(),
keywords: Vec::new(),
page: PageSize::default(),
// article's default \parindent for 10/11pt text.
parindent: common::Scaled(17 * 65_536),