misc fixes
This commit is contained in:
parent
17601e4a30
commit
584a9d7c2a
12
TODO
12
TODO
|
@ -1,13 +1,13 @@
|
|||
- dexter executable argp
|
||||
# - dexter executable argp
|
||||
- memory leaks
|
||||
# - output raw xslt
|
||||
- define stable c api
|
||||
# - define stable c api
|
||||
- reorganize project (at least tests, makefile.am src?!)
|
||||
- p/br support explicit
|
||||
# - p/br support explicit
|
||||
- p/br support needs div?!
|
||||
- dex_parse_url support
|
||||
- ruby binding for dex_parse_url
|
||||
- relative urls
|
||||
# - dex_parse_url support
|
||||
# - ruby binding for dex_parse_url
|
||||
# - relative urls
|
||||
- p/br support needs multicase handling
|
||||
- windows, linux builds
|
||||
- flags?!
|
||||
|
|
12
dexter.c
12
dexter.c
|
@ -48,7 +48,7 @@ xmlDocPtr dex_parse_file(dexPtr dex, char* file, boolean html) {
|
|||
xmlDocPtr dex_parse_string(dexPtr dex, char* string, size_t size, boolean html) {
|
||||
if(html) {
|
||||
htmlParserCtxtPtr htmlCtxt = htmlNewParserCtxt();
|
||||
htmlDocPtr html = htmlCtxtReadMemory(htmlCtxt, string, size, "http://foo", "UTF-8", 3);
|
||||
htmlDocPtr html = htmlCtxtReadMemory(htmlCtxt, string, size, "http://kylemaxwell.com/dexter/memory", "UTF-8", 3);
|
||||
if(html == NULL) {
|
||||
asprintf(&dex->error, "Couldn't parse string\n");
|
||||
return NULL;
|
||||
|
@ -56,7 +56,7 @@ xmlDocPtr dex_parse_string(dexPtr dex, char* string, size_t size, boolean html)
|
|||
return dex_parse_doc(dex, html);
|
||||
} else {
|
||||
xmlParserCtxtPtr ctxt = xmlNewParserCtxt();
|
||||
xmlDocPtr xml = xmlCtxtReadMemory(ctxt, string, size, "http://foo", "UTF-8", 3);
|
||||
xmlDocPtr xml = xmlCtxtReadMemory(ctxt, string, size, "http://kylemaxwell.com/dexter/memory", "UTF-8", 3);
|
||||
if(xml == NULL) {
|
||||
asprintf(&dex->error, "Couldn't parse string\n");
|
||||
return NULL;
|
||||
|
@ -115,9 +115,9 @@ dexPtr dex_compile(char* dex_str, char* incl) {
|
|||
sprintbuf(buf, "<xsl:variable name=\"out\"><xsl:apply-templates mode=\"innertext\" select=\"exsl:node-set($in)\"/></xsl:variable>");
|
||||
sprintbuf(buf, "<func:result select=\"$out\" /></func:function>");
|
||||
sprintbuf(buf, "<xsl:template match=\"text()\" mode=\"innertext\"><xsl:value-of select=\".\" /></xsl:template>");
|
||||
sprintbuf(buf, "<xsl:template match=\"br\" mode=\"innertext\"><xsl:apply-templates mode=\"innertext\" /><xsl:text>\n</xsl:text></xsl:template>");
|
||||
sprintbuf(buf, "<xsl:template match=\"p\" mode=\"innertext\"><xsl:apply-templates mode=\"innertext\" /><xsl:text>\n\n</xsl:text></xsl:template>");
|
||||
|
||||
sprintbuf(buf, "<xsl:template match=\"script|style\" mode=\"innertext\"/>");
|
||||
sprintbuf(buf, "<xsl:template match=\"br|address|blockquote|center|dir|div|form|h1|h2|h3|h4|h5|h6|hr|menu|noframes|noscript|p|pre|li|td|th|p\" mode=\"innertext\"><xsl:apply-templates mode=\"innertext\" /><xsl:text>\n</xsl:text></xsl:template>");
|
||||
// sprintbuf(buf, "<xsl:template match=\"node()\" mode=\"innertext\"><xsl:apply-templates mode=\"innertext\" select=\"n\" /></xsl:template>");
|
||||
sprintbuf(buf, "%s\n", incl);
|
||||
sprintbuf(buf, "<xsl:template match=\"/\">\n");
|
||||
sprintbuf(buf, "<dexter:root>\n");
|
||||
|
@ -135,7 +135,7 @@ dexPtr dex_compile(char* dex_str, char* incl) {
|
|||
|
||||
if(dex->error == NULL) {
|
||||
xmlParserCtxtPtr ctxt = xmlNewParserCtxt();
|
||||
xmlDocPtr doc = xmlCtxtReadMemory(ctxt, buf->buf, buf->size, "http://kylemaxwell.com/some-dex", "UTF-8", 3);
|
||||
xmlDocPtr doc = xmlCtxtReadMemory(ctxt, buf->buf, buf->size, "http://kylemaxwell.com/dexter/compiled", "UTF-8", 3);
|
||||
dex->raw_stylesheet = strdup(buf->buf);
|
||||
dex->stylesheet = xsltParseStylesheetDoc(doc);
|
||||
}
|
||||
|
|
|
@ -370,7 +370,7 @@ xsltHtmlDocLoader(const xmlChar * URI, xmlDictPtr dict, int options,
|
|||
if (pctxt->directory == NULL)
|
||||
pctxt->directory = xmlParserGetDirectory((const char *) URI);
|
||||
|
||||
htmlDoRead(pctxt, NULL, NULL, options | HTML_PARSE_RECOVER | , 1);
|
||||
htmlDoRead(pctxt, NULL, NULL, options | HTML_PARSE_RECOVER, 1);
|
||||
|
||||
if (pctxt->wellFormed) {
|
||||
doc = pctxt->myDoc;
|
||||
|
|
Loading…
Reference in New Issue