Cleaned up wrapper.h.
This commit is contained in:
parent
d7cc8ec83c
commit
6472b126aa
170
src/misaka.c
170
src/misaka.c
|
@ -1,4 +1,4 @@
|
|||
/* Generated by Cython 0.15.1 on Sun Nov 20 22:19:48 2011 */
|
||||
/* Generated by Cython 0.15.1 on Sun Nov 20 22:36:01 2011 */
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
|
@ -524,6 +524,7 @@ static char __pyx_k____class__[] = "__class__";
|
|||
static char __pyx_k__EXT_TABLES[] = "EXT_TABLES";
|
||||
static char __pyx_k__ValueError[] = "ValueError";
|
||||
static char __pyx_k__extensions[] = "extensions";
|
||||
static char __pyx_k__preprocess[] = "preprocess";
|
||||
static char __pyx_k____version__[] = "__version__";
|
||||
static char __pyx_k__postprocess[] = "postprocess";
|
||||
static char __pyx_k__EXT_AUTOLINK[] = "EXT_AUTOLINK";
|
||||
|
@ -577,6 +578,7 @@ static PyObject *__pyx_n_s__flags;
|
|||
static PyObject *__pyx_n_s__html;
|
||||
static PyObject *__pyx_n_s__misaka;
|
||||
static PyObject *__pyx_n_s__postprocess;
|
||||
static PyObject *__pyx_n_s__preprocess;
|
||||
static PyObject *__pyx_n_s__render_flags;
|
||||
static PyObject *__pyx_n_s__renderer;
|
||||
static PyObject *__pyx_n_s__setup;
|
||||
|
@ -1621,8 +1623,8 @@ static int __pyx_pf_6misaka_8Markdown___cinit__(PyObject *__pyx_v_self, PyObject
|
|||
* <sundown.html_renderopt *> &self.renderer.options)
|
||||
*
|
||||
* def render(self, object text): # <<<<<<<<<<<<<<
|
||||
*
|
||||
* # Convert string
|
||||
* if hasattr(self.renderer, 'preprocess'):
|
||||
* text = self.renderer.preprocess(text)
|
||||
*/
|
||||
|
||||
static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyObject *__pyx_v_text); /*proto*/
|
||||
|
@ -1635,42 +1637,83 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
__Pyx_RefNannyDeclarations
|
||||
PyObject *__pyx_t_1 = NULL;
|
||||
PyObject *__pyx_t_2 = NULL;
|
||||
char *__pyx_t_3;
|
||||
int __pyx_t_4;
|
||||
PyObject *__pyx_t_5 = NULL;
|
||||
int __pyx_t_3;
|
||||
PyObject *__pyx_t_4 = NULL;
|
||||
char *__pyx_t_5;
|
||||
int __pyx_lineno = 0;
|
||||
const char *__pyx_filename = NULL;
|
||||
int __pyx_clineno = 0;
|
||||
__Pyx_RefNannySetupContext("render");
|
||||
__Pyx_INCREF(__pyx_v_text);
|
||||
|
||||
/* "misaka.pyx":154
|
||||
/* "misaka.pyx":152
|
||||
*
|
||||
* def render(self, object text):
|
||||
* if hasattr(self.renderer, 'preprocess'): # <<<<<<<<<<<<<<
|
||||
* text = self.renderer.preprocess(text)
|
||||
*
|
||||
*/
|
||||
__pyx_t_1 = ((PyObject *)((struct __pyx_obj_6misaka_Markdown *)__pyx_v_self)->renderer);
|
||||
__Pyx_INCREF(__pyx_t_1);
|
||||
__pyx_t_2 = ((PyObject *)__pyx_n_s__preprocess);
|
||||
__Pyx_INCREF(__pyx_t_2);
|
||||
__pyx_t_3 = PyObject_HasAttr(__pyx_t_1, __pyx_t_2); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||
if (__pyx_t_3) {
|
||||
|
||||
/* "misaka.pyx":153
|
||||
* def render(self, object text):
|
||||
* if hasattr(self.renderer, 'preprocess'):
|
||||
* text = self.renderer.preprocess(text) # <<<<<<<<<<<<<<
|
||||
*
|
||||
* # Convert string
|
||||
*/
|
||||
__pyx_t_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6misaka_Markdown *)__pyx_v_self)->renderer), __pyx_n_s__preprocess); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
|
||||
__Pyx_INCREF(__pyx_v_text);
|
||||
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_text);
|
||||
__Pyx_GIVEREF(__pyx_v_text);
|
||||
__pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_4);
|
||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
|
||||
__Pyx_DECREF(__pyx_v_text);
|
||||
__pyx_v_text = __pyx_t_4;
|
||||
__pyx_t_4 = 0;
|
||||
goto __pyx_L5;
|
||||
}
|
||||
__pyx_L5:;
|
||||
|
||||
/* "misaka.pyx":156
|
||||
*
|
||||
* # Convert string
|
||||
* cdef bytes py_string = text.encode('UTF-8') # <<<<<<<<<<<<<<
|
||||
* cdef char *c_string = py_string
|
||||
* del py_string
|
||||
*/
|
||||
__pyx_t_1 = PyObject_GetAttr(__pyx_v_text, __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_t_4 = PyObject_GetAttr(__pyx_v_text, __pyx_n_s__encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_4);
|
||||
__pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_1);
|
||||
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||
if (!(likely(PyBytes_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_v_py_string = ((PyObject*)__pyx_t_2);
|
||||
__pyx_t_2 = 0;
|
||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||
if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected bytes, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_v_py_string = ((PyObject*)__pyx_t_1);
|
||||
__pyx_t_1 = 0;
|
||||
|
||||
/* "misaka.pyx":155
|
||||
/* "misaka.pyx":157
|
||||
* # Convert string
|
||||
* cdef bytes py_string = text.encode('UTF-8')
|
||||
* cdef char *c_string = py_string # <<<<<<<<<<<<<<
|
||||
* del py_string
|
||||
*
|
||||
*/
|
||||
__pyx_t_3 = PyBytes_AsString(((PyObject *)__pyx_v_py_string)); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_v_c_string = __pyx_t_3;
|
||||
__pyx_t_5 = PyBytes_AsString(((PyObject *)__pyx_v_py_string)); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_v_c_string = __pyx_t_5;
|
||||
|
||||
/* "misaka.pyx":156
|
||||
/* "misaka.pyx":158
|
||||
* cdef bytes py_string = text.encode('UTF-8')
|
||||
* cdef char *c_string = py_string
|
||||
* del py_string # <<<<<<<<<<<<<<
|
||||
|
@ -1680,7 +1723,7 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
__Pyx_DECREF(((PyObject *)__pyx_v_py_string));
|
||||
__pyx_v_py_string = NULL;
|
||||
|
||||
/* "misaka.pyx":159
|
||||
/* "misaka.pyx":161
|
||||
*
|
||||
* # Buffers
|
||||
* cdef sundown.buf *ib = sundown.bufnew(128) # <<<<<<<<<<<<<<
|
||||
|
@ -1689,7 +1732,7 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
*/
|
||||
__pyx_v_ib = bufnew(128);
|
||||
|
||||
/* "misaka.pyx":160
|
||||
/* "misaka.pyx":162
|
||||
* # Buffers
|
||||
* cdef sundown.buf *ib = sundown.bufnew(128)
|
||||
* sundown.bufputs(ib, c_string) # <<<<<<<<<<<<<<
|
||||
|
@ -1698,7 +1741,7 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
*/
|
||||
bufputs(__pyx_v_ib, __pyx_v_c_string);
|
||||
|
||||
/* "misaka.pyx":162
|
||||
/* "misaka.pyx":164
|
||||
* sundown.bufputs(ib, c_string)
|
||||
*
|
||||
* cdef sundown.buf *ob = sundown.bufnew(128) # <<<<<<<<<<<<<<
|
||||
|
@ -1707,7 +1750,7 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
*/
|
||||
__pyx_v_ob = bufnew(128);
|
||||
|
||||
/* "misaka.pyx":163
|
||||
/* "misaka.pyx":165
|
||||
*
|
||||
* cdef sundown.buf *ob = sundown.bufnew(128)
|
||||
* sundown.bufgrow(ob, <size_t> (ib.size * 1.4)) # <<<<<<<<<<<<<<
|
||||
|
@ -1716,7 +1759,7 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
*/
|
||||
bufgrow(__pyx_v_ob, ((size_t)(__pyx_v_ib->size * 1.4)));
|
||||
|
||||
/* "misaka.pyx":166
|
||||
/* "misaka.pyx":168
|
||||
*
|
||||
* # Parse! And make a unicode string
|
||||
* sundown.sd_markdown_render(ob, ib.data, ib.size, self.markdown) # <<<<<<<<<<<<<<
|
||||
|
@ -1725,61 +1768,61 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
*/
|
||||
sd_markdown_render(__pyx_v_ob, __pyx_v_ib->data, __pyx_v_ib->size, ((struct __pyx_obj_6misaka_Markdown *)__pyx_v_self)->markdown);
|
||||
|
||||
/* "misaka.pyx":167
|
||||
/* "misaka.pyx":169
|
||||
* # Parse! And make a unicode string
|
||||
* sundown.sd_markdown_render(ob, ib.data, ib.size, self.markdown)
|
||||
* text = (<char *> ob.data)[:ob.size].decode('UTF-8', 'strict') # <<<<<<<<<<<<<<
|
||||
*
|
||||
* if hasattr(self.renderer, 'postprocess'):
|
||||
*/
|
||||
__pyx_t_2 = ((PyObject *)PyUnicode_DecodeUTF8(((char *)__pyx_v_ob->data), __pyx_v_ob->size, NULL)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
|
||||
__pyx_t_1 = ((PyObject *)PyUnicode_DecodeUTF8(((char *)__pyx_v_ob->data), __pyx_v_ob->size, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
|
||||
__Pyx_DECREF(__pyx_v_text);
|
||||
__pyx_v_text = ((PyObject *)__pyx_t_2);
|
||||
__pyx_t_2 = 0;
|
||||
__pyx_v_text = ((PyObject *)__pyx_t_1);
|
||||
__pyx_t_1 = 0;
|
||||
|
||||
/* "misaka.pyx":169
|
||||
/* "misaka.pyx":171
|
||||
* text = (<char *> ob.data)[:ob.size].decode('UTF-8', 'strict')
|
||||
*
|
||||
* if hasattr(self.renderer, 'postprocess'): # <<<<<<<<<<<<<<
|
||||
* text = self.renderer.postprocess(text)
|
||||
*
|
||||
*/
|
||||
__pyx_t_2 = ((PyObject *)((struct __pyx_obj_6misaka_Markdown *)__pyx_v_self)->renderer);
|
||||
__Pyx_INCREF(__pyx_t_2);
|
||||
__pyx_t_1 = ((PyObject *)__pyx_n_s__postprocess);
|
||||
__pyx_t_1 = ((PyObject *)((struct __pyx_obj_6misaka_Markdown *)__pyx_v_self)->renderer);
|
||||
__Pyx_INCREF(__pyx_t_1);
|
||||
__pyx_t_4 = PyObject_HasAttr(__pyx_t_2, __pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
||||
__pyx_t_4 = ((PyObject *)__pyx_n_s__postprocess);
|
||||
__Pyx_INCREF(__pyx_t_4);
|
||||
__pyx_t_3 = PyObject_HasAttr(__pyx_t_1, __pyx_t_4); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||
if (__pyx_t_4) {
|
||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||
if (__pyx_t_3) {
|
||||
|
||||
/* "misaka.pyx":170
|
||||
/* "misaka.pyx":172
|
||||
*
|
||||
* if hasattr(self.renderer, 'postprocess'):
|
||||
* text = self.renderer.postprocess(text) # <<<<<<<<<<<<<<
|
||||
*
|
||||
* # Return a string and release buffers
|
||||
*/
|
||||
__pyx_t_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6misaka_Markdown *)__pyx_v_self)->renderer), __pyx_n_s__postprocess); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_1);
|
||||
__pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(((PyObject *)__pyx_t_2));
|
||||
__pyx_t_4 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6misaka_Markdown *)__pyx_v_self)->renderer), __pyx_n_s__postprocess); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_4);
|
||||
__pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(((PyObject *)__pyx_t_1));
|
||||
__Pyx_INCREF(__pyx_v_text);
|
||||
PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_text);
|
||||
PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_text);
|
||||
__Pyx_GIVEREF(__pyx_v_text);
|
||||
__pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_5);
|
||||
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
||||
__Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
|
||||
__pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(__pyx_t_2);
|
||||
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
||||
__Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
|
||||
__Pyx_DECREF(__pyx_v_text);
|
||||
__pyx_v_text = __pyx_t_5;
|
||||
__pyx_t_5 = 0;
|
||||
goto __pyx_L5;
|
||||
__pyx_v_text = __pyx_t_2;
|
||||
__pyx_t_2 = 0;
|
||||
goto __pyx_L6;
|
||||
}
|
||||
__pyx_L5:;
|
||||
__pyx_L6:;
|
||||
|
||||
/* "misaka.pyx":173
|
||||
/* "misaka.pyx":175
|
||||
*
|
||||
* # Return a string and release buffers
|
||||
* try: # <<<<<<<<<<<<<<
|
||||
|
@ -1788,7 +1831,7 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
*/
|
||||
/*try:*/ {
|
||||
|
||||
/* "misaka.pyx":174
|
||||
/* "misaka.pyx":176
|
||||
* # Return a string and release buffers
|
||||
* try:
|
||||
* return text # <<<<<<<<<<<<<<
|
||||
|
@ -1798,10 +1841,10 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
__Pyx_XDECREF(__pyx_r);
|
||||
__Pyx_INCREF(__pyx_v_text);
|
||||
__pyx_r = __pyx_v_text;
|
||||
goto __pyx_L6;
|
||||
goto __pyx_L7;
|
||||
}
|
||||
|
||||
/* "misaka.pyx":176
|
||||
/* "misaka.pyx":178
|
||||
* return text
|
||||
* finally:
|
||||
* sundown.bufrelease(ob) # <<<<<<<<<<<<<<
|
||||
|
@ -1810,12 +1853,12 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
*/
|
||||
/*finally:*/ {
|
||||
int __pyx_why;
|
||||
__pyx_why = 0; goto __pyx_L8;
|
||||
__pyx_L6: __pyx_why = 3; goto __pyx_L8;
|
||||
__pyx_L8:;
|
||||
__pyx_why = 0; goto __pyx_L9;
|
||||
__pyx_L7: __pyx_why = 3; goto __pyx_L9;
|
||||
__pyx_L9:;
|
||||
bufrelease(__pyx_v_ob);
|
||||
|
||||
/* "misaka.pyx":177
|
||||
/* "misaka.pyx":179
|
||||
* finally:
|
||||
* sundown.bufrelease(ob)
|
||||
* sundown.bufrelease(ib) # <<<<<<<<<<<<<<
|
||||
|
@ -1833,7 +1876,7 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
__pyx_L1_error:;
|
||||
__Pyx_XDECREF(__pyx_t_1);
|
||||
__Pyx_XDECREF(__pyx_t_2);
|
||||
__Pyx_XDECREF(__pyx_t_5);
|
||||
__Pyx_XDECREF(__pyx_t_4);
|
||||
__Pyx_AddTraceback("misaka.Markdown.render", __pyx_clineno, __pyx_lineno, __pyx_filename);
|
||||
__pyx_r = NULL;
|
||||
__pyx_L0:;
|
||||
|
@ -1844,7 +1887,7 @@ static PyObject *__pyx_pf_6misaka_8Markdown_1render(PyObject *__pyx_v_self, PyOb
|
|||
return __pyx_r;
|
||||
}
|
||||
|
||||
/* "misaka.pyx":179
|
||||
/* "misaka.pyx":181
|
||||
* sundown.bufrelease(ib)
|
||||
*
|
||||
* def __dealloc__(self): # <<<<<<<<<<<<<<
|
||||
|
@ -1858,7 +1901,7 @@ static void __pyx_pf_6misaka_8Markdown_2__dealloc__(PyObject *__pyx_v_self) {
|
|||
int __pyx_t_1;
|
||||
__Pyx_RefNannySetupContext("__dealloc__");
|
||||
|
||||
/* "misaka.pyx":180
|
||||
/* "misaka.pyx":182
|
||||
*
|
||||
* def __dealloc__(self):
|
||||
* if self.markdown is not NULL: # <<<<<<<<<<<<<<
|
||||
|
@ -1867,7 +1910,7 @@ static void __pyx_pf_6misaka_8Markdown_2__dealloc__(PyObject *__pyx_v_self) {
|
|||
__pyx_t_1 = (((struct __pyx_obj_6misaka_Markdown *)__pyx_v_self)->markdown != NULL);
|
||||
if (__pyx_t_1) {
|
||||
|
||||
/* "misaka.pyx":181
|
||||
/* "misaka.pyx":183
|
||||
* def __dealloc__(self):
|
||||
* if self.markdown is not NULL:
|
||||
* sundown.sd_markdown_free(self.markdown) # <<<<<<<<<<<<<<
|
||||
|
@ -2817,6 +2860,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
|||
{&__pyx_n_s__html, __pyx_k__html, sizeof(__pyx_k__html), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__misaka, __pyx_k__misaka, sizeof(__pyx_k__misaka), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__postprocess, __pyx_k__postprocess, sizeof(__pyx_k__postprocess), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__preprocess, __pyx_k__preprocess, sizeof(__pyx_k__preprocess), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__render_flags, __pyx_k__render_flags, sizeof(__pyx_k__render_flags), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__renderer, __pyx_k__renderer, sizeof(__pyx_k__renderer), 0, 0, 1, 1},
|
||||
{&__pyx_n_s__setup, __pyx_k__setup, sizeof(__pyx_k__setup), 0, 0, 1, 1},
|
||||
|
@ -2862,14 +2906,14 @@ static int __Pyx_InitCachedConstants(void) {
|
|||
__Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
|
||||
__Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3));
|
||||
|
||||
/* "misaka.pyx":154
|
||||
/* "misaka.pyx":156
|
||||
*
|
||||
* # Convert string
|
||||
* cdef bytes py_string = text.encode('UTF-8') # <<<<<<<<<<<<<<
|
||||
* cdef char *c_string = py_string
|
||||
* del py_string
|
||||
*/
|
||||
__pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
||||
__Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5));
|
||||
__Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
|
||||
PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_1));
|
||||
|
|
|
@ -149,7 +149,6 @@ cdef class Markdown:
|
|||
<sundown.html_renderopt *> &self.renderer.options)
|
||||
|
||||
def render(self, object text):
|
||||
|
||||
if hasattr(self.renderer, 'preprocess'):
|
||||
text = self.renderer.preprocess(text)
|
||||
|
||||
|
|
122
src/wrapper.c
122
src/wrapper.c
|
@ -28,7 +28,7 @@
|
|||
----------- */
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_blockcode(struct buf *ob, const struct buf *text, const struct buf *lang, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -41,7 +41,7 @@ rndr_blockcode(struct buf *ob, const struct buf *text, const struct buf *lang, v
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_blockquote(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -53,7 +53,7 @@ rndr_blockquote(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_raw_block(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -65,7 +65,7 @@ rndr_raw_block(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_header(struct buf *ob, const struct buf *text, int level, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -78,7 +78,7 @@ rndr_header(struct buf *ob, const struct buf *text, int level, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_hrule(struct buf *ob, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -88,7 +88,7 @@ rndr_hrule(struct buf *ob, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_list(struct buf *ob, const struct buf *text, int flags, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -101,7 +101,7 @@ rndr_list(struct buf *ob, const struct buf *text, int flags, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_listitem(struct buf *ob, const struct buf *text, int flags, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -114,7 +114,7 @@ rndr_listitem(struct buf *ob, const struct buf *text, int flags, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_paragraph(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -126,7 +126,7 @@ rndr_paragraph(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_table(struct buf *ob, const struct buf *header, const struct buf *body, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -139,7 +139,7 @@ rndr_table(struct buf *ob, const struct buf *header, const struct buf *body, voi
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_tablerow(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -151,7 +151,7 @@ rndr_tablerow(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_tablecell(struct buf *ob, const struct buf *text, int align, void *opaque)
|
||||
{
|
||||
char *str_align;
|
||||
|
@ -188,7 +188,7 @@ rndr_tablecell(struct buf *ob, const struct buf *text, int align, void *opaque)
|
|||
---------- */
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_autolink(struct buf *ob, const struct buf *link, enum mkd_autolink type, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -201,7 +201,7 @@ rndr_autolink(struct buf *ob, const struct buf *link, enum mkd_autolink type, vo
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_codespan(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -213,7 +213,7 @@ rndr_codespan(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_double_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -225,7 +225,7 @@ rndr_double_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -237,7 +237,7 @@ rndr_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_image(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *alt, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -251,7 +251,7 @@ rndr_image(struct buf *ob, const struct buf *link, const struct buf *title, cons
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_linebreak(struct buf *ob, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -261,7 +261,7 @@ rndr_linebreak(struct buf *ob, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_link(struct buf *ob, const struct buf *link, const struct buf *title, const struct buf *content, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -275,7 +275,7 @@ rndr_link(struct buf *ob, const struct buf *link, const struct buf *title, const
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_raw_html(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -287,7 +287,7 @@ rndr_raw_html(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_triple_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -299,7 +299,7 @@ rndr_triple_emphasis(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_strikethrough(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -311,7 +311,7 @@ rndr_strikethrough(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
static int
|
||||
rndr_superscript(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -327,7 +327,7 @@ rndr_superscript(struct buf *ob, const struct buf *text, void *opaque)
|
|||
------------- */
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_entity(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -339,7 +339,7 @@ rndr_entity(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_normal_text(struct buf *ob, const struct buf *text, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -351,7 +351,7 @@ rndr_normal_text(struct buf *ob, const struct buf *text, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_doc_header(struct buf *ob, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -361,7 +361,7 @@ rndr_doc_header(struct buf *ob, void *opaque)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
rndr_doc_footer(struct buf *ob, void *opaque)
|
||||
{
|
||||
struct renderopt *opt = opaque;
|
||||
|
@ -369,3 +369,73 @@ rndr_doc_footer(struct buf *ob, void *opaque)
|
|||
(PyObject *) opt->self, "doc_footer", NULL);
|
||||
BLOCK_PROCESS_OUTPUT(ret);
|
||||
}
|
||||
|
||||
|
||||
struct sd_callbacks callback_funcs = {
|
||||
rndr_blockcode,
|
||||
rndr_blockquote,
|
||||
rndr_raw_block,
|
||||
rndr_header,
|
||||
rndr_hrule,
|
||||
rndr_list,
|
||||
rndr_listitem,
|
||||
rndr_paragraph,
|
||||
rndr_table,
|
||||
rndr_tablerow,
|
||||
rndr_tablecell,
|
||||
|
||||
rndr_autolink,
|
||||
rndr_codespan,
|
||||
rndr_double_emphasis,
|
||||
rndr_emphasis,
|
||||
rndr_image,
|
||||
rndr_linebreak,
|
||||
rndr_link,
|
||||
rndr_raw_html,
|
||||
rndr_triple_emphasis,
|
||||
rndr_strikethrough,
|
||||
rndr_superscript,
|
||||
|
||||
rndr_entity,
|
||||
rndr_normal_text,
|
||||
|
||||
rndr_doc_header,
|
||||
rndr_doc_footer,
|
||||
};
|
||||
|
||||
|
||||
const char *method_names[] = {
|
||||
"block_code",
|
||||
"block_quote",
|
||||
"block_html",
|
||||
"header",
|
||||
"hrule",
|
||||
"list",
|
||||
"list_item",
|
||||
"paragraph",
|
||||
"table",
|
||||
"table_row",
|
||||
"table_cell",
|
||||
|
||||
"autolink",
|
||||
"codespan",
|
||||
"double_emphasis",
|
||||
"emphasis",
|
||||
"image",
|
||||
"linebreak",
|
||||
"link",
|
||||
"raw_html",
|
||||
"triple_emphasis",
|
||||
"strikethrough",
|
||||
"superscript",
|
||||
|
||||
"entity",
|
||||
"normal_text",
|
||||
|
||||
"doc_header",
|
||||
"doc_footer"
|
||||
};
|
||||
|
||||
|
||||
const size_t method_count = sizeof(
|
||||
method_names)/sizeof(char *);
|
||||
|
|
226
src/wrapper.h
226
src/wrapper.h
|
@ -10,226 +10,6 @@ struct renderopt {
|
|||
};
|
||||
|
||||
|
||||
/* Block level
|
||||
----------- */
|
||||
|
||||
|
||||
void rndr_blockcode(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
const struct buf *lang,
|
||||
void *opaque);
|
||||
|
||||
void rndr_blockquote(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
void rndr_raw_block(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
void rndr_header(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
int level,
|
||||
void *opaque);
|
||||
|
||||
void rndr_hrule (
|
||||
struct buf *ob,
|
||||
void *opaque);
|
||||
|
||||
void rndr_list(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
int flags,
|
||||
void *opaque);
|
||||
|
||||
void rndr_listitem(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
int flags,
|
||||
void *opaque);
|
||||
|
||||
void rndr_paragraph(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
void rndr_table(
|
||||
struct buf *ob,
|
||||
const struct buf *header,
|
||||
const struct buf *body,
|
||||
void *opaque);
|
||||
|
||||
void rndr_tablerow(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
void rndr_tablecell(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
int align,
|
||||
void *opaque);
|
||||
|
||||
|
||||
/* Span level
|
||||
---------- */
|
||||
|
||||
|
||||
int rndr_autolink(
|
||||
struct buf *ob,
|
||||
const struct buf *link,
|
||||
enum mkd_autolink type,
|
||||
void *opaque);
|
||||
|
||||
int rndr_codespan(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
int rndr_double_emphasis(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
int rndr_emphasis(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
int rndr_image(
|
||||
struct buf *ob,
|
||||
const struct buf *link,
|
||||
const struct buf *title,
|
||||
const struct buf *alt,
|
||||
void *opaque);
|
||||
|
||||
int rndr_linebreak(
|
||||
struct buf *ob, void *opaque);
|
||||
|
||||
int rndr_link(
|
||||
struct buf *ob,
|
||||
const struct buf *link,
|
||||
const struct buf *title,
|
||||
const struct buf *content,
|
||||
void *opaque);
|
||||
|
||||
int rndr_raw_html(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
int rndr_triple_emphasis(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
int rndr_strikethrough(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
int rndr_superscript(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
|
||||
/* Direct writes
|
||||
------------- */
|
||||
|
||||
|
||||
void rndr_entity(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
void rndr_normal_text(
|
||||
struct buf *ob,
|
||||
const struct buf *text,
|
||||
void *opaque);
|
||||
|
||||
void rndr_doc_header(
|
||||
struct buf *ob,
|
||||
void *opaque);
|
||||
|
||||
void rndr_doc_footer(
|
||||
struct buf *ob,
|
||||
void *opaque);
|
||||
|
||||
|
||||
/* Lists
|
||||
----- */
|
||||
|
||||
|
||||
static struct sd_callbacks callback_funcs = {
|
||||
rndr_blockcode,
|
||||
rndr_blockquote,
|
||||
rndr_raw_block,
|
||||
rndr_header,
|
||||
rndr_hrule,
|
||||
rndr_list,
|
||||
rndr_listitem,
|
||||
rndr_paragraph,
|
||||
rndr_table,
|
||||
rndr_tablerow,
|
||||
rndr_tablecell,
|
||||
|
||||
rndr_autolink,
|
||||
rndr_codespan,
|
||||
rndr_double_emphasis,
|
||||
rndr_emphasis,
|
||||
rndr_image,
|
||||
rndr_linebreak,
|
||||
rndr_link,
|
||||
rndr_raw_html,
|
||||
rndr_triple_emphasis,
|
||||
rndr_strikethrough,
|
||||
rndr_superscript,
|
||||
|
||||
rndr_entity,
|
||||
rndr_normal_text,
|
||||
|
||||
rndr_doc_header,
|
||||
rndr_doc_footer,
|
||||
};
|
||||
|
||||
|
||||
static const char *method_names[] = {
|
||||
"block_code",
|
||||
"block_quote",
|
||||
"block_html",
|
||||
"header",
|
||||
"hrule",
|
||||
"list",
|
||||
"list_item",
|
||||
"paragraph",
|
||||
"table",
|
||||
"table_row",
|
||||
"table_cell",
|
||||
|
||||
"autolink",
|
||||
"codespan",
|
||||
"double_emphasis",
|
||||
"emphasis",
|
||||
"image",
|
||||
"linebreak",
|
||||
"link",
|
||||
"raw_html",
|
||||
"triple_emphasis",
|
||||
"strikethrough",
|
||||
"superscript",
|
||||
|
||||
"entity",
|
||||
"normal_text",
|
||||
|
||||
"doc_header",
|
||||
"doc_footer"
|
||||
};
|
||||
|
||||
|
||||
static const size_t method_count = sizeof(
|
||||
method_names)/sizeof(char *);
|
||||
extern struct sd_callbacks callback_funcs;
|
||||
extern const char *method_names[];
|
||||
extern const size_t method_count;
|
||||
|
|
Loading…
Reference in New Issue