summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2023-07-10 18:47:46 +0000
committerDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2023-07-10 18:47:46 +0000
commit7bb4e0f3bc05315c90f6d89552aa13658250e118 (patch)
tree36f87fc7904e1339fb6d0ebd3985098aea43da3d
parent38e985bb506235832d2de358fe93834139f2db30 (diff)
parentb98e4e25c1ad67381f58432f8b29279a9e7dcb04 (diff)
downloadsubplot-7bb4e0f3bc05315c90f6d89552aa13658250e118.tar.gz
Merge branch 'liw/unbib' into 'main'
feat! drop support for bibliographies in document metadata Closes #326 See merge request subplot/subplot!346
-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 f2fee6d..06e9e38 100644
--- a/subplot.md
+++ b/subplot.md
@@ -2644,8 +2644,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
@@ -2654,8 +2652,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"
@@ -2676,7 +2672,6 @@ impls:
python:
- f.py
- other.py
-bibliography: [foo.bib, bar.bib]
~~~
~~~{#images.md .file .markdown .numberLines}
@@ -2690,34 +2685,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",
@@ -2734,10 +2707,6 @@ bibliography: [foo.bib, bar.bib]
"other.py"
]
},
- "bibliographies": [
- "bar.bib",
- "foo.bib"
- ],
"files": [],
"scenarios": []
}