summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2020-06-20 10:56:41 +0000
committerDaniel Silverstone <dsilvers+gitlab@digital-scurf.org>2020-06-20 10:56:41 +0000
commit613eaaf82fbbbc96b05b19cc0c8bdbfec3a892ee (patch)
treea0d8e38dd1e7efd6495c22ce9c98d136126db705
parent57315de8a5d44b82da37474fe6ed6963a1f6be57 (diff)
parent4eaf5080ce8f2bbece3110b196c6e4fa83f4e0d7 (diff)
downloadsubplot-613eaaf82fbbbc96b05b19cc0c8bdbfec3a892ee.tar.gz
Merge branch 'metalist' into 'master'
feat(sp-meta): list names of embedded files in output See merge request larswirzenius/subplot!52
-rw-r--r--src/bin/sp-meta.rs8
-rw-r--r--subplot.md25
2 files changed, 33 insertions, 0 deletions
diff --git a/src/bin/sp-meta.rs b/src/bin/sp-meta.rs
index 49f6173..b693d26 100644
--- a/src/bin/sp-meta.rs
+++ b/src/bin/sp-meta.rs
@@ -45,6 +45,7 @@ struct Metadata {
function_files: Vec<String>,
bibliographies: Vec<String>,
scenarios: Vec<String>,
+ files: Vec<String>,
}
impl TryFrom<&mut Document> for Metadata {
@@ -79,6 +80,11 @@ impl TryFrom<&mut Document> for Metadata {
.into_iter()
.map(|s| s.title().to_owned())
.collect();
+ let files = doc
+ .files()
+ .iter()
+ .map(|f| f.filename().to_owned())
+ .collect();
Ok(Self {
sources,
title,
@@ -86,6 +92,7 @@ impl TryFrom<&mut Document> for Metadata {
function_files,
bibliographies,
scenarios,
+ files,
})
}
}
@@ -101,6 +108,7 @@ impl Metadata {
Self::write_list(&self.binding_files, "bindings");
Self::write_list(&self.function_files, "functions");
Self::write_list(&self.bibliographies, "bibliography");
+ Self::write_list(&self.files, "file");
Self::write_list(&self.scenarios, "scenario");
}
}
diff --git a/subplot.md b/subplot.md
index b99f397..d975e97 100644
--- a/subplot.md
+++ b/subplot.md
@@ -1609,6 +1609,7 @@ bibliography: [foo.bib, bar.bib]
"foo.bib",
"bar.bib"
],
+ "files": [],
"scenarios": []
}
~~~
@@ -1872,6 +1873,30 @@ then exit code is non-zero
```
+### List embedded files
+
+The `sp-meta` command lists embedded files in its output.
+
+~~~scenario
+given file two-embedded.md
+when I run sp-meta two-embedded.md
+then output matches /foo.txt/
+and output matches /bar.yaml/
+~~~
+
+~~~~~~{#two-embedded.md .file .markdown .numberLines}
+---
+title: Two embedded files
+...
+
+~~~{#foo.txt .file}
+~~~
+
+~~~{#bar.yaml. .file}
+~~~
+~~~~~~
+
+
## Embedded graphs
Subplot allows embedding markup to generate graphs into the Markdown document.