Branch: refs/heads/master Author: Matthew Brush mbrush@codebrainz.ca Committer: Matthew Brush matt@geany.org Date: Mon, 04 Mar 2013 01:27:50 UTC Commit: e244ea510efa17846636d53a24f3893741e3380d https://github.com/geany/geany-plugins/commit/e244ea510efa17846636d53a24f389...
Log Message: ----------- Markdown: Allow choosing between Discount and peg-markdown at compile time
Modified Paths: -------------- markdown/src/viewer.c
Modified: markdown/src/viewer.c 36 files changed, 30 insertions(+), 6 deletions(-) =================================================================== @@ -22,7 +22,11 @@ #include <string.h> #include <gtk/gtk.h> #include <webkit/webkitwebview.h> -#include "markdown_lib.h" +#ifndef FULL_PRICE +# include <mkdio.h> +#else +# include "markdown_lib.h" +#endif #include "viewer.h" #include "conf.h"
@@ -305,11 +309,31 @@ struct _MarkdownViewerPrivate if (!self->priv->text) { update_internal_text(self, ""); } - - md_as_html = markdown_to_string(self->priv->text->str, 0, HTML_FORMAT); - if (md_as_html) { - html = template_replace(self, md_as_html); - g_free(md_as_html); + + { +#ifndef FULL_PRICE /* this version using Discount markdown library + * is faster but may invoke endless discussions + * about the GPL and licenses similar to (but the + * same as) the old BSD 4-clause license being + * incompatible */ + MMIOT *doc; + doc = mkd_string(self->priv->text->str, self->priv->text->len, 0); + mkd_compile(doc, 0); + if (mkd_document(doc, &md_as_html) != EOF) { + html = template_replace(self, md_as_html); + } + mkd_cleanup(doc); +#else /* this version is slower but is unquestionably GPL-friendly + * and the lib also has much more readable/maintainable code */ + + md_as_html = markdown_to_string(self->priv->text->str, 0, HTML_FORMAT); + if (md_as_html) { + html = template_replace(self, md_as_html); + g_free(md_as_html); /* TODO: become 100% convinced this wasn't + * malloc()'d outside of GLIB functions with + * libc allocator (probably same anyway). */ + } +#endif }
return html;
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).