docs: add writer support for pagetitle plugin

This commit is contained in:
Daniel Kolesa 2016-08-26 14:28:11 +01:00
parent 3b175fd7e9
commit b04c0cf241
1 changed files with 5 additions and 1 deletions

View File

@ -48,7 +48,7 @@ M.Writer = util.Object:clone {
INCLUDE_NAMESPACE = 2, INCLUDE_NAMESPACE = 2,
INCLUDE_TAG = 3, INCLUDE_TAG = 3,
__ctor = function(self, path) __ctor = function(self, path, title)
local subs local subs
if type(path) == "table" then if type(path) == "table" then
subs = dutil.path_join(unpack(path)) subs = dutil.path_join(unpack(path))
@ -57,6 +57,10 @@ M.Writer = util.Object:clone {
end end
dutil.mkdir_p(subs) dutil.mkdir_p(subs)
self.file = assert(io.open(dutil.make_page(subs), "w")) self.file = assert(io.open(dutil.make_page(subs), "w"))
if title then
self:write_raw("~~Title: ", title, " ~~")
self:write_nl()
end
end, end,
write_raw = function(self, ...) write_raw = function(self, ...)