lighttpd + org-links with lua
This commit is contained in:
parent
2acd6effce
commit
736b8e39b6
5
Makefile
5
Makefile
|
@ -37,9 +37,10 @@ DST_PANDOC_FILES ?= $(patsubst %$(EXT),%.html, \
|
||||||
$(patsubst $(SRC_DIR)/%,$(DST_DIR)/%, \
|
$(patsubst $(SRC_DIR)/%,$(DST_DIR)/%, \
|
||||||
$(SRC_PANDOC_FILES)))
|
$(SRC_PANDOC_FILES)))
|
||||||
PANDOC_TEMPLATE ?= templates/post.html
|
PANDOC_TEMPLATE ?= templates/post.html
|
||||||
|
PANDOC_LUA_FILTER ?= engine/links-to-html.lua
|
||||||
MK_HTML := engine/mk-html.sh
|
MK_HTML := engine/mk-html.sh
|
||||||
PANDOC := $(MK_HTML) $(PANDOC_TEMPLATE)
|
PANDOC := $(MK_HTML) $(PANDOC_TEMPLATE) $(PANDOC_LUA_FILTER)
|
||||||
$(DST_DIR)/%.html: $(SRC_DIR)/%.org $(PANDOC_TEMPLATE) $(MK_HTML)
|
$(DST_DIR)/%.html: $(SRC_DIR)/%.org $(PANDOC_TEMPLATE) $(PANDOC_LUA_FILTER) $(MK_HTML)
|
||||||
@mkdir -p "$(dir $@)"
|
@mkdir -p "$(dir $@)"
|
||||||
$(PANDOC) "$<" "$@.tmp"
|
$(PANDOC) "$<" "$@.tmp"
|
||||||
minify --mime text/html "$@.tmp" > "$@"
|
minify --mime text/html "$@.tmp" > "$@"
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
server.bind = "0.0.0.0"
|
||||||
|
server.port = 3077
|
||||||
|
server.document-root = var.CWD + "/_site/"
|
||||||
|
|
||||||
|
index-file.names = ( "index.html" )
|
||||||
|
|
||||||
|
mimetype.assign = (
|
||||||
|
".css" => "text/css",
|
||||||
|
".gif" => "image/gif",
|
||||||
|
".htm" => "text/html",
|
||||||
|
".html" => "text/html",
|
||||||
|
".jpeg" => "image/jpeg",
|
||||||
|
".jpg" => "image/jpeg",
|
||||||
|
".js" => "text/javascript",
|
||||||
|
".png" => "image/png",
|
||||||
|
".swf" => "application/x-shockwave-flash",
|
||||||
|
".txt" => "text/plain",
|
||||||
|
".gmi" => "text/plain"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Making sure file uploads above 64k always work when using IE or Safari
|
||||||
|
# For more information, see http://trac.lighttpd.net/trac/ticket/360
|
||||||
|
$HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" {
|
||||||
|
server.max-keep-alive-requests = 0
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
-- links-to-html.lua
|
||||||
|
function Link(el)
|
||||||
|
el.target = string.gsub(string.gsub(el.target, "%.org", ".html"), "%.html::", ".html#" )
|
||||||
|
return el
|
||||||
|
end
|
|
@ -3,8 +3,9 @@ set -eu
|
||||||
|
|
||||||
cd "$(git rev-parse --show-toplevel)" || exit 1
|
cd "$(git rev-parse --show-toplevel)" || exit 1
|
||||||
template="$1"
|
template="$1"
|
||||||
orgfile="$2"
|
luafilter="$2"
|
||||||
htmlfile="$3"
|
orgfile="$3"
|
||||||
|
htmlfile="$4"
|
||||||
|
|
||||||
tocoption=""
|
tocoption=""
|
||||||
if grep -ie '^#+options:' "$orgfile" | grep 'toc:t'>/dev/null; then
|
if grep -ie '^#+options:' "$orgfile" | grep 'toc:t'>/dev/null; then
|
||||||
|
@ -14,6 +15,7 @@ fi
|
||||||
set -x
|
set -x
|
||||||
pandoc $tocoption \
|
pandoc $tocoption \
|
||||||
--template="$template" \
|
--template="$template" \
|
||||||
|
--lua-filter="$luafilter" \
|
||||||
--mathml \
|
--mathml \
|
||||||
--from org \
|
--from org \
|
||||||
--to html5 \
|
--to html5 \
|
||||||
|
|
|
@ -2,12 +2,6 @@
|
||||||
|
|
||||||
cd "$(git rev-parse --show-toplevel)" || exit 1
|
cd "$(git rev-parse --show-toplevel)" || exit 1
|
||||||
|
|
||||||
if (( $# == 0 )); then
|
webdir="_site"
|
||||||
webdir="_site"
|
echo "Serving: $webdir on http://localhost:3077" && \
|
||||||
else
|
lighttpd -f ./engine/lighttpd.conf -D
|
||||||
webdir="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $webdir && \
|
|
||||||
echo "Serving: $webdir" && \
|
|
||||||
http-server -p 3000
|
|
||||||
|
|
Loading…
Reference in New Issue