0.8
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Assemble only explicitly ordered manuscript sections into 09_outputs/article.md."""
|
||||
from pathlib import Path
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
section_dir=ROOT/'07_manuscript/sections'
|
||||
order=section_dir/'order.txt'
|
||||
if not order.is_file(): raise SystemExit('Missing sections/order.txt')
|
||||
names=[s.strip() for s in order.read_text(encoding='utf-8').splitlines()
|
||||
if s.strip() and not s.lstrip().startswith('#')]
|
||||
if not names:
|
||||
print('No sections listed; edit 07_manuscript/sections/order.txt first.')
|
||||
raise SystemExit(0)
|
||||
parts=[]
|
||||
for name in names:
|
||||
if not name.endswith('.md') or Path(name).name != name:
|
||||
raise SystemExit('Invalid section basename: '+name)
|
||||
file=section_dir/name
|
||||
if not file.is_file(): raise SystemExit('Missing ordered section: '+name)
|
||||
parts.append(file.read_text(encoding='utf-8').strip())
|
||||
out=ROOT/'09_outputs/article.md'
|
||||
out.parent.mkdir(parents=True,exist_ok=True)
|
||||
out.write_text('\n\n---\n\n'.join(parts)+'\n',encoding='utf-8')
|
||||
print(f'Assembled {len(parts)} sections to {out.relative_to(ROOT)}')
|
||||
print('NOTE: Source citations, factual assertions and submission formatting require manual review.')
|
||||
Reference in New Issue
Block a user