Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/sundown-ffi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonan Collobert <ronan@collobert.com>2014-03-19 17:02:06 +0400
committerRonan Collobert <ronan@collobert.com>2014-03-19 17:02:06 +0400
commit446e48d75b9b1d60e3380687b4246a8d53a378a4 (patch)
treed5f23dcc3f814140adc77229e403cb7767032c8d /init.lua
parentaeaae9d84179fc4aee6cf9328d1b84d198719424 (diff)
added support for color ascii rendering
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua31
1 files changed, 6 insertions, 25 deletions
diff --git a/init.lua b/init.lua
index c7f4742..52eb393 100644
--- a/init.lua
+++ b/init.lua
@@ -1,28 +1,9 @@
-local ffi = require 'ffi'
+local sundown = require 'sundown.env'
+local html = require 'sundown.html'
+local ascii = require 'sundown.ascii'
-require 'sundown.sdcdefs'
-require 'sundown.htmlcdefs'
-
-local C = ffi.load(package.searchpath('libsundown', package.cpath))
-local sundown = {C=C}
-
-function sundown.render(txt)
- local callbacks = ffi.new('struct sd_callbacks')
- local options = ffi.new('struct sdhtml_renderopt')
- C.sdhtml_renderer(callbacks, options, 0)
-
- local markdown = C.sd_markdown_new(0xfff, 16, callbacks, options)
-
- local outbuf = ffi.new('struct sd_buf')
- outbuf.data = nil
- outbuf.size = 0
- outbuf.asize = 0
- outbuf.unit = 64
-
- C.sd_markdown_render(outbuf, ffi.cast('const char*', txt), #txt, markdown)
- C.sd_markdown_free(markdown)
-
- return ffi.string(outbuf.data, outbuf.size)
-end
+sundown.render = html.render
+sundown.renderHTML = html.render
+sundown.renderASCII = ascii.render
return sundown