M Tuprules.tup => Tuprules.tup +1 -0
@@ 7,6 7,7 @@ TMP = $(ROOT)/tmp
# plugins to use (in order)
PIPELINE = to_json
+PIPELINE += get_tags
PIPELINE += syntax_highlighting
PIPELINE += convert_markdown
PIPELINE += to_html
A plugins/get_tags => plugins/get_tags +24 -0
@@ 0,0 1,24 @@
+#!/usr/bin/env lua
+local json = require("dkjson")
+
+local input = io.input(arg[1])
+local output = io.output(arg[2])
+
+local str = input:read("*a")
+if arg[1] then input:close() end
+local post = assert(json.decode(str))
+
+post.tags = {}
+local tagline = post.body:match("%[%w*tags%w*%]: .*")
+if tagline then
+ for tag in tagline:gmatch("#([^%s,]+)") do
+ table.insert(tags, tag)
+ end
+end
+
+local post_json = json.encode(post)
+
+output:write(post_json)
+if arg[2] then output:close() end
+
+os.exit(0, true)