summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-07-02 19:29:05 +0300
committerLars Wirzenius <liw@liw.fi>2023-07-02 19:29:05 +0300
commitb98e4e25c1ad67381f58432f8b29279a9e7dcb04 (patch)
treed3cda2105363a76d5ca0841763a946aff2b0837d
parente5e0a4a3cb035bf0bace9487a182478f4fff20d0 (diff)
downloadsubplot-b98e4e25c1ad67381f58432f8b29279a9e7dcb04.tar.gz
feat! drop support for bibliographies in document metadata
We don't use the bibliographies for anything so there's not point in allowing users to specify it. If and when we add support for bibliographies again, we may well want to do it in a different way. Alas, we also have to disable reference.md because the release it refers to uses bibliographies. We'll have to re-enable it again after the next release. Sponsored-by: author
-rw-r--r--reference.subplot.disabled (renamed from reference.subplot)0
-rw-r--r--src/bin/cli/mod.rs10
-rw-r--r--src/doc.rs4
-rw-r--r--src/metadata.rs26
-rw-r--r--subplot.md31
5 files changed, 0 insertions, 71 deletions
diff --git a/reference.subplot b/reference.subplot.disabled
index 4e3311c..4e3311c 100644
--- a/reference.subplot
+++ b/reference.subplot.disabled
diff --git a/src/bin/cli/mod.rs b/src/bin/cli/mod.rs
index 19e4fbf..30ad5f6 100644
--- a/src/bin/cli/mod.rs
+++ b/src/bin/cli/mod.rs
@@ -27,7 +27,6 @@ pub struct Metadata {
title: String,
binding_files: Vec<String>,
impls: HashMap<String, Vec<String>>,
- bibliographies: Vec<String>,
scenarios: Vec<String>,
files: Vec<String>,
}
@@ -64,13 +63,6 @@ impl TryFrom<&mut Document> for Metadata {
(template.to_string(), filenames)
})
.collect();
- let mut bibliographies: Vec<_> = doc
- .meta()
- .bibliographies()
- .into_iter()
- .map(|p| filename(Some(p)))
- .collect();
- bibliographies.sort_unstable();
let mut scenarios: Vec<_> = doc
.scenarios()?
.into_iter()
@@ -88,7 +80,6 @@ impl TryFrom<&mut Document> for Metadata {
title,
binding_files,
impls,
- bibliographies,
scenarios,
files,
})
@@ -109,7 +100,6 @@ impl Metadata {
for (template, filenames) in self.impls.iter() {
Self::write_list(filenames, &format!("functions[{template}]"));
}
- Self::write_list(&self.bibliographies, "bibliography");
Self::write_list(&self.files, "file");
Self::write_list(&self.scenarios, "scenario");
}
diff --git a/src/doc.rs b/src/doc.rs
index d417e1d..e448051 100644
--- a/src/doc.rs
+++ b/src/doc.rs
@@ -228,10 +228,6 @@ impl Document {
}
}
- for x in self.meta().bibliographies().iter() {
- names.push(PathBuf::from(x))
- }
-
for name in self.meta().markdown_filenames() {
names.push(name.into());
}
diff --git a/src/metadata.rs b/src/metadata.rs
index 263e13e..e3463b3 100644
--- a/src/metadata.rs
+++ b/src/metadata.rs
@@ -45,7 +45,6 @@ pub struct YamlMetadata {
authors: Option<Vec<String>>,
date: Option<String>,
classes: Option<Vec<String>>,
- bibliography: Option<Vec<PathBuf>>,
markdowns: Vec<PathBuf>,
bindings: Option<Vec<PathBuf>>,
documentclass: Option<String>,
@@ -100,11 +99,6 @@ impl YamlMetadata {
&self.impls
}
- /// Bibliographies.
- pub fn bibliographies(&self) -> Option<&[PathBuf]> {
- self.bibliography.as_deref()
- }
-
/// Classes..
pub fn classes(&self) -> Option<&[String]> {
self.classes.as_deref()
@@ -132,9 +126,6 @@ impls:
python:
- foo.py
- bar.py
-bibliography:
-- foo.bib
-- bar.bib
markdowns:
- test.md
bindings:
@@ -146,10 +137,6 @@ bindings:
assert_eq!(meta.title, "Foo Bar");
assert_eq!(meta.date.unwrap(), "today");
assert_eq!(meta.classes.unwrap(), &["json", "text"]);
- assert_eq!(
- meta.bibliography.unwrap(),
- &[path("foo.bib"), path("bar.bib")]
- );
assert_eq!(meta.markdowns, vec![Path::new("test.md")]);
assert_eq!(
meta.bindings.unwrap(),
@@ -178,7 +165,6 @@ pub struct Metadata {
bindings_filenames: Vec<PathBuf>,
bindings: Bindings,
impls: HashMap<String, DocumentImpl>,
- bibliographies: Vec<PathBuf>,
/// Extra class names which should be considered 'correct' for this document
classes: Vec<String>,
}
@@ -216,12 +202,6 @@ impl Metadata {
impls.insert(impl_name.to_string(), docimpl);
}
- let bibliographies = if let Some(v) = yaml.bibliographies() {
- v.iter().map(|s| s.to_path_buf()).collect()
- } else {
- vec![]
- };
-
let classes = if let Some(v) = yaml.classes() {
v.iter().map(|s| s.to_string()).collect()
} else {
@@ -237,7 +217,6 @@ impl Metadata {
bindings_filenames,
bindings,
impls,
- bibliographies,
classes,
};
trace!("metadata: {:#?}", meta);
@@ -295,11 +274,6 @@ impl Metadata {
&self.bindings
}
- /// Return the bibliographies.
- pub fn bibliographies(&self) -> Vec<&Path> {
- self.bibliographies.iter().map(|x| x.as_path()).collect()
- }
-
/// The classes which this document also claims are valid
pub fn classes(&self) -> impl Iterator<Item = &str> {
self.classes.iter().map(Deref::deref)
diff --git a/subplot.md b/subplot.md
index 269343b..4f1e92c 100644
--- a/subplot.md
+++ b/subplot.md
@@ -2621,8 +2621,6 @@ and file b.yaml
and file other.yaml
and file f.py
and file other.py
-and file foo.bib
-and file bar.bib
and file expected.json
and an installed subplot
when I run subplot metadata images.subplot
@@ -2631,8 +2629,6 @@ and stdout contains "source: b.yaml"
and stdout contains "source: other.yaml"
and stdout contains "source: f.py"
and stdout contains "source: other.py"
-and stdout contains "source: foo.bib"
-and stdout contains "source: bar.bib"
and stdout contains "source: image.gif"
and stdout contains "bindings: b.yaml"
and stdout contains "bindings: other.yaml"
@@ -2653,7 +2649,6 @@ impls:
python:
- f.py
- other.py
-bibliography: [foo.bib, bar.bib]
~~~
~~~{#images.md .file .markdown .numberLines}
@@ -2667,34 +2662,12 @@ bibliography: [foo.bib, bar.bib]
~~~{#other.py .file .python .numberLines}
~~~
-~~~{#foo.bib .file .numberLines}
-@book{foo2020,
- author = "James Random",
- title = "The Foo book",
- publisher = "The Internet",
- year = 2020,
- address = "World Wide Web",
-}
-~~~
-
-~~~{#bar.bib .file .numberLines}
-@book{foo2020,
- author = "James Random",
- title = "The Bar book",
- publisher = "The Internet",
- year = 2020,
- address = "World Wide Web",
-}
-~~~
-
~~~{#expected.json .file .json}
{
"title": "Document refers to external images",
"sources": [
"b.yaml",
- "bar.bib",
"f.py",
- "foo.bib",
"image.gif",
"images.md",
"images.subplot",
@@ -2711,10 +2684,6 @@ bibliography: [foo.bib, bar.bib]
"other.py"
]
},
- "bibliographies": [
- "bar.bib",
- "foo.bib"
- ],
"files": [],
"scenarios": []
}