~abyxcos/smallblog

a63a3bee25c8f8bebbd881f706f55a96b4e76d0e — abyxcos 8 years ago bb9a0f6 master
Search for an appropriate markdown library on the system.
2 files changed, 11 insertions(+), 4 deletions(-)

M README.md
M smallblog.lua
M README.md => README.md +2 -2
@@ 8,10 8,10 @@ Smallblog requires a markdown parser. I currently use and recommend [Discount](h
### Lua libraries
* LuaPosix
* lyaml
* lua-discount
* lua-resty-template
* markdown

Any lua markdown library that conforms to `post.html = markdown(post.text)` will currently work.
Any lua markdown library that conforms to `post.html = markdown(post.text)` will currently work. Currently `lua-discount` and `markdown` are supported.

## Installation
    cd ~/public_html/

M smallblog.lua => smallblog.lua +9 -2
@@ 2,10 2,17 @@
--  - Error out if tags/ doesn't exist
--
local posix		= require "posix"				-- LuaPosix
local sys_stat	= require "posix.sys.stat"	-- LuaPosx
local sys_stat	= require "posix.sys.stat"	-- LuaPosix
local yaml		= require "lyaml"
local markdown	= require "discount"			-- lua-discount
local template	= require "resty.template"	-- lua-resty-template
-- Fish for a markdown library. Must conform to string = markdown(string)
local markdown_libs = { "discount", "markdown" }
local markdown
for _,lib in ipairs( markdown_libs ) do
	_,markdown = pcall( require, lib )
	if _ then break end
end
assert( type(markdown) == "function", markdown )

local utils = {}
-- open and read a file into a string