Skip to content

Commit 8456df1

Browse files
authored
Merge pull request #1120 from rm-dr/toml-metadata
Added metadata in Tectonic.toml
2 parents c64e524 + 6a4351f commit 8456df1

File tree

3 files changed

+24
-36
lines changed

3 files changed

+24
-36
lines changed

crates/docmodel/src/document.rs

+10
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ pub struct Document {
4949
/// this will be a subdirectory of `src_dir` named `build`.
5050
build_dir: PathBuf,
5151

52+
/// Arbitrary document metadata.
53+
/// This has no effect on tectonic's build process.
54+
/// Rather, allows users to add easily-accessible information to their documents,
55+
/// which may be read by external tools.
56+
pub metadata: Option<toml::Value>,
57+
5258
/// The document name. This will be used to name build artifacts and the
5359
/// like, and so should be relatively filesystem-friendly. It does not
5460
/// need to be the same as the document title.
@@ -103,6 +109,7 @@ impl Document {
103109
build_dir: build_dir.into(),
104110
name: doc.doc.name,
105111
bundle_loc: doc.doc.bundle,
112+
metadata: doc.doc.metadata,
106113
outputs,
107114
})
108115
}
@@ -124,6 +131,7 @@ impl Document {
124131
doc: syntax::DocSection {
125132
name: self.name.clone(),
126133
bundle: self.bundle_loc.clone(),
134+
metadata: None,
127135
},
128136
outputs,
129137
};
@@ -288,6 +296,7 @@ impl Document {
288296
name,
289297
bundle_loc,
290298
outputs: crate::document::default_outputs(),
299+
metadata: None,
291300
})
292301
}
293302
}
@@ -329,6 +338,7 @@ mod syntax {
329338
pub struct DocSection {
330339
pub name: String,
331340
pub bundle: String,
341+
pub metadata: Option<toml::Value>,
332342
}
333343

334344
#[derive(Debug, Deserialize, Serialize)]

docs/src/ref/tectonic-toml.md

+14
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ the file are detailed below.
1717
name = <string> # the document name
1818
bundle = <url or filesystem path> # the source of the TeX bundle
1919

20+
# The doc.metadata table may contain arbitrary data.
21+
# It does not affect Tectonic in any way.
22+
[doc.metadata]
23+
pubish = false
24+
arr = [1, 2, [6, 7]]
25+
26+
27+
2028
[[output]] # one or more output specifications
2129
name = <string> # the output's name
2230
type = <"pdf"> # the output's type
@@ -51,6 +59,12 @@ or a directory of support files. This mode of operation is discouraged because
5159
it limits reproducibility. URLs with a `file:` protocol are also treated
5260
identically to filesystem paths.
5361

62+
### `doc.metadata`
63+
64+
Arbitrary metadata, not read by Tectonic. This table allows us to
65+
save parameters for external scripts without creating an extra file.
66+
67+
5468
### `output`
5569

5670
A list of dictionaries defining different outputs to be created from the

docs/src/v2cli/show.md

-36
This file was deleted.

0 commit comments

Comments
 (0)