Clean up
This commit is contained in:
parent
3470d29a24
commit
5235d5a65d
@ -19,9 +19,7 @@ convert = =>
|
||||
(md_source) ->
|
||||
filename = os.tmpname!
|
||||
write_exec md_source, @cmd, filename
|
||||
a = Path.read_file filename
|
||||
require("moon").p a
|
||||
a
|
||||
Path.read_file filename
|
||||
|
||||
-- fname = os.tmpname!
|
||||
-- with io.open fname, "w"
|
||||
@ -39,11 +37,7 @@ class PandocRenderer extends require "sitegen.renderers.markdown"
|
||||
escape_cosmo = @escape_cosmo
|
||||
pandoc = convert @
|
||||
|
||||
-- cmd: "pandoc >"
|
||||
cmd: "pandoc --mathjax --lua-filter pygments.lua >"
|
||||
-- cmd: "pygmentize -f html -l %s %s"
|
||||
-- cmd: "pygmentize -f html -l %s %s -x"
|
||||
-- cmd: "pygmentize -f html -l moonscript.py test.moon -x -o lexer-test.html"
|
||||
cmd: "pandoc >"
|
||||
|
||||
render: (page, md_source) =>
|
||||
md_source = page\pipe "renderer.markdown.pre_render", md_source
|
||||
|
27
site.moon
27
site.moon
@ -1,7 +1,6 @@
|
||||
sitegen = require "sitegen"
|
||||
Site = require "sitegen.site"
|
||||
Path = require "sitegen.path"
|
||||
PygmentsPlugin = require "sitegen.plugins.pygments"
|
||||
html = require "sitegen.html"
|
||||
common = require "sitegen.common"
|
||||
cosmo = require "sitegen.cosmo"
|
||||
@ -14,30 +13,9 @@ import p from require "moon" -- debug
|
||||
-- Change output dir to what Openresty prefers
|
||||
Site.config.out_dir = "html/"
|
||||
|
||||
-- PygmentsPlugin.highlight = (lang, code) =>
|
||||
-- fname = os.tmpname!
|
||||
-- with io.open fname, "w"
|
||||
-- \write code
|
||||
-- \close!
|
||||
--
|
||||
-- p lang
|
||||
--
|
||||
-- -- p = io.popen ("pygmentize -f html -l %s %s")\format lang, fname
|
||||
-- p = io.popen ("pygmentize -f html -l moonscript.py %s -x")\format fname
|
||||
-- out = p\read"*a"
|
||||
--
|
||||
-- -- get rid of the div and pre inserted by pygments
|
||||
-- assert out\match('^<div class="highlight"><pre>(.-)\n?</pre></div>'),
|
||||
-- "Failed to parse pygmentize result, is pygments installed?"
|
||||
|
||||
|
||||
|
||||
-- Configure the command our custom renderer uses to convert markdown to html
|
||||
rend = "renderers.markdown"
|
||||
-- require(rend).cmd = "pandoc --mathjax --no-highlight >"
|
||||
-- require(rend).cmd = "pandoc --mathjax -f json >"
|
||||
|
||||
-- require(rend).cmd = "pandoc --mathjax --no-highlight --lua-filter ./pygments.lua >"
|
||||
require(rend).cmd = "pandoc --mathjax --lua-filter pygments.lua >"
|
||||
|
||||
-- Insert custom renderer in the first position so it will be preferred
|
||||
table.insert Site.default_renderers, 1, rend
|
||||
@ -46,9 +24,6 @@ table.insert Site.default_renderers, 1, rend
|
||||
Site.default_plugins = for v in *Site.default_plugins
|
||||
if v\find "pygments" then continue else v
|
||||
|
||||
-- plugin = "plugins.pygments"
|
||||
-- table.insert Site.default_plugins, 1, plugin
|
||||
|
||||
-- from https://github.com/leafo/sitegen/blob/v0.2/spec/sitegen_spec.moon#L9-L18
|
||||
get_files = (path, prefix=path) ->
|
||||
files = Path.read_exec "find", path, "-type", "f"
|
||||
|
Loading…
x
Reference in New Issue
Block a user