diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | README.org | 162 | ||||
-rw-r--r-- | TODO.org | 2 | ||||
-rwxr-xr-x | bin/sitegen (renamed from make) | 0 | ||||
-rw-r--r-- | doc/nginx.conf.example (renamed from nginx.conf.example) | 0 | ||||
-rw-r--r-- | doc/uwsgi.ini.example (renamed from uwsgi.ini.example) | 0 | ||||
-rw-r--r-- | lib/page_index.rb | 2 | ||||
-rw-r--r-- | notes.org | 3 | ||||
-rw-r--r-- | out/main.css | 8 | ||||
-rw-r--r-- | src/main.scss | 13 |
10 files changed, 144 insertions, 48 deletions
@@ -27,7 +27,7 @@ out/%.css: src/%.scss targets = $(phony) %.css $(sort $(filter-out $(targets),out/index.html $(MAKECMDGOALS))): FORCE - ./make + ./bin/sitegen # Boilerplate .PHONY: $(phony) @@ -2,12 +2,14 @@ Here's the gist: + - ~/config.yaml~ : Top-level website configuration + - ~/Makefile~ : duh + - ~/git-setup~ : set up git hooks (see below) - ~/src/~ : website content - - ~/bin/~ : programs and such for generating the website from ~/src/~ - ~/out/~ : where the generated output goes - - ~/Makefile~ : invoke ~/bin/~ as appropriate - - ~/git-setup~ : set up git hooks (see below) - - ~/benchmark~ : runs ~make~ and reports how long each part took + - ~/bin/~ : programs you usually won't need to invoke directly + - ~/lib/~ : the body of site generator (see also: ~/bin/sitegen~) + - ~/doc/~ : additional documentation The web server should serve the union of ~/src/~ and ~/out/~. @@ -15,7 +17,42 @@ On the ~master~ branch, ~/out/~ is ignored. But ~git-setup~ will set up a git post-commit hook to generate ~/out/~ and commit it to the ~pre-generated~ branch. -* Document metadata +More completely, ~git-setup~ sets up ~/bin/post-commit.githook~ as the +git post-commit hook; which does two things: + - run ~bin/auto-changelog~ (desribed in "ChangeLog", below) + - run ~bin/pre-generate~ (described immediately above) + +* Make targets + +The Makefile provides several .PHONY targets of interest. + + - ~all~ (default) : Generate all generated files. While the main + site is all generated by ~/bin/sitegen~ (which is called by the + Makefile), other generated assets (CSS) is generated by the + Makefile directly. + - ~serve~ : Alias for ~serve-8000~ + - ~serve-PORTNUMBER~ : Run an HTTP server on PORTNUMBER. Search + won't work, and file names are case-sensitive. + +* Make dependencies + +As mentioned above, the generated static output is committed +automatically to the ~pre-generated~ branch (assuming you've run +~git-setup~; so the server does't actually need all of the sitegen +dependencies. However, the computer being used to commit does. + +Those dependencies are: + + - ~all~ + - GNU Make + - Ruby + - Pandoc 1.17+ + - scss + - ~serve-%~ (in addition to what is needed for ~all~) + - unionfs + - python3 + +* Authoring pages Currently supported are Markdown (~.md~) and Org-mode (~.org~) files. Each of these format supports embedding metadata in the document @@ -51,48 +88,91 @@ to HTML. See the Org-mode and Pandoc documentation. However, there are some of these that are used specially by the site generator: -| attribute | default | standard | format | -|-----------------+---------------------------------+--------------------+--------------------------------------------| -| title | the first line of the file | Pandoc | string | -| author | "Andrew Murrell" | Pandoc | string or list | -| license | "CC BY-SA-3.0" | no | string | -| pandoc_flags | "" | no | string ("--foo --bar") | -| pandoc_format | either "markdown" or "org" | no | string ("markdown+extnsn1+extnsns2") | -| html_head_extra | "" | Org-mode | string | -| class | "" | no | string (CSS class to apply to ~<body>~) | -| tags | "" | LaTeX, kinda[fn:1] | string ("ES HB") or list (["ES", "HB"]) | -| published[fn:2] | most recent git commit for file | no | string (Ruby ~DateTime::parse()~) or date[fn:3] | -| updated[fn:2] | first git commit for file | no | string (Ruby ~DateTime::parse()~) or date[fn:3] | - -[fn:1] The ~tags~ attribute is normally a list, but because I don't -know how to do a list in Org-mode, I made it take a -whitespace-separated string as well. - -[fn:2] The "published"/"updated" terminology is borrowed from the Atom -specification (RFC 4287), and I intend them to have the same -semantics. The "standard" variable name is "date", but I thought that -was dreadfully ambiguous and confusing when the site generator deals -with two distinct dates. +| attribute | default | standard | format | +|------------------+---------------------------------+----------+-------------------------------------------------| +| title | the first line of the file | Pandoc | string | +| author | ~config.yaml:default_author~ | Pandoc | string +or list+ [fn:1] | +| license | ~config.yaml:default_license~ | no | string | +| pandoc_flags | "" | no | string ("--foo --bar") | +| pandoc_format | either "markdown" or "org" | no | string ("markdown+extnsn1+extnsns2") | +| html_head_extra | "" | Org-mode | string | +| class | "" | no | string (CSS class to apply to ~<body>~) | +| categories[fn:2] | "" | no | string ("ES HB") or list (["ES", "HB"]) | +| published[fn:2] | most recent git commit for file | no | string (Ruby ~DateTime::parse()~) or date[fn:3] | +| updated[fn:2] | first git commit for file | no | string (Ruby ~DateTime::parse()~) or date[fn:3] | + +[fn:1] We don't support lists of authors, though the Pandoc "standard" +does. + +[fn:2] The "published"/"updated"/"categories" terminology is borrowed +from the Atom specification (RFC 4287), and I intend them to have the +same semantics. For "published"/"updated", there is a "standard" +variable name is "date", but I thought that was dreadfully ambiguous +and confusing when the site generator deals with two distinct dates. [fn:3] At various times there have been bugs in the YAML parser library that Pandoc uses, causing it to fail to parse dates, so I just always put the date in quotes now, and let Ruby ~DateTime::parse()~ take care of it. -* Make targets +* Customizing index pages - - ~all~ (default) : generate all generated files - - ~serve~ : alias for ~serve-8000~ - - ~serve-PORTNUMBER~ : Run an HTTP server on PORTNUMBER. Search - won't work. +The generated index pages (directory listings) may be influenced by an +~index.yaml~ file placed in the ~/src/~ directory they describe. -* Make dependencies +There are only 3 attributes that we look for in the ~index.yaml~ +files: - - ~all~ - - GNU Make - - Ruby - - Pandoc 1.17+ - - scss - - ~serve-%~ (in addition to what is needed for ~all~) - - unionfs - - python3 +| attribute | default | format | +|-----------+------------------------------+-------------------------| +| title | File::basename(dirpath) | string | +| author | ~config.yaml:default_author~ | string | +| external | empty list | list of maps; see below | + +* Adding pages hosted elsewhere + +In the directory you wish for the externally hosted pages to appear +in, add the metadata to the page to external list. + +For example, adding "356 Tomorrows: A Simple Lament" to the "writing" +directory: + +#+BEGIN_SRC +title: "Writing" +external: + - title: "365 Tomorrows: A Simple Lament" + url: "http://365tomorrows.com/12/03/a-simple-lament/" + published: "2013-12-03" + categories: [FF] +#+END_SRC + +The metadata attributes for the external pages are very similar to the +attributes for local pages, but with fewer defaults: + +| attribute | default | format | +|------------+------------------------------+--------------------------------------------------| +| url | mandatory | string | +| title | mandatory | string | +| author | ~config.yaml:default_author~ | string | +| categories | "" | string ("ES HB") or list (["ES", "HB"]) | +| published | value of ~updated~ [fn:4] | string (Ruby ~DateTime::parse()~) or date[fn:b3] | +| updated | value of ~published~ [fn:4] | string (Ruby ~DateTime::parse()~) or date[fn:3] | + +[fn:4] It is mandatory to set at least one of ~published~ or +~updated~. + +These externally hosted pages also show up in the Atom (RSS) feed. +* The ChangeLog +Whenever a you commit, post-commit hook runs ~bin/auto-changelog~, +which will only continue to run if the commit touches a ~.org~ or +~.md~ file to the ~/src/~ directory (with the special case that it +ignores files named ~index.md~ or ~changelog.md~). If the commit does +add or change such a file, then it uses the git log to prepend an +entry to ~/src/changelog.md~, and commits that. + +The format that it uses is loosely based on the GNU Coding Standards' +recomendation for ~ChangeLog~ files. + +If you want to update the changelog manually, or edit an entry, feel +free. But be warned that the first 3 lines of the file are reset +every time ~auto-changelog~ runs. diff --git a/TODO.org b/TODO.org deleted file mode 100644 index 1fe8e3a..0000000 --- a/TODO.org +++ /dev/null @@ -1,2 +0,0 @@ -- documentation -- org tables (style) diff --git a/nginx.conf.example b/doc/nginx.conf.example index 403c66e..403c66e 100644 --- a/nginx.conf.example +++ b/doc/nginx.conf.example diff --git a/uwsgi.ini.example b/doc/uwsgi.ini.example index e392044..e392044 100644 --- a/uwsgi.ini.example +++ b/doc/uwsgi.ini.example diff --git a/lib/page_index.rb b/lib/page_index.rb index 6ae4318..43bf367 100644 --- a/lib/page_index.rb +++ b/lib/page_index.rb @@ -70,7 +70,7 @@ class IndexPage < LocalPage return ret.gsub(/\n\n+/, "\n\n") end def index_title - _metadata['title'] + _metadata['title'] || File::basename(local_infile) end def index_author Person::new(_metadata['author'] || Config::get.default_author) diff --git a/notes.org b/notes.org deleted file mode 100644 index 5b00a25..0000000 --- a/notes.org +++ /dev/null @@ -1,3 +0,0 @@ -I need to insert this on all XML output: - -<?xml version="1.0" encoding="utf-8"?> diff --git a/out/main.css b/out/main.css index a47c6f9..aa54f37 100644 --- a/out/main.css +++ b/out/main.css @@ -123,6 +123,14 @@ body.dnd { body.dnd article { font-family: Times, serif; font-size: 12pt; } + body.dnd article table { + border-spacing: 0; } + body.dnd article table, body.dnd article table tr:last-child td, body.dnd article table tr:last-child th { + border-bottom: solid 1px black; } + body.dnd article table, body.dnd article table tr:first-child td, body.dnd article table tr:first-child th { + border-top: solid 1px black; } + body.dnd article table td, body.dnd article table th { + padding: 6px; } body.dnd article p { text-align: justify; } body.dnd article .title { diff --git a/src/main.scss b/src/main.scss index 7f43a61..9fc3ef2 100644 --- a/src/main.scss +++ b/src/main.scss @@ -162,6 +162,19 @@ body.dnd { font-family: Times, serif; font-size: 12pt; + table { + border-spacing: 0; + &, tr:last-child td, tr:last-child th { + border-bottom: solid 1px black; + } + &, tr:first-child td, tr:first-child th { + border-top: solid 1px black; + } + td, th { + padding: 6px; + } + } + p { text-align: justify; } .title { text-align: center; } .todo { color: red; } |