diff --git a/.gitignore b/.gitignore
index d793de9..cdf363a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
#test result
-result/*
+tests/result*
+tests/result*
#vim session files
*.vims
diff --git a/ASCIIsite.py b/ASCIIsite.py
index 3277b64..f0978b5 100755
--- a/ASCIIsite.py
+++ b/ASCIIsite.py
@@ -11,6 +11,7 @@ def parse_arguments():
parser=argparse.ArgumentParser(description='create a website directory structure by converting .adoc files in a directory strucutre to .html files.')
parser.add_argument('inputDir', type=Path, help='The directory of adoc files to be copied and converted.')
parser.add_argument('-o', '--output', type=Path, help='What to name the generated directory or tar file')
+ parser.add_argument('--stylesheet', type=Path, help='A custom CSS file to be applied to the output.')
parser.add_argument('--exclude-file', type=Path, help='A text file containing glob patterns to exclude, 1 per line.')
parser.add_argument('--exclude', nargs='+', help='A list of glob patterns to ignore. Remember to quote them so your shell doesnt escape them!')
parser.add_argument('-z', '--compress', action='store_true', help='whether to compress the resulting directory to a tar.gz file. can be usefull for scripting to transfer the site to a remote server.')
@@ -51,21 +52,24 @@ def parse_arguments():
logging.info(f'outputting to {outFile.resolve()}')
logging.debug(f'compress is {compress}')
- try:
+ exclude=[]
+ if args.exclude_file != None:
with open(args.exclude_file, 'r') as file:
exclude=[glob.strip() for glob in file]
- if args.exclude != None:
- exclude.extend(args.exclude)
- except Exception as e:
- print(str(e))
- exit()
+ if args.exclude != None:
+ exclude.extend(args.exclude)
if not args.inputDir.resolve().exists():
print(f'Inputdir {args.inputDir.resolve()} does not exist!')
exit()
- return args.inputDir.resolve(), outFile, compress, exclude
+ stylesheet=None
+ if args.stylesheet != None:
+ stylesheet =args.stylesheet.resolve()
+ logging.info(f'using stylesheet {stylesheet}')
+
+ return args.inputDir.resolve(), outFile, stylesheet, compress, exclude
#Doing it in a tmpDir first, as some distrubutions put temp files on a ramdisk. this should speed up the operation sigificantly.
class TmpDir:
@@ -97,32 +101,55 @@ class TmpDir:
def find_paths_to_convert(fileNameGlob):
return glob.glob(f'**/{fileNameGlob}', recursive=True)
+#finds the depth of a file relative to given directory
+def find_relative_file_depth (subfile, parentDir):
+ subfile=Path(subfile).resolve()
+ parentDir=Path(parentDir).resolve()
+ return len(subfile.parts)-len(parentDir.parts)-1
+
#simple wrapper around the asciidoctor cli.
-def convert_file(inDir, outDir, inFile):
+def convert_file(inDir: Path, outDir: Path, inFile: Path, stylesheet: Path):
+ #in order for the stylesdir and imagesdir to be linked to correctly, we need to know the relative depth between the two directories.
+ depth=find_relative_file_depth(inFile, inDir)
+
logging.info(f'converting {Path(inFile).resolve()}')
- logging.debug(f'converting {inFile} from directory {inDir} to directory {outDir}')
- try:
- #the destdir can be used instead of destfile in order to preserve the directory structure relative to the base dir. really useful.
- subprocess.run(['asciidoctor',
+ logging.debug(f'converting {inFile=}, {outDir=}, {inDir=}, {stylesheet=}')
+
+ depthstring= '../'*depth
+
+ arguments=['asciidoctor',
+ #makes the stylesheet linked, but still includes it in the output.
+ '--attribute=linkcss',
+ f'--attribute=stylesdir={depthstring}css',
+ #set imagesdir
+ f'--attribute=imagesdir={depthstring}images',
#specifies the source directory root.
f'--source-dir={inDir}',
#Destination dir. It takes the file from the subtree --source-dir and puts it in the equivilant location in the subtree --destination-dir. (talking about filesystem subtrees).
f'--destination-dir={outDir}',
- inFile],
- check=True)
+ inFile]
+
+ if stylesheet != None:
+ arguments.insert(1, f'--attribute=copycss={stylesheet}')
+ arguments.insert(1, f'--attribute=stylesheet={stylesheet.name}')
+ else:
+ arguments.insert(1, f'--attribute=copycss')
+ logging.debug(f'{arguments=}')
+ try:
+ #the destdir can be used instead of destfile in order to preserve the directory structure relative to the base dir. really useful.
+ subprocess.run(arguments, check=True)
except Exception as e:
logging.error(f'could not convert {inFile}!')
- logging.error(f'stdErr was {e.stderr}')
- logging.error(f'stdOut was {e.stdout}')
+ logging.error(f'{e}')
if __name__ == '__main__':
- inFile, outFile, compress, exclude=parse_arguments()
+ inFile, outFile, stylesheet, compress, exclude=parse_arguments()
os.chdir(inFile)
tmpDir=TmpDir('./', exclude)
pathsToConvert=find_paths_to_convert('*.adoc')
for i in pathsToConvert:
- convert_file('./', tmpDir.path, i)
+ convert_file(inDir='./', outDir=tmpDir.path, inFile=i, stylesheet=stylesheet)
if compress:
tmpDir.compress_and_copy_self_to(outFile)
diff --git a/README.md b/README.md
index 464838f..f4d2562 100644
--- a/README.md
+++ b/README.md
@@ -7,21 +7,22 @@ ASCIIsite is a simple, bare bones static site generator. You give it a directory
## Usage
-ASCIISite takes 2 (so far) optional arguments followed by the single mandatory argument telling it what directory to convert.
+ASCIISite several optional arguments followed by a single mandatory argument telling it what directory to convert.
the -o or --output option simply tells ASCIISite what to name the output file.
the -z or --compress flag tells ASCIISite to put the final product in a compressed tar.gz file as its output.
This is especially useful if you are running ASCIISite on your personal computer, and will be uploading the tar.gz file to your server.
-the --exclude flag allows you to specify a list of glob patterns. Any file matching these glob patterns will not be copied to the output.
+The --sylesheet options allows you to set a custom stylesheet to use instead of the default ASCIIDoctor stylesheet.
+
+The --exclude flag allows you to specify a list of glob patterns. Any file matching these glob patterns will not be copied to the output.
The --exclude-file flag allows you to specify a file containing one glob to exclude per line. Other than inputting from a file, works exactly the same as --exclude. Note that it cannot parse the full spec of .gitignore files, only traditional globs.
Exclusions are helpful for any files that are needed for the compilation of the asciidoc files, but do not need to be in the final site.
The main use case I am aware of is files that are put into an asciidoc document via an include statement.
-
As for how to format the input directory, thats up to you. The directory structure of the input will be mirrored in the structure of the output website.
The only real rule you need to follow is that all your links to other pages in the input directory should be relative, so they dont get broken when you move the output directory around.
@@ -31,7 +32,6 @@ Say you have a nice asciidoctor directory like this:
```
test
├── dir
-│ ├── collatz.py
│ └── subdir
│ └── linked.adoc
├── images
@@ -45,20 +45,21 @@ Where some pages link to others, some pages include others, and some pages have
You can run
```
-ASCIISite.py -o result test
+ASCIISite.py -o output test
```
to get a file tree like:
```
-result
+output
+├── css
+│ └── asciidoctor.css
├── dir
-│ ├── collatz.py
│ └── subdir
│ └── linked.html
-├── images
-│ └── test_pattern.svg
├── include
│ └── include.txt
+├── images
+│ └── test_pattern.svg
└── landing_page.html
```
@@ -70,9 +71,10 @@ ASCIIsite.py --exclude 'include*' -o output test
will get you an output like:
```
-result
+output
+├── css
+│ └── asciidoctor.css
├── dir
-│ ├── collatz.py
│ └── subdir
│ └── linked.html
├── images
@@ -80,9 +82,30 @@ result
└── landing_page.html
```
-Alternatively, you can run
+and, to use your custom stylesheet named `+myTheme.css+`, you can use:
+
```
-ASCIISite.py -z -o result test
+ASCIIsite.py --stylesheet myTheme.css -o output test
```
-to get a .tar.gz file containing the result directory.
+```
+output
+├── css
+│ └── myTheme.css
+├── dir
+│ └── subdir
+│ └── linked.html
+├── include
+│ └── include.txt
+├── images
+│ └── test_pattern.svg
+└── landing_page.html
+```
+
+Alternatively, you can run
+
+```
+ASCIISite.py -z -o output test
+```
+
+to get a .tar.gz file containing the output directory.
diff --git a/tests/result/dir/subdir/linked.html b/tests/control/css/asciidoctor.css
similarity index 89%
rename from tests/result/dir/subdir/linked.html
rename to tests/control/css/asciidoctor.css
index 1a4a433..98f27c4 100644
--- a/tests/result/dir/subdir/linked.html
+++ b/tests/control/css/asciidoctor.css
@@ -1,14 +1,3 @@
-
-
-
-
-
-
-
-
-relatively linked doc
-
-
-
-
-
-
relatively linked doc
-
-Gabe Venberg
-
-
-
-
-
-
-
-
Figure 1. Technical Difficulties
-
-
-
-While the creative works from the 16th century can still be accessed and used by others, the data in some software programs from the 1990s is already inaccessible. Once a company that produces a certain product goes out of business, it has no simple way to uncover how its product encoded data. The code is thus lost, and the software is inaccessible. Knowledge has been destroyed.
-
-
-— Lawrence Lessig
-May the Source Be With You
-
-
-
-
Three Rings for the Elven-kings under the sky,
-Seven for the dwarf-lords in their halls of stone,
-Nine for Mortal Men doomed to die,
-One for the Dark Lord on his dark throne,
-In the Land of Mordor where the Shadows lie.
-One Ring to rule them all, One Ring to find them,
-One Ring to bring them all and in the darkness bind them
-In the Land of Mordor where the Shadows lie.
-
-
-
\ No newline at end of file
+@media amzn-kf8{#header,#content,#footnotes,#footer{padding:0}}
\ No newline at end of file
diff --git a/tests/control/dir/subdir/linked.html b/tests/control/dir/subdir/linked.html
index 1a4a433..b15754c 100644
--- a/tests/control/dir/subdir/linked.html
+++ b/tests/control/dir/subdir/linked.html
@@ -4,439 +4,11 @@
-
+
relatively linked doc
-
+
diff --git a/tests/control/landing_page.html b/tests/control/landing_page.html
index 3aaf826..99396e2 100644
--- a/tests/control/landing_page.html
+++ b/tests/control/landing_page.html
@@ -4,439 +4,11 @@
-
+
test page for an adoc static site generator.
-
+
diff --git a/tests/control_css/css/test.css b/tests/control_css/css/test.css
new file mode 100644
index 0000000..d071809
--- /dev/null
+++ b/tests/control_css/css/test.css
@@ -0,0 +1,239 @@
+/*template asciidoctor skin from https://github.com/darshandsoni/asciidoctor-skins/blob/gh-pages/css/template.css*/
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Darshan Soni
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+/* document body (contains all content) */
+body {
+ font-size: small;
+}
+
+/* document header (contains title etc) */
+#header {
+ width: 100%;
+}
+
+/* headings */
+h1 {
+ color: purple;
+}
+h2 {
+ color: chartreuse;
+}
+h3 {
+ color: coral;
+}
+h4 {
+ color: darkcyan;
+}
+h5 {
+ color: darkslategray;
+}
+h6 {
+ color: olive;
+}
+
+/* Table of Contents sidebar */
+#toc {
+ background-color: plum!important;
+ color: white;
+ font-weight: bold;
+}
+/* title of the TOC */
+#toctitle {
+ color: white;
+}
+/* top-level entries in TOC */
+.sectlevel1 {
+ background-color: palegoldenrod;
+}
+/* second-level entries in TOC */
+.sectlevel2 {
+ background-color: palegreen;
+}
+
+/* main content window */
+#content {
+ background-color: lavender;
+ color: navy;
+}
+
+/* plain paragraph text */
+.paragraph {
+ font-family: sans-serif;
+}
+p {
+ font-family: sans-serif;
+}
+
+/* blockquote text */
+.quoteblock {
+ font-style: italic;
+}
+blockquote {
+ font-style: italic;
+}
+
+/* the quotation mark itself (before the block) */
+.quoteblock blockquote::before {
+ color: blue;
+}
+
+/* blockquote attribution text */
+.attribution {
+ font-size: x-large;
+}
+
+/* blockquote citation (work where quote cited) */
+cite {
+ font-size: x-large;
+}
+
+/* ordered list */
+ol {
+ color: red;
+}
+.olist {
+ color: red;
+}
+
+/* unordered list */
+ul {
+ color: blue;
+}
+.ulist {
+ color: blue;
+}
+
+/* links */
+a {
+ text-decoration: none;
+}
+
+/* bold text */
+strong {
+ color: green;
+}
+
+/* italic text */
+em {
+ color: orange;
+}
+
+/* underlined text */
+u {
+ color: yellow;
+}
+
+/* deleted text */
+del {
+ text-decoration: line-through;
+ color: red;
+}
+/* inserted text */
+ins {
+ text-decoration: overline;
+ color: green;
+}
+
+/* strikethrough text */
+s {
+ text-decoration-color: red;
+}
+
+/* superscript text */
+sup {}
+/* subscript text */
+sub {}
+
+/* small text */
+small {}
+
+/* highlighted text */
+mark {}
+
+/* horizontal rules */
+hr {}
+
+/* table */
+table {}
+/* table caption */
+caption {}
+/* table header row */
+thead {}
+/* table header cell */
+th {}
+/* table row */
+tr {}
+/* table footer */
+tfoot {}
+/* table cell */
+td {}
+/* table body */
+tbody {}
+
+/* inline code */
+code {
+ background-color: papayawhip!important;
+}
+/* pre-formatted text */
+pre {
+ background-color: burlywood!important;
+}
+.literalblock {
+ background-color: burlywood!important;
+}
+
+/* image */
+img {
+ max-width: 100%;
+}
+/* image caption */
+.imageblock .title {
+ font-weight: bold!important;
+}
+
+/* audio */
+audio {}
+/* video */
+video {}
+
+/* footer section */
+#footer {
+ background-color: gray;
+ color: red;
+}
+/* footer text (by default contains time of last document update) */
+#footer-text {
+ font-weight: bold;
+ color: white;
+}
+
+/* Responsiveness fixes */
+video {
+ max-width: 100%;
+}
+
+@media all and (max-width: 600px) {
+table {
+ width: 55vw!important;
+ font-size: 3vw;
+}
diff --git a/tests/result/dir/collatz.py b/tests/control_css/dir/collatz.py
similarity index 100%
rename from tests/result/dir/collatz.py
rename to tests/control_css/dir/collatz.py
diff --git a/tests/control_css/dir/subdir/linked.html b/tests/control_css/dir/subdir/linked.html
new file mode 100644
index 0000000..5a1cf56
--- /dev/null
+++ b/tests/control_css/dir/subdir/linked.html
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+relatively linked doc
+
+
+
+
+
relatively linked doc
+
+Gabe Venberg
+
+
+
+
+
+
+
+
Figure 1. Technical Difficulties
+
+
+
+While the creative works from the 16th century can still be accessed and used by others, the data in some software programs from the 1990s is already inaccessible. Once a company that produces a certain product goes out of business, it has no simple way to uncover how its product encoded data. The code is thus lost, and the software is inaccessible. Knowledge has been destroyed.
+
+
+— Lawrence Lessig
+May the Source Be With You
+
+
+
+
Three Rings for the Elven-kings under the sky,
+Seven for the dwarf-lords in their halls of stone,
+Nine for Mortal Men doomed to die,
+One for the Dark Lord on his dark throne,
+In the Land of Mordor where the Shadows lie.
+One Ring to rule them all, One Ring to find them,
+One Ring to bring them all and in the darkness bind them
+In the Land of Mordor where the Shadows lie.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+Phasellus mi tellus, suscipit in dolor nec, faucibus aliquam nulla.
+Mauris gravida, felis commodo molestie tincidunt, sem erat varius lorem, nec lobortis eros sem ut augue.
+Donec suscipit tristique imperdiet.
+Sed maximus est ultrices urna imperdiet, vitae facilisis eros posuere.
+Quisque a mollis mauris.
+Pellentesque fermentum, libero sed sollicitudin interdum, dolor nunc euismod purus, et laoreet tellus augue vitae turpis.
+Pellentesque condimentum elit quis semper tincidunt.
+Nullam consectetur euismod accumsan.
+In dictum nibh ut iaculis euismod.
+Phasellus ut nibh non ipsum volutpat cursus.
+Sed eleifend, enim vitae ultrices auctor, dolor ipsum molestie dui, id dignissim massa neque a mauris.
def nextInSequence(number):
+ if isinstance(number, int):
+ if number % 2 == 0:
+ return number // 2
+ else:
+ return 3*number+1
+ else:
+ raise TypeError('input must be int!')
+
+def seqenceLength(number):
+ length = 0
+ while number != 1:
+ number = nextInSequence(number)
+ length += 1
+ return length
+
+
+
+
+
+
tables test
+
+
+
+
+
+
+
+
+
+
Name
+
Group
+
Description
+
+
+
+
+
Firefox
+
Web Browser
+
+
Mozilla Firefox is an open-source web browser.
+It’s designed for:
+
+
+
+
+
standards compliance,
+
+
+
performance and
+
+
+
portability.
+
+
+
+
+
+
Ruby
+
Programming Language
+
A programmer’s best friend.
+
+
+
+
+
+
+
included section
+
+
+
Fusce maximus nec magna eu ultricies.
+Fusce quis tellus vitae arcu facilisis lobortis.
+Donec id erat at enim porta placerat in vitae sapien.
+Duis justo arcu, hendrerit nec nulla eu, dictum dapibus ipsum.
+Sed fermentum id elit eget fringilla.
+Suspendisse volutpat imperdiet justo, ut efficitur odio maximus et.
+Nunc interdum sollicitudin eros sit amet convallis.
+Praesent volutpat tempus metus id tincidunt.
+Proin aliquet justo a fermentum consectetur.
+Nunc scelerisque, nisi id scelerisque dictum, nibh lectus ultrices nunc, quis ultricies erat velit sit amet urna.
+Maecenas orci felis, volutpat at bibendum ut, mattis eu justo.
+
+
+
blocks
+
+
listing block
+
+
example of _listing block_
+with verbatim line break
+
+
+
+
Example 1. example block
+
+
+
example block
+with line break
+
+
+
+
+
literal block
+
+
_literal_ block
+with line break
+
+
+pass block
+with underlined text
+
+
quote block
+
+
+
quote block
+with line break
+
+
+
+
+
+
sidebar block
+
+
sidebar block
+with line break
+
+
+
+
+
+
+
+
+
+
+
+
This is an example of an admonition block.
+
+
+
Unlike an admonition paragraph, it may contain any AsciiDoc content.
+The style can be any one of the admonition labels:
+
+
+
+
+
NOTE
+
+
+
TIP
+
+
+
WARNING
+
+
+
CAUTION
+
+
+
IMPORTANT
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/result/landing_page.html b/tests/result/landing_page.html
deleted file mode 100644
index 3aaf826..0000000
--- a/tests/result/landing_page.html
+++ /dev/null
@@ -1,935 +0,0 @@
-
-
-
-
-
-
-
-
-test page for an adoc static site generator.
-
-
-
-
-
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
-Phasellus mi tellus, suscipit in dolor nec, faucibus aliquam nulla.
-Mauris gravida, felis commodo molestie tincidunt, sem erat varius lorem, nec lobortis eros sem ut augue.
-Donec suscipit tristique imperdiet.
-Sed maximus est ultrices urna imperdiet, vitae facilisis eros posuere.
-Quisque a mollis mauris.
-Pellentesque fermentum, libero sed sollicitudin interdum, dolor nunc euismod purus, et laoreet tellus augue vitae turpis.
-Pellentesque condimentum elit quis semper tincidunt.
-Nullam consectetur euismod accumsan.
-In dictum nibh ut iaculis euismod.
-Phasellus ut nibh non ipsum volutpat cursus.
-Sed eleifend, enim vitae ultrices auctor, dolor ipsum molestie dui, id dignissim massa neque a mauris.
def nextInSequence(number):
- if isinstance(number, int):
- if number % 2 == 0:
- return number // 2
- else:
- return 3*number+1
- else:
- raise TypeError('input must be int!')
-
-def seqenceLength(number):
- length = 0
- while number != 1:
- number = nextInSequence(number)
- length += 1
- return length
-
-
-
-
-
-
tables test
-
-
-
-
-
-
-
-
-
-
Name
-
Group
-
Description
-
-
-
-
-
Firefox
-
Web Browser
-
-
Mozilla Firefox is an open-source web browser.
-It’s designed for:
-
-
-
-
-
standards compliance,
-
-
-
performance and
-
-
-
portability.
-
-
-
-
-
-
Ruby
-
Programming Language
-
A programmer’s best friend.
-
-
-
-
-
-
-
included section
-
-
-
Fusce maximus nec magna eu ultricies.
-Fusce quis tellus vitae arcu facilisis lobortis.
-Donec id erat at enim porta placerat in vitae sapien.
-Duis justo arcu, hendrerit nec nulla eu, dictum dapibus ipsum.
-Sed fermentum id elit eget fringilla.
-Suspendisse volutpat imperdiet justo, ut efficitur odio maximus et.
-Nunc interdum sollicitudin eros sit amet convallis.
-Praesent volutpat tempus metus id tincidunt.
-Proin aliquet justo a fermentum consectetur.
-Nunc scelerisque, nisi id scelerisque dictum, nibh lectus ultrices nunc, quis ultricies erat velit sit amet urna.
-Maecenas orci felis, volutpat at bibendum ut, mattis eu justo.
-
-
-
blocks
-
-
listing block
-
-
example of _listing block_
-with verbatim line break
-
-
-
-
Example 1. example block
-
-
-
example block
-with line break
-
-
-
-
-
literal block
-
-
_literal_ block
-with line break
-
-
-pass block
-with underlined text
-
-
quote block
-
-
-
quote block
-with line break
-
-
-
-
-
-
sidebar block
-
-
sidebar block
-with line break
-
-
-
-
-
-
-
-
-
-
-
-
This is an example of an admonition block.
-
-
-
Unlike an admonition paragraph, it may contain any AsciiDoc content.
-The style can be any one of the admonition labels:
-
-
-
-
-
NOTE
-
-
-
TIP
-
-
-
WARNING
-
-
-
CAUTION
-
-
-
IMPORTANT
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/test.css b/tests/test.css
new file mode 100644
index 0000000..d071809
--- /dev/null
+++ b/tests/test.css
@@ -0,0 +1,239 @@
+/*template asciidoctor skin from https://github.com/darshandsoni/asciidoctor-skins/blob/gh-pages/css/template.css*/
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2016 Darshan Soni
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+/* document body (contains all content) */
+body {
+ font-size: small;
+}
+
+/* document header (contains title etc) */
+#header {
+ width: 100%;
+}
+
+/* headings */
+h1 {
+ color: purple;
+}
+h2 {
+ color: chartreuse;
+}
+h3 {
+ color: coral;
+}
+h4 {
+ color: darkcyan;
+}
+h5 {
+ color: darkslategray;
+}
+h6 {
+ color: olive;
+}
+
+/* Table of Contents sidebar */
+#toc {
+ background-color: plum!important;
+ color: white;
+ font-weight: bold;
+}
+/* title of the TOC */
+#toctitle {
+ color: white;
+}
+/* top-level entries in TOC */
+.sectlevel1 {
+ background-color: palegoldenrod;
+}
+/* second-level entries in TOC */
+.sectlevel2 {
+ background-color: palegreen;
+}
+
+/* main content window */
+#content {
+ background-color: lavender;
+ color: navy;
+}
+
+/* plain paragraph text */
+.paragraph {
+ font-family: sans-serif;
+}
+p {
+ font-family: sans-serif;
+}
+
+/* blockquote text */
+.quoteblock {
+ font-style: italic;
+}
+blockquote {
+ font-style: italic;
+}
+
+/* the quotation mark itself (before the block) */
+.quoteblock blockquote::before {
+ color: blue;
+}
+
+/* blockquote attribution text */
+.attribution {
+ font-size: x-large;
+}
+
+/* blockquote citation (work where quote cited) */
+cite {
+ font-size: x-large;
+}
+
+/* ordered list */
+ol {
+ color: red;
+}
+.olist {
+ color: red;
+}
+
+/* unordered list */
+ul {
+ color: blue;
+}
+.ulist {
+ color: blue;
+}
+
+/* links */
+a {
+ text-decoration: none;
+}
+
+/* bold text */
+strong {
+ color: green;
+}
+
+/* italic text */
+em {
+ color: orange;
+}
+
+/* underlined text */
+u {
+ color: yellow;
+}
+
+/* deleted text */
+del {
+ text-decoration: line-through;
+ color: red;
+}
+/* inserted text */
+ins {
+ text-decoration: overline;
+ color: green;
+}
+
+/* strikethrough text */
+s {
+ text-decoration-color: red;
+}
+
+/* superscript text */
+sup {}
+/* subscript text */
+sub {}
+
+/* small text */
+small {}
+
+/* highlighted text */
+mark {}
+
+/* horizontal rules */
+hr {}
+
+/* table */
+table {}
+/* table caption */
+caption {}
+/* table header row */
+thead {}
+/* table header cell */
+th {}
+/* table row */
+tr {}
+/* table footer */
+tfoot {}
+/* table cell */
+td {}
+/* table body */
+tbody {}
+
+/* inline code */
+code {
+ background-color: papayawhip!important;
+}
+/* pre-formatted text */
+pre {
+ background-color: burlywood!important;
+}
+.literalblock {
+ background-color: burlywood!important;
+}
+
+/* image */
+img {
+ max-width: 100%;
+}
+/* image caption */
+.imageblock .title {
+ font-weight: bold!important;
+}
+
+/* audio */
+audio {}
+/* video */
+video {}
+
+/* footer section */
+#footer {
+ background-color: gray;
+ color: red;
+}
+/* footer text (by default contains time of last document update) */
+#footer-text {
+ font-weight: bold;
+ color: white;
+}
+
+/* Responsiveness fixes */
+video {
+ max-width: 100%;
+}
+
+@media all and (max-width: 600px) {
+table {
+ width: 55vw!important;
+ font-size: 3vw;
+}
diff --git a/tests/test.sh b/tests/test.sh
index f704c8a..24a6905 100644
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -6,6 +6,7 @@ result=$(find . -type f -print0 | xargs -0 -P0 -n1 md5sum | sort -k 2 | md5sum)
cd ../control
control=$(find . -type f -print0 | xargs -0 -P0 -n1 md5sum | sort -k 2 | md5sum)
cd ../
+tree result
echo result sum is $result
echo control sum is $control
if [ "$result" = "$control" ]; then
@@ -13,3 +14,18 @@ if [ "$result" = "$control" ]; then
else
echo test did not pass!!!!!
fi
+rm -r result_css
+../ASCIIsite.py --verbose --output result_css --exclude-file globignore --stylesheet test.css test
+cd result_css
+result_css=$(find . -type f -print0 | xargs -0 -P0 -n1 md5sum | sort -k 2 | md5sum)
+cd ../control_css
+control_css=$(find . -type f -print0 | xargs -0 -P0 -n1 md5sum | sort -k 2 | md5sum)
+cd ../
+tree result_css
+echo result_css sum is $result_css
+echo control_css sum is $control_css
+if [ "$result_css" = "$control_css" ]; then
+ echo test passed!
+else
+ echo test did not pass!!!!!
+fi
diff --git a/tests/test/dir/subdir/linked.adoc b/tests/test/dir/subdir/linked.adoc
index 307c515..1612be6 100644
--- a/tests/test/dir/subdir/linked.adoc
+++ b/tests/test/dir/subdir/linked.adoc
@@ -1,6 +1,5 @@
= relatively linked doc
Gabe Venberg
-:imagesdir: ../../images
:reproducible:
:giturl: git.venberg.xyz/Gabe/adocStaticSiteGen
diff --git a/tests/test/landing_page.adoc b/tests/test/landing_page.adoc
index ea08317..6a9e1f3 100644
--- a/tests/test/landing_page.adoc
+++ b/tests/test/landing_page.adoc
@@ -1,6 +1,5 @@
= test page for an adoc static site generator.
Gabe Venberg
-:imagesdir: images
:docdate: 2021-08-06
:reproducible:
:giturl: https://git.venberg.xyz/Gabe/adocStaticSiteGen