Preserve inline emphasis in preprint title runs

This commit is contained in:
gloamxun committed 2026-10-19 17:12:23 +08:00
1 parent d211889e93
commit 1da9e0dde9
5 files changed
+26 -7

No files matched your search

+3
View File
@@ -80,6 +80,8 @@ pub struct Footnote {
#[derive(Clone)]
pub struct DocumentModel {
pub title: String,
/// Rich title runs, preserving inline emphases such as .
pub title_runs: Vec<Run>,
pub author: String,
pub date: String,
/// Style selected by the document's class/package layer.
@@ -107,6 +109,7 @@ impl Default for DocumentModel {
fn default() -> Self {
Self {
title: String::new(),
title_runs: Vec::new(),
author: String::new(),
date: String::new(),
title_style: TitleStyle::default(),
+5 -2
View File
@@ -725,9 +725,12 @@ impl Parser {
self.metadata_capture = Some((active_field, runs));
return;
}
let value = runs.into_iter().map(|run| run.text).collect::<String>();
let value = runs.iter().map(|run| run.text.clone()).collect::<String>();
match field {
expanded::MetadataField::Title => self.document.title = value,
expanded::MetadataField::Title => {
self.document.title = value;
self.document.title_runs = runs;
}
expanded::MetadataField::Author => self.document.author = value,
expanded::MetadataField::Date => self.document.date = value,
}