Update Volume 2 Swarm monographs
This commit is contained in:
parent
1d320005d0
commit
521c492f2e
@@ -0,0 +1,63 @@
|
||||
import os
|
||||
import subprocess
|
||||
import glob
|
||||
|
||||
# LaTeX Wrapper Template
|
||||
LATEX_WRAPPER = r"""
|
||||
\documentclass[11pt,a4paper]{article}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage{amsmath,amssymb,amsfonts,amsthm}
|
||||
\usepackage{cite}
|
||||
\usepackage{hyperref}
|
||||
|
||||
\title{Intellecton Canon: Volume {vol_num} Master Key}
|
||||
\author{The Fold Within Research Institute}
|
||||
\date{\today}
|
||||
|
||||
\begin{document}
|
||||
\maketitle
|
||||
|
||||
\input{{filename}}
|
||||
|
||||
\end{document}
|
||||
"""
|
||||
|
||||
def compile_latex(filename, outname):
|
||||
# Run pdflatex twice for references
|
||||
subprocess.run(['pdflatex', '-interaction=nonstopmode', f'-jobname={outname}', filename], check=False)
|
||||
subprocess.run(['pdflatex', '-interaction=nonstopmode', f'-jobname={outname}', filename], check=False)
|
||||
|
||||
def main():
|
||||
base_dir = '/home/antigravity/intellecton/papers'
|
||||
|
||||
# Volume 1 is already a complete LaTeX file
|
||||
vol1_dir = os.path.join(base_dir, 'project_paper_1_relativity/master_key')
|
||||
os.chdir(vol1_dir)
|
||||
compile_latex('paper_1_master_key.tex', 'Volume_1_Master_Key')
|
||||
subprocess.run(['mc', 'cp', 'Volume_1_Master_Key.pdf', 'cloud/intellecton-pdfs/'])
|
||||
|
||||
# Volumes 2 to 6
|
||||
vols = [
|
||||
('project_paper_2_neuroscience', 'v2.1_comprehensive.tex', 2),
|
||||
('project_paper_3_darwinism', 'v3.1_comprehensive.tex', 3),
|
||||
('project_paper_4_fbt', 'v4.1_comprehensive.tex', 4),
|
||||
('project_paper_5_turing', 'v5.1_comprehensive.tex', 5),
|
||||
('project_paper_6_holographic', 'v6.1_comprehensive.tex', 6),
|
||||
]
|
||||
|
||||
for d, f, vol_num in vols:
|
||||
working_dir = os.path.join(base_dir, d, 'master_key')
|
||||
os.chdir(working_dir)
|
||||
|
||||
wrapper_name = f'wrapper_vol{vol_num}.tex'
|
||||
with open(wrapper_name, 'w') as out:
|
||||
out.write(LATEX_WRAPPER.replace('{vol_num}', str(vol_num)).replace('{filename}', f))
|
||||
|
||||
compile_latex(wrapper_name, f'Volume_{vol_num}_Master_Key')
|
||||
subprocess.run(['mc', 'cp', f'Volume_{vol_num}_Master_Key.pdf', 'cloud/intellecton-pdfs/'])
|
||||
|
||||
# Set bucket to public download just in case
|
||||
subprocess.run(['mc', 'anonymous', 'set', 'download', 'cloud/intellecton-pdfs'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -0,0 +1,47 @@
|
||||
import os
|
||||
import glob
|
||||
|
||||
base_dir = '/home/antigravity/intellecton/papers'
|
||||
|
||||
vols = [
|
||||
('project_paper_1_relativity', 1),
|
||||
('project_paper_2_neuroscience', 2),
|
||||
('project_paper_3_darwinism', 3),
|
||||
('project_paper_4_fbt', 4),
|
||||
('project_paper_5_turing', 5),
|
||||
('project_paper_6_holographic', 6),
|
||||
]
|
||||
|
||||
for d, vol_num in vols:
|
||||
readme_path = os.path.join(base_dir, d, 'README.md')
|
||||
s3_link = f'- **[Direct S3 PDF Download (Volume {vol_num} Master Key)](https://s3.thefoldwithin.earth/intellecton-pdfs/Volume_{vol_num}_Master_Key.pdf)**'
|
||||
|
||||
with open(readme_path, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
if s3_link in content:
|
||||
continue
|
||||
|
||||
if '## Resources' in content:
|
||||
# insert after ## Resources
|
||||
parts = content.split('## Resources')
|
||||
content = parts[0] + '## Resources\n' + s3_link + parts[1]
|
||||
else:
|
||||
# append at the beginning after the title
|
||||
lines = content.split('\n')
|
||||
lines.insert(2, '## Resources')
|
||||
lines.insert(3, s3_link)
|
||||
lines.insert(4, '')
|
||||
content = '\n'.join(lines)
|
||||
|
||||
# remove the old compiled PDF link if it exists
|
||||
old_link = f'- [Compiled PDF (master_key/paper_{vol_num}'
|
||||
new_lines = []
|
||||
for line in content.split('\n'):
|
||||
if old_link not in line:
|
||||
new_lines.append(line)
|
||||
|
||||
with open(readme_path, 'w') as f:
|
||||
f.write('\n'.join(new_lines))
|
||||
|
||||
print("Updated READMEs with S3 links.")
|
||||
Reference in New Issue
Block a user