This tool exports print-ready, XQuark-tagged MacRoman .txt files directly
from the Notion print run sheet and their WordPress posts. It replaces the old
copy/paste RTF workflow. Complete the one-time setup before
running the weekly print workflow.
-
In Notion, the batching script will execute on every story set to This Week, To Print, and Finaled & published.
-
Before starting a new batch, move any approved old exports into the layout folder or archive them elsewhere. Then delete the
OUTPUTfolder in Finder. This permanently removes the priorly generated.txtfiles, review report, andmanifest.json; do not delete it until those files are no longer needed. -
Open a new Terminal and run:
cd /Downloads/new-taggerThen run the batch with the paper's publication day in
DorDDformat:python3 main.py --publication-date 29
-
Read the output in Terminal or open
OUTPUT/review-report.txt. Resolve everything in Do manually and inspect any formatting/removal warnings. Verify each file’s section header, byline, lists, and removed correction or media content. -
Copy approved files into the layout folder. Files are named
<SECTION><lowercase slug><D-or-DD>.txt, for exampleNEWcampusvote29.txt. The supplied day is used for every filename in that batch; it does not come from Notion. Keepmanifest.jsonwhile working on this batch and never hand-edit it.
- No eligible rows: check all three Notion statuses, then rerun.
- Bad/missing WordPress URL: use the WordPress edit URL with
post=IDor a URL with?p=ID, fix it in Notion, and rerun. - Missing author, title, or print slug: fill in Notion's
Writer / TitleandSlug (Print)(WordPress authors are used only as a fallback), then rerun. - Malformed
Writer / Title: useName / Rolefor one author and separate multiple authors with commas:Name / Role, Name / Role. Do not useName/Roleor join author pairs with “and”; those stories appear under Do manually. - Slug collision / existing output from another story: give the stories distinct print slugs. During an active batch, do not delete or edit individual manifest entries to force an overwrite.
- Notion, WordPress, or network failure: check connectivity and rerun. A WordPress 401, 403, or 404 means the post is not public yet. Confirm the article has been published before re-running the script.
- Unsupported formatting: Finish that formatting manually.
In every case, correct the source data and rerun the batch or the one-URL command. The review report is regenerated on each run.
-
Use Python 3.10 or newer, then install the dependencies:
python3 -m pip install requests beautifulsoup4 Unidecode certifi
-
Create a local
.envfile in this folder (it is ignored by Git):NOTION_TOKEN=secret_...The Notion integration must have access to the configured view. Never commit or share the token. The non-secret view ID is committed in
notion-experiment/notion-view.json; update that file if the team changes Notion views. WordPress posts must be publicly readable; inaccessible posts are listed under Do manually.