|
18 | 18 | # Where to look for source Markdown files. |
19 | 19 | SOURCE_DIRS = ['', '_episodes', '_extras'] |
20 | 20 |
|
| 21 | +# Where to look for source Rmd files. |
| 22 | +SOURCE_RMD_DIRS = ['_episodes_rmd'] |
| 23 | + |
21 | 24 | # Required files: each entry is ('path': YAML_required). |
22 | 25 | # FIXME: We do not yet validate whether any files have the required |
23 | 26 | # YAML headers, but should in the future. |
@@ -108,6 +111,7 @@ def main(): |
108 | 111 | args = parse_args() |
109 | 112 | args.reporter = Reporter() |
110 | 113 | check_config(args.reporter, args.source_dir) |
| 114 | + check_source_rmd(args.reporter, args.source_dir, args.parser) |
111 | 115 | args.references = read_references(args.reporter, args.reference_path) |
112 | 116 |
|
113 | 117 | docs = read_all_markdown(args.source_dir, args.parser) |
@@ -184,6 +188,19 @@ def check_config(reporter, source_dir): |
184 | 188 | 'configuration', |
185 | 189 | '"root" not set to "." in configuration') |
186 | 190 |
|
| 191 | +def check_source_rmd(reporter, source_dir, parser): |
| 192 | + """Check that Rmd episode files include `source: Rmd`""" |
| 193 | + |
| 194 | + episode_rmd_dir = [os.path.join(source_dir, d) for d in SOURCE_RMD_DIRS] |
| 195 | + episode_rmd_files = [os.path.join(d, '*.Rmd') for d in episode_rmd_dir] |
| 196 | + results = {} |
| 197 | + for pat in episode_rmd_files: |
| 198 | + for f in glob.glob(pat): |
| 199 | + data = read_markdown(parser, f) |
| 200 | + dy = data['metadata'] |
| 201 | + if dy: |
| 202 | + reporter.check_field(f, 'episode_rmd', |
| 203 | + dy, 'source', 'Rmd') |
187 | 204 |
|
188 | 205 | def read_references(reporter, ref_path): |
189 | 206 | """Read shared file of reference links, returning dictionary of valid references |
|
0 commit comments