-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwrite.py
More file actions
58 lines (49 loc) · 2.16 KB
/
Copy pathwrite.py
File metadata and controls
58 lines (49 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""Stage 5 wrapper — generate the DITA tree from the signed-off CSV.
Run from the WinPython REPL after the once-per-session, by-hand chdir:
>>> import os; os.chdir(r"C:\\dev\\AAAC")
>>> exec(open(r"write.py").read())
Reads extract.dedupe.csv from the cwd and (re)builds DITA_OUT from
scratch (--clean). Common static pages come from .\\static (the
generator's cwd-relative default). --stub-wav stock.wav swaps every
.wav asset for the committed silent stub to slim the tree for
cross-system transit — drop the flag for a full-audio build. Publish to
a mapped drive, not a \\\\server\\share UNC path. Target-specific paths
and toggles live only in the Config block below.
"""
import os, sys, runpy
from pathlib import Path
ROOT = Path(r"C:\dev\AAAC")
PYLIB = ROOT / "scripts" / "pylib"
SCRIPTS = ROOT / "scripts"
SOURCE = ROOT / "source"
REPORTS = ROOT / "reports"
REPORTS.mkdir(exist_ok=True)
def cls():
os.system("cls")
for p in (PYLIB, SCRIPTS):
if str(p) not in sys.path:
sys.path.insert(0, str(p))
for mod in ("extract_to_csv", "introspect_pptx", "deduplicate_csv",
"generate_dita", "publish_html", "rehydrate_dita",
"snapshot_analysis_docs", "ingest_gram_images", "mock_pptx"):
sys.modules.pop(mod, None)
# ---- Config ----------------------------------------------------
WRITE = SCRIPTS / "generate_dita.py"
DITA_OUT = Path(r"Z:\dita")
# ----------------------------------------------------------------
sys.argv = [
str(WRITE),
"--csv", "extract.dedupe.csv",
"--out", str(DITA_OUT),
"--clean",
"--image-root", str(SOURCE),
"--stub-wav", "stock.wav",
# The source-provenance debug block is ON by default for now: each gram page
# carries a visible instructor-only block mapping its published week-N/gram-NN
# back to the source publication, source deck title and original gram number
# (plus the analysis image's source path) — so a published page (e.g. a
# missing analysis image) can be traced to the PPTX it came from. To turn it
# off once the debugging phase is over, uncomment the line below:
# "--no-debug-provenance",
]
runpy.run_path(str(WRITE), run_name="__main__")