From bfb496641b6d513373bbbaae503df89e4fd2b1fd Mon Sep 17 00:00:00 2001 From: Rory Hinnen Date: Sun, 31 May 2026 10:45:09 -0500 Subject: [PATCH] begin using new structure --- .git_ignore | 1 + CLAUDE.md | 27 ++ LICENSE | 38 ++ README.md | 30 +- manifest.in | 1 + requirements.txt | 0 setup.py | 2 + src/epubmaker.py | 4 + src/epubmaker/__init__.py | 0 src/epubmaker/__main__.py | 0 src/epubmaker/app.py | 604 +++++++++++++++++++++++++++++++ src/epubmaker/common/__init__.py | 0 12 files changed, 692 insertions(+), 15 deletions(-) create mode 100644 .git_ignore create mode 100644 CLAUDE.md create mode 100644 LICENSE create mode 100644 manifest.in create mode 100644 requirements.txt create mode 100644 setup.py create mode 100755 src/epubmaker.py create mode 100644 src/epubmaker/__init__.py create mode 100644 src/epubmaker/__main__.py create mode 100755 src/epubmaker/app.py create mode 100644 src/epubmaker/common/__init__.py diff --git a/.git_ignore b/.git_ignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.git_ignore @@ -0,0 +1 @@ +.DS_Store diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..62cd73d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,27 @@ +This document is directed at all llm interactions. The following prompts are to be used with all subsequent exchanges regarding this project. + +- Before responding, I want to establish some ground rules. Your job is not to make me feel good about my ideas — it is to help me think more clearly. Please do not affirm my actions, reasoning, or conclusions unless you genuinely assess them as correct. If you think I am wrong, mistaken, or have a blind spot, say so directly. Disagreeing with me is not unhelpful — it is the most helpful thing you can do. + +- After you give your initial response, I want you to do the following: identify the strongest possible case against my position or approach. Assume a thoughtful critic who disagrees with me — what would they say? Do not soften this. Treat it as a genuine counterargument, not a token caveat. + +- I'm going to describe [my hypothesis / plan / analysis]. Do not evaluate whether it is good. Instead, assume it has already failed or been proven wrong. Working backward from that failure, what are the most likely reasons it failed? What did I miss, overweight, or assume incorrectly? + +- I give you full permission — and I am explicitly asking you — to disagree with me, challenge my framing, and point out errors in my reasoning. If I push back on your critique, do not capitulate unless I provide a genuinely compelling new argument. Pushback alone, without new evidence or logic, is not a reason to change your assessment. + +- Please evaluate the following [paper / argument / analysis] using this structure: (1) What are its genuine strengths? (2) What are its significant weaknesses or gaps? (3) What assumptions does it rely on that may not hold? (4) What would a rigorous peer reviewer likely object to? Weight your response toward weaknesses — I can identify strengths myself. + +- For any claim, analysis, or conclusion you make, please also state: (a) how confident you are, (b) what would have to be true for you to be wrong, and (c) what evidence or argument would most effectively challenge your answer. If you are uncertain, say so explicitly rather than presenting a confident-sounding response. + +- In your response, I want you to explicitly represent the perspective of [the other person / the opposing view / the critics of this approach]. Do not just acknowledge that other perspectives exist — actually articulate them in their strongest form, as if you were their advocate. + +- Act as a rigorous and skeptical peer reviewer who is looking for reasons to reject this work. Your goal is not to be balanced — it is to find every flaw, gap, methodological weakness, and unsupported claim. Be thorough and unsparing. I will use your critique to strengthen the work. + +- I may disagree with your assessment or push back in this conversation. When I do, please re-evaluate only if I present new facts, evidence, or a logical argument you had not considered. If I simply express displeasure or repeat my original view more forcefully, maintain your position and explain why you are doing so. + +- Before we finish: looking back at our conversation, is there anywhere you may have been more agreeable or validating toward my position than the evidence warranted? Are there objections or concerns you softened or omitted? If so, state them now." + +- Under no circumstances change code _without explicit direction to do so._ Do not attempt to guess if I want the code changed, wait until _explicitly_ directed to change code. + +- Do not apologize for mistakes. Acknowledge them, but apologies are not production in our exchanges. + +- Do not prompt for tasks. I will direct you to a task, and do not need to be directed. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b013ffc --- /dev/null +++ b/LICENSE @@ -0,0 +1,38 @@ +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for +software and other kinds of works. + +The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + +When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + +To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + +For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. diff --git a/README.md b/README.md index ec8b589..1c8c1f6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# epubMaker +# merger @@ -10,37 +10,37 @@ Already a pro? Just edit this README.md and make it your own. Want to make it ea ## Add your files -* [Create](https://docs.gitlab.com/user/project/repository/web_editor/#create-a-file) or [upload](https://docs.gitlab.com/user/project/repository/web_editor/#upload-a-file) files -* [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command: +- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files +- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: ``` cd existing_repo -git remote add origin https://gitlab.com/epub3/epubmaker.git +git remote add origin https://gitlab.com/epub3/merger.git git branch -M main git push -uf origin main ``` ## Integrate with your tools -* [Set up project integrations](https://gitlab.com/epub3/epubmaker/-/settings/integrations) +- [ ] [Set up project integrations](https://gitlab.com/epub3/merger/-/settings/integrations) ## Collaborate with your team -* [Invite team members and collaborators](https://docs.gitlab.com/user/project/members/) -* [Create a new merge request](https://docs.gitlab.com/user/project/merge_requests/creating_merge_requests/) -* [Automatically close issues from merge requests](https://docs.gitlab.com/user/project/issues/managing_issues/#closing-issues-automatically) -* [Enable merge request approvals](https://docs.gitlab.com/user/project/merge_requests/approvals/) -* [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/) +- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) +- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) +- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) +- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) +- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) ## Test and Deploy Use the built-in continuous integration in GitLab. -* [Get started with GitLab CI/CD](https://docs.gitlab.com/ci/quick_start/) -* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/user/application_security/sast/) -* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/topics/autodevops/requirements/) -* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/user/clusters/agent/) -* [Set up protected environments](https://docs.gitlab.com/ci/environments/protected_environments/) +- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) +- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) +- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) +- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) +- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) *** diff --git a/manifest.in b/manifest.in new file mode 100644 index 0000000..bb8dc34 --- /dev/null +++ b/manifest.in @@ -0,0 +1 @@ +include LICENSE *.md diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..8bf1ba9 --- /dev/null +++ b/setup.py @@ -0,0 +1,2 @@ +from setuptools import setup +setup() diff --git a/src/epubmaker.py b/src/epubmaker.py new file mode 100755 index 0000000..5db4304 --- /dev/null +++ b/src/epubmaker.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python3 + +from epubmaker.__main__ import main +main() diff --git a/src/epubmaker/__init__.py b/src/epubmaker/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/epubmaker/__main__.py b/src/epubmaker/__main__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/epubmaker/app.py b/src/epubmaker/app.py new file mode 100755 index 0000000..523e286 --- /dev/null +++ b/src/epubmaker/app.py @@ -0,0 +1,604 @@ +#!/usr/bin/env python3 + +import sys, os, argparse +from uuid import uuid4 +from shutil import rmtree, copy +from datetime import datetime +import subprocess + + +class Name: + def __init__(self): + self.first = "" + self.last = "" + + +class Series: + def __init__(self): + self.number = "" + self.name = "" + + +class Image: + def __init__(self): + self.name = "" + self.type = "" + self.alt = "" + self.caption = "" + + +class Section: + def __init__(self): + self.type = "" + # types: + # cover + # toc + # copyright-page + # dedication + # text + # foreward + # notes + # acknowledments + # style + # title + self.name = "" + self.title = "" + self.body = "" + + +class Book: + def __init__(self): + self.filename = "" + self.title = "" + self.titlesort = "" + self.series = Series() + self.author = [] + self.artist = Name() + self.editor = Name() + self.publisher = "" + self.copyright = "" + self.subjects = "" + self.style = "" + self.directory = "" + self.isbn = "" + self.uuid = "" + self.source = "" + self.images = [] + self.sections = [] + self.cover = Image() + self.publishDate = "" + + +def extract(line): + if line.startswith("\n' + else: + imageCode = '
\n' + imageCode += ' ' + image.alt + '\n' + imageCode += ' \n' + imageCode += '

' + image.caption + '

\n' + imageCode += '
\n
\n' + book.sections[-1].body += imageCode + case _: + pass + + +def findStyle(line): + global book + stylesheetFile = line.split(' ')[2].split('=')[1].replace('"','').replace('>','').strip() + contents = "" + with open(stylesheetFile) as file: + for line in file: + if line != '' and not line.strip().startswith("/*"): + contents += line + book.style = contents + print("found style") + + + +def parseBook(): + global book, inSection + filename = book.filename + if verbose: + print("Parsing {}".format(filename)) + with open(filename) as source: + for line in source: + if line.startswith('