~evan-hoose/SSSSS

1c864b1bdf031d4d810fb77ad2d1de45d96d2a1a — Evan 1 year, 2 months ago 1abb589
 On branch master
 Changes to be committed:
	modified:   README.md
	modified:   s5-generate.sh
2 files changed, 71 insertions(+), 23 deletions(-)

M README.md
M s5-generate.sh
M README.md => README.md +70 -22
@@ 14,23 14,17 @@ tags.
In addition to this assumption, SSSSS assumes that

```
$markdown file.md
$ markdown file.md
```
will output the generated html to stdout.

EQUALLY IMPORTANT: SSSSS assumes that it can use 'sh' in both scripts and 'cat'
be available in s5-render.py . What this means is that this won't work on 
Windows. I don't really care about this, and wont fix it personally. I wrote
this as a quick and dirty tool for myself, and I don't use Windows for anything 
other than the occasional gaming. If somebody else wants to add Windows support,
open a PR and I'll probably merge it. 
EQUALLY IF NOT MORE IMPORTANT: SSSSS assumes that there is a POSIX sh at 
/bin/sh. If there isn't, who knows what will happen, but probably not what
you want. In addition, s5-render does pass some user defined values to sh in
the form of path names. If you run it somewhere where a path includes valid
commands, you're gonna have a bad time.

LESS IMPORTANT, BUT STILL IMPORTANT: Many (most?) sites may still require some 
sort of manual modification in order to add things like tabbing at the top. 
This tool is not a all in one site generater, but simply a helper tool to 
remove _some_ of the drudge work in setting up a simple site. I may further
extend this to the point where it does do some more things automatically, but
this is subject to my time/interest.
---

##About        
This program will take a directory structure consisting of directories with


@@ 38,11 32,10 @@ images and markdown files and render it to an html website.

The top level directory will include templates for:

* The html \<!doctype>, \<html> and \<head> tags.
* The document header. (\<body> and whatever html you want to be included in the
* The html-header.html (`<!doctype>`, `<html>` and `<head>` tags.)
* The document-header.html (`<body>` and whatever html you want to be included in the
  header of your website.)
* The document/html footer. (Your html for the footer, followed by \</body> and
  \</head>.)
* The document-footer.html (Your html for the footer, followed by `</body>`)


When SSSSS renders a given Markdown file it will place the templates and


@@ 53,6 46,19 @@ markdown in this order:
3. input.md
4. footer.html

One final feature. If you put a document-header.html file in the `top` 
directory or one of it's sub-directories, that document-header.html file will
be passed down the directory tree, in order to make things like a tabbed
interface require less JS and/or drudge work. If you use this feature, be aware
that if you put a document-header.html into a child directory, you need to put
one in the parent as well, or else sometimes the child will leak upwards.

This is a bug, but one that I've found easy enough to work around that I 
haven't felt compelled to fix it yet. If at some point there is demand for
this, I may fix it.

---

There must be exactly one markdown file in each directory of the structure that
SSSSS is called on. SSSSS will take this:



@@ 61,12 67,20 @@ DemoSite
|- document-header.html
|- footer.html
|-top
| |- document-header.html
| |- index.md
| |-about
| | |- document-header.html
| | |- about.md
| |-blog
| | |- document-header.html
| | |- blog.md
| | |-post-one
| | | |- post-one.md
| | |-post-two
| | | |- post-two.md
| |-other
| | |- document-header.html
| | |- other.md

and turn it to:


@@ 76,15 90,25 @@ DemoSite
|- document-header.html
|- footer.html
|-top
| |- document-header.html
| |- index.md
| |- index.html
| |-about
| | |- document-header.html
| | |- about.md
| | |- index.html
| |-blog
| | |- document-header.html
| | |- blog.md
| | |- index.html
| | |-post-one
| | | |- post-one.md
| | | |- index.html
| | |-post-two
| | | |- post-two.md
| | | |- index.html
| |-other
| | |- document-header.html
| | |- other.md
| | |- index.html



@@ 94,16 118,40 @@ nice looking URI's without needing to do any extra configuration in your
webserver. Second, it allows for less and simpler code, which makes this easier
to hack on for anyone who feels interested.

---

##Tutorial

So you read through all that and still want to try this out? Cool. Start by
cloning this repository. After you have cloned the repository, move the scripts
s5-generate.sh and s5-render.py into your path somewhere.
cloning this repository and installing some markdown program. After you have 
done this, move the programs s5-generate.sh and s5-render into your path 
somewhere, or just remember their fully qualified path.

Next, run  
    s5-generate.sh HelloWorld

```    
$ s5-generate.sh HelloWorld
```
This will create a new site called, you guessed it, HelloWorld. Move into the
HelloWorld Directory you just created, you should see the template files
HelloWorld directory you just created, you should see the template files
mentioned above, and a directory called top. The interior of top is where your
site will start.

Go ahead and cd yourself into top, and create a markdown file with content of
your choosing. I'm just going to go with a nice "Hello, World".
`file: WhateverNameYouWant.md`

```
\*
#Hello, World!

Why does the world never say hello back?
*\
```

After doing this, cd back up into the HelloWorld directory. Once there, run 
s5-render and go back down into top. There should now be whatever markdown
file you created, along with an index.html file. Go ahead and play around
with changing the template files at the top, and look at how the outputed html
files change.



M s5-generate.sh => s5-generate.sh +1 -1
@@ 5,7 5,7 @@ mkdir $1
#Create templates for templates
echo "<doctype html>\n<head>\n<title>$1</title>\n<style>\n</style>\n</head>" > $1/html-header.html
echo "<body>" > $1/document-header.html
echo "</body>" > $1/footer.html
echo "</body>" > $1/document-footer.html

#This is the top level of the actual site
mkdir $1/top