Advance native LaTeX execution and preview
This commit is contained in:
1 parent
91f9d76b16
commit
2741546ca8
414 files changed
+99872
-933
No files matched your search
@@ -0,0 +1,51 @@
|
||||
//! Marks and adjustments which migrate into the enclosing vertical list.
|
||||
use super::*;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct NativeMark {
|
||||
pub class: u16,
|
||||
pub tokens: Arc<[Token]>,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct NativeAdjustment {
|
||||
pub pre: bool,
|
||||
pub nodes: Vec<NativeVerticalNode>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct SplitMarks {
|
||||
pub first: Arc<[Token]>,
|
||||
pub bottom: Arc<[Token]>,
|
||||
}
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)]
|
||||
pub struct PageMarks {
|
||||
pub top: Option<Arc<[Token]>>,
|
||||
pub first: Option<Arc<[Token]>>,
|
||||
pub bottom: Option<Arc<[Token]>>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub(super) struct MigratingMaterial {
|
||||
pub pre: Vec<NativeVerticalNode>,
|
||||
pub post: Vec<NativeVerticalNode>,
|
||||
}
|
||||
|
||||
/// Only top-level adjustment and mark nodes migrate during hpack. A packed
|
||||
/// child remains an owner until it is explicitly unboxed.
|
||||
pub(super) fn extract(nodes: Vec<TextNode>) -> (Vec<TextNode>, MigratingMaterial) {
|
||||
let mut content = Vec::with_capacity(nodes.len());
|
||||
let mut adjustments = MigratingMaterial::default();
|
||||
for node in nodes {
|
||||
match node {
|
||||
TextNode::Mark(mark) => adjustments.post.push(NativeVerticalNode::Mark(mark)),
|
||||
TextNode::Insertion(n) => adjustments.post.push(NativeVerticalNode::Insertion(n)),
|
||||
TextNode::Adjustment(value) if value.pre => adjustments.pre.extend(value.nodes),
|
||||
TextNode::Adjustment(value) => adjustments.post.extend(value.nodes),
|
||||
other => content.push(other),
|
||||
}
|
||||
}
|
||||
(content, adjustments)
|
||||
}
|
||||
Reference in new issue
Block a user