brain backup 2026-09-14

This commit is contained in:
Adolfo Reyna
2026-09-14 22:38:47 -04:00
parent ca346cc6e7
commit f0ead4f6fa
147 changed files with 73451 additions and 8 deletions
+91
View File
@@ -0,0 +1,91 @@
#!/usr/bin/env python3
"""Create the parent-review edition without altering the editorial source draft."""
from __future__ import annotations
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SOURCE = ROOT / "projects/covenant_parenting_bryan_hickman_revised.md"
OUTPUT = ROOT / "projects/covenant_parenting_bryan_hickman_parent_review.md"
BOOKS = (
"Genesis|Exodus|Leviticus|Numbers|Deuteronomy|Joshua|Judges|Ruth|"
"1 Samuel|2 Samuel|1 Kings|2 Kings|1 Chronicles|2 Chronicles|Ezra|Nehemiah|Esther|Job|"
"Psalms?|Proverbs|Ecclesiastes|Song of Solomon|Isaiah|Jeremiah|Lamentations|Ezekiel|Daniel|"
"Hosea|Joel|Amos|Obadiah|Jonah|Micah|Nahum|Habakkuk|Zephaniah|Haggai|Zechariah|Malachi|"
"Matthew|Mark|Luke|John|Acts|Romans|1 Corinthians|2 Corinthians|Galatians|Ephesians|Philippians|"
"Colossians|1 Thessalonians|2 Thessalonians|1 Timothy|2 Timothy|Titus|Philemon|Hebrews|James|"
"1 Peter|2 Peter|1 John|2 John|3 John|Jude|Revelation"
)
REFERENCE = re.compile(rf"\b(?:{BOOKS})\s+\d{{1,3}}:\d{{1,3}}(?:[–-]\d{{1,3}})?")
def mark_nkjv(match: re.Match[str]) -> str:
text = match.group(0)
return text + " (NKJV)"
def remove_opening_subheads(body: str) -> str:
"""Turn Chapter 1's labeled blocks into one natural, continuous reading."""
start = body.index("## Chapter 1:")
end = body.index("## Chapter 2:", start)
opening = body[start:end]
opening = re.sub(r"^### (?:The Ultimate Goal of Training|Jesus as the Ultimate Model|Building for Generations|Healing the Parents First)\n\n", "", opening, flags=re.M)
return body[:start] + opening + body[end:]
def relocate_workbook_sections(body: str) -> str:
"""Put each chapter's reflection material at that chapter's end, not in Chapter 6."""
start = body.index("## Chapter 6: The Covenant Parenting Workbook")
end = body.index("## The 30-Day Covenant Parenting Challenge Calendar", start)
workbook = body[start:end]
sections: dict[int, str] = {}
matches = list(re.finditer(r"^### Workbook — Chapter (\d) focus: .*?\n", workbook, flags=re.M))
for index, match in enumerate(matches):
next_start = matches[index + 1].start() if index + 1 < len(matches) else len(workbook)
chapter = int(match.group(1))
content = workbook[match.end():next_start]
content = re.sub(r"\n*---\s*$", "", content, flags=re.M).strip()
sections[chapter] = "### Reflection and Action\n\n" + content + "\n\n"
body = body[:start].rstrip() + "\n\n" + body[end:]
for chapter, section in sections.items():
chapter_start = body.index(f"## Chapter {chapter}:")
next_heading = re.search(r"^## ", body[chapter_start + 1:], flags=re.M)
next_chapter = chapter_start + 1 + next_heading.start() if next_heading else len(body)
body = body[:next_chapter].rstrip() + "\n\n" + section + body[next_chapter:]
return body
def add_images(body: str) -> str:
"""Place content illustrations at the two marked transition points."""
first = "The pages that follow develop these convictions through the realities of family life: how parents model the Father, how a home learns to respond to conflict, how husband and wife protect the atmosphere of the household, how families guard the influences shaping their children, how ordinary work and presence become part of discipleship, and how parents can rebuild trust when they are beginning late or carrying a complicated history. The final reflections and exercises are meant to move these ideas out of the abstract and into conversations, prayers, decisions, and small daily practices. Covenant parenting is not a checklist that proves we are doing everything right. It is a living relationship, walked out before the Lord and before our children, one faithful response at a time."
body = body.replace(first, first, 1)
first_chapter_anchor = "Our target is to have children who seamlessly step into a personal relationship with their heavenly Father, and in that place find their Kingdom identity and faithfully walk out their Kingdom purpose in this generation. [7]"
body = body.replace(first_chapter_anchor, first_chapter_anchor + "\n\n![The covenant parenting pathway](assets/covenant-parenting-pathway.svg)", 1)
second = "There is extraordinary, transformative power when a parent is willing to be authentic and humble before their children [166]. It models a soft, teachable heart and teaches children how to walk out repentance in their own lives [166]."
body = body.replace(second, second + "\n\n![A family rhythm of humility, repair, and peace](assets/family-rhythm-of-repair.svg)", 1)
return body
def main() -> None:
text = SOURCE.read_text(encoding="utf-8")
front, body = text.split("---\n", 2)[1:]
front = re.sub(r'title: .*', 'title: "The Pattern of Covenant Parenting — Parent Review Edition"', front)
front = re.sub(r'status: .*', 'status: parent-review-edition', front)
front = re.sub(r' - editorial-review\n', ' - parent-review\n', front)
body = body[body.index("<!-- EDITORIAL COMMENT: Chapter 0"):]
body = body.replace("Parenting is often", "## Chapter 0: Introduction\n\nParenting is often", 1)
body = "<!-- KEEP_PARENT_OPENING -->\n" + body
body = re.sub(r"^## Introduction\n\n", "", body, count=1, flags=re.M)
body = remove_opening_subheads(body)
body = relocate_workbook_sections(body)
body = add_images(body)
body = REFERENCE.sub(mark_nkjv, body)
body = re.sub(r"\s+\(NKJV\)\s+\(NKJV\)", " (NKJV)", body)
OUTPUT.write_text("---\n" + front.strip() + "\n---\n\n" + body.lstrip(), encoding="utf-8")
print(OUTPUT)
if __name__ == "__main__":
main()