diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ea11afd
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.DS_Store
+*__pycache__/
diff --git a/src/epubmaker.py b/src/epubmaker.py
index 5db4304..e55ef2a 100755
--- a/src/epubmaker.py
+++ b/src/epubmaker.py
@@ -1,4 +1,6 @@
#!/usr/bin/env python3
-from epubmaker.__main__ import main
-main()
+from epubmaker.cli import main
+
+if __name__ == "__main__":
+ main()
diff --git a/src/epubmaker/__main__.py b/src/epubmaker/__main__.py
index 31c0da6..4e28416 100644
--- a/src/epubmaker/__main__.py
+++ b/src/epubmaker/__main__.py
@@ -1,603 +1,3 @@
-import sys, os, argparse
-from uuid import uuid4
-from shutil import rmtree, copy
-from datetime import datetime
-import subprocess
+from .cli import main
-
-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 += '

\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('\n'
- else:
- imageCode = '\n'
- imageCode += '

\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('\n'
+ else:
+ imageCode = '\n'
+ imageCode += '

\n'
+ imageCode += '
\n'
+ imageCode += '
' + image.caption + '
\n'
+ imageCode += '
\n
\n'
+ state.book.sections[-1].body += imageCode
+ case _:
+ pass
+
+
+def findStyle(line):
+ 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
+ state.book.style = contents
+ print("found style")
+
+
+def parseBook():
+ filename = state.book.filename
+ if state.verbose:
+ print("Parsing {}".format(filename))
+ with open(filename) as source:
+ for line in source:
+ if line.startswith('