* All content is stored in a git repo as vimwiki content (to avoid having to sync HTML content as well)
* All content automatically converted to HTML and moved to the appropriate directory when the git repo is pushed
* [[https://git.thurstylark.com/vimwiki.git/tree/html-template/index.html|Template]] based on bootstrap, so theming/building the template is easy peasy
Tables without any styles are gross, so let's use the styles from Bootstrap. Problem is that Vimwiki doesn't provide a way to add a class to a table element, so we'll do it with JQuery:
This adds `.table`, `.table-condensed`, and `.table-hover` classes to every table element in the whole document. Don't see why it should be any other way for the moment.
By default, there is no difference between how a non-checkbox list item, unchecked list item, and a checked list item are displayed when exported to HTML.
There are 5 states of a checkbox, 0-4, and they each represent a different level of completeness. This is mainly for checklist items with children.
The easiest way to manage this wiki, and also allow it to be hosted, is to commit all the wiki documents to a repo, and script the deployment to the wiki's webroot using git's post-receive hook. The origin remote repo also hosts the http server, so it makes things simple. Less simple because it requires a vim plugin to compile the HTML files, but it's still doable.
First part of this solution is the vimrc for the remote machine. This sets the destination for the final html files, the origin wiki files, and the html template page.
{{{class="prettyprint linenums"
set nocompatible
filetype plugin on
syntax on
let g:vimwiki_list = [{
\ 'path': '/tmp/vimwiki/',
\ 'path_html': '/srv/wiki/',
\ 'template_path': '/tmp/vimwiki/html-template',
\ 'template_default': 'index',
\ 'template_ext': '.html'}]
}}}
Note: lines 1-3 are required for vimwiki to work correctly with the post-receive hook. The rest of the config are options for vimwiki directly.
The post-receive hook is a fairly simple bash script. This script is located at `~/git/vimwiki.git/hooks/post-receive`, and is run every time the repo receives a push from downstream.
{{{class="prettyprint linenums"
#!/bin/bash
mkdir /tmp/vimwiki
export GIT_WORK_TREE=/tmp/vimwiki
export GIT_DIR=/home/thurstylark/git/vimwiki.git
git checkout -f
vim -u /tmp/vimwiki/html-template/srv-vimrc -c VimwikiAll2HTML -c q /tmp/vimwiki/index.wiki
It first makes a directory under /tmp for the contents of the repo, sets `$GIT_WORK_TREE` and `$GIT_DIR`, and does a `git checkout` for all the files in the repo.
Line 9 is where the magic happens. This line runs vim with the vimrc from above, and runs the `:VimwikiAll2HTML` command.
Next, the script copies over the one CSS file that I need to host myself, and lastly, it cleans up the temp dir.
== TODO ==
* [X] Commit to a repository
* [X] Setup remote to host
* [X] Setup remote to automatically `:VimwikiAll2HTML` after it's been pushed to