Permalink
Browse files

markdown: Initial commit

No Waf build system yet.
  • Loading branch information...
1 parent 14dc717 commit 1109430680601b8356bac5f37c9a4a1e501b6fba @codebrainz codebrainz committed Jul 15, 2012
Showing with 8,084 additions and 0 deletions.
  1. +4 −0 Makefile.am
  2. +24 −0 build/markdown.m4
  3. +1 −0 configure.ac
  4. +1 −0 markdown/AUTHORS
  5. +339 −0 markdown/COPYING
  6. 0 markdown/ChangeLog
  7. +4 −0 markdown/Makefile.am
  8. 0 markdown/NEWS
  9. +1 −0 markdown/README
  10. +47 −0 markdown/discount/COPYRIGHT
  11. +35 −0 markdown/discount/CREDITS
  12. +61 −0 markdown/discount/Csio.c
  13. +31 −0 markdown/discount/Makefile.am
  14. +111 −0 markdown/discount/amalloc.c
  15. +29 −0 markdown/discount/amalloc.h
  16. +43 −0 markdown/discount/basename.c
  17. +33 −0 markdown/discount/blocktags
  18. +35 −0 markdown/discount/config.h
  19. +85 −0 markdown/discount/css.c
  20. +77 −0 markdown/discount/cstring.h
  21. +961 −0 markdown/discount/discount-changes.patch
  22. +49 −0 markdown/discount/docheader.c
  23. +152 −0 markdown/discount/dumptree.c
  24. +188 −0 markdown/discount/emmatch.c
  25. +84 −0 markdown/discount/flags.c
  26. +1,762 −0 markdown/discount/generate.c
  27. +22 −0 markdown/discount/html5.c
  28. +1,302 −0 markdown/discount/markdown.c
  29. +189 −0 markdown/discount/markdown.h
  30. +357 −0 markdown/discount/mkdio.c
  31. +111 −0 markdown/discount/mkdio.h
  32. +157 −0 markdown/discount/resource.c
  33. +39 −0 markdown/discount/setup.c
  34. +91 −0 markdown/discount/tags.c
  35. +19 −0 markdown/discount/tags.h
  36. +114 −0 markdown/discount/toc.c
  37. +30 −0 markdown/discount/version.c
  38. +82 −0 markdown/discount/xml.c
  39. +48 −0 markdown/discount/xmlpage.c
  40. +2 −0 markdown/docs/Makefile.am
  41. +55 −0 markdown/docs/README.md
  42. +33 −0 markdown/src/Makefile.am
  43. +177 −0 markdown/src/conf.c
  44. +52 −0 markdown/src/conf.h
  45. +46 −0 markdown/src/md.c
  46. +33 −0 markdown/src/md.h
  47. +362 −0 markdown/src/plugin.c
  48. +143 −0 markdown/src/tmpl.c
  49. +51 −0 markdown/src/tmpl.h
  50. +149 −0 markdown/src/tmplmgr.c
  51. +40 −0 markdown/src/tmplmgr.h
  52. +141 −0 markdown/src/viewer.c
  53. +48 −0 markdown/src/viewer.h
  54. +3 −0 markdown/templates/Alternate/Makefile.am
  55. +22 −0 markdown/templates/Alternate/index.html
  56. +3 −0 markdown/templates/Default/Makefile.am
  57. +5 −0 markdown/templates/Default/index.html
  58. +1 −0 markdown/templates/Makefile.am
View
@@ -86,6 +86,10 @@ if ENABLE_GPROJECT
SUBDIRS += gproject
endif
+if ENABLE_MARKDOWN
+SUBDIRS += markdown
+endif
+
if ENABLE_MULTITERM
SUBDIRS += multiterm
endif
View
@@ -0,0 +1,24 @@
+AC_DEFUN([GP_CHECK_MARKDOWN],
+[
+ GP_ARG_DISABLE([markdown], [auto])
+
+ GTK_VERSION=2.16
+ WEBKIT_VERSION=1.1.13
+
+ GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN],
+ [gtk+-2.0 >= ${GTK_VERSION}
+ webkit-1.0 >= ${WEBKIT_VERSION}
+ gthread-2.0])
+
+ GP_STATUS_PLUGIN_ADD([Markdown], [$enable_markdown])
+
+ AC_CONFIG_FILES([
+ markdown/Makefile
+ markdown/discount/Makefile
+ markdown/src/Makefile
+ markdown/templates/Makefile
+ markdown/templates/Default/Makefile
+ markdown/templates/Alternate/Makefile
+ markdown/docs/Makefile
+ ])
+])
View
@@ -45,6 +45,7 @@ GP_CHECK_GEANYVC
GP_CHECK_GEANYPG
GP_CHECK_GENIUSPASTE
GP_CHECK_GPROJECT
+GP_CHECK_MARKDOWN
GP_CHECK_MULTITERM
GP_CHECK_PRETTYPRINTER
GP_CHECK_SHIFTCOLUMN
View
@@ -0,0 +1 @@
+Matthew Brush <mbrush@codebrainz.ca>
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
No changes.
View
@@ -0,0 +1,4 @@
+include $(top_srcdir)/build/vars.auxfiles.mk
+
+SUBDIRS = discount src templates docs
+plugin = markdown
View
No changes.
View
@@ -0,0 +1 @@
+See the ``docs/README.md`` file for more information.
@@ -0,0 +1,47 @@
+->Copyright (C) 2007 David Loren Parsons.
+All rights reserved.<-
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation files
+(the "Software"), to deal in the Software without restriction,
+including without limitation the rights to use, copy, modify, merge,
+publish, distribute, sublicence, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions, and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution, and in the same place and form as other
+ copyright, license and disclaimer information.
+
+ 3. The end-user documentation included with the redistribution, if
+ any, must include the following acknowledgment:
+
+ This product includes software developed by
+ David Loren Parsons <http://www.pell.portland.or.us/~orc>
+
+ in the same place and form as other third-party acknowledgments.
+ Alternately, this acknowledgment may appear in the software
+ itself, in the same form and location as other such third-party
+ acknowledgments.
+
+ 4. Except as contained in this notice, the name of David Loren
+ Parsons shall not be used in advertising or otherwise to promote
+ the sale, use or other dealings in this Software without prior
+ written authorization from David Loren Parsons.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL DAVID LOREN PARSONS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
View
@@ -0,0 +1,35 @@
+Discount is primarily my work, but it has only reached the point
+where it is via contributions, critiques, and bug reports from a
+host of other people, some of which are listed before. If your
+name isn't on this list, please remind me
+ -david parsons (orc@pell.chi.il.us)
+
+
+Josh Wood -- Plan9 support.
+Mike Schiraldi -- Reddit style automatic links, MANY MANY MANY
+ bug reports about boundary conditions and
+ places where I didn't get it right.
+Jjgod Jiang -- Table of contents support.
+Petite Abeille -- Many bug reports about places where I didn't
+ get it right.
+Tim Channon -- inspiration for the `mkd_xhtmlpage()` function
+Christian Herenz-- Many bug reports regarding my implementation of
+ `[]()` and `![]()`
+A.S.Bradbury -- Portability bug reports for 64 bit systems.
+Joyent -- Loan of a solaris box so I could get discount
+ working under solaris.
+Ryan Tomayko -- Portability requests (and the rdiscount ruby
+ binding.)
+yidabu -- feedback on the documentation, bug reports
+ against utf-8 support.
+Pierre Joye -- bug reports, php discount binding.
+Masayoshi Sekimura- perl discount binding.
+Jeremy Hinegardner- bug reports about list handling.
+Andrew White -- bug reports about the format of generated urls.
+Steve Huff -- bug reports about Makefile portability (for Fink)
+Ignacio Burgue?o-- bug reports about `>%class%`
+Henrik Nyh -- bug reports about embedded html handling.
+John J. Foerch -- bug reports about incorrect `&ndash;` and `&mdash;`
+ translations.
+
+
View
@@ -0,0 +1,61 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdarg.h>
+#include "cstring.h"
+#include "markdown.h"
+#include "amalloc.h"
+
+
+/* putc() into a cstring
+ */
+void
+Csputc(int c, Cstring *iot)
+{
+ EXPAND(*iot) = c;
+}
+
+
+/* printf() into a cstring
+ */
+int
+Csprintf(Cstring *iot, char *fmt, ...)
+{
+ va_list ptr;
+ int siz=100;
+
+ do {
+ RESERVE(*iot, siz);
+ va_start(ptr, fmt);
+ siz = vsnprintf(T(*iot)+S(*iot), ALLOCATED(*iot)-S(*iot), fmt, ptr);
+ va_end(ptr);
+ } while ( siz > (ALLOCATED(*iot)-S(*iot)) );
+
+ S(*iot) += siz;
+ return siz;
+}
+
+
+/* write() into a cstring
+ */
+int
+Cswrite(Cstring *iot, char *bfr, int size)
+{
+ RESERVE(*iot, size);
+ memcpy(T(*iot)+S(*iot), bfr, size);
+ S(*iot) += size;
+ return size;
+}
+
+
+/* reparse() into a cstring
+ */
+void
+Csreparse(Cstring *iot, char *buf, int size, int flags)
+{
+ MMIOT f;
+ ___mkd_initmmiot(&f, 0);
+ ___mkd_reparse(buf, size, 0, &f);
+ ___mkd_emblock(&f);
+ SUFFIX(*iot, T(f.out), S(f.out));
+ ___mkd_freemmiot(&f, 0);
+}
@@ -0,0 +1,31 @@
+noinst_LTLIBRARIES = libdiscount.la
+
+libdiscount_la_SOURCES = \
+ amalloc.c \
+ amalloc.h \
+ basename.c \
+ config.h \
+ Csio.c \
+ css.c \
+ cstring.h \
+ docheader.c \
+ dumptree.c \
+ emmatch.c \
+ flags.c \
+ generate.c \
+ html5.c \
+ markdown.c \
+ markdown.h \
+ mkdio.c \
+ mkdio.h \
+ resource.c \
+ setup.c \
+ tags.c \
+ tags.h \
+ toc.c \
+ version.c \
+ xml.c \
+ xmlpage.c
+
+libdiscount_la_CPPFLAGS = @MARKDOWN_CFLAGS@
+libdiscount_la_LIBADD = @MARKDOWN_LIBS@
View
@@ -0,0 +1,111 @@
+/*
+ * debugging malloc()/realloc()/calloc()/free() that attempts
+ * to keep track of just what's been allocated today.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define MAGIC 0x1f2e3d4c
+
+struct alist { int magic, size; struct alist *next, *last; };
+
+static struct alist list = { 0, 0, 0, 0 };
+
+static int mallocs=0;
+static int reallocs=0;
+static int frees=0;
+
+void *
+acalloc(int size, int count)
+{
+ struct alist *ret = calloc(size + sizeof(struct alist), count);
+
+ if ( ret ) {
+ ret->magic = MAGIC;
+ ret->size = size * count;
+ if ( list.next ) {
+ ret->next = list.next;
+ ret->last = &list;
+ ret->next->last = ret;
+ list.next = ret;
+ }
+ else {
+ ret->last = ret->next = &list;
+ list.next = list.last = ret;
+ }
+ ++mallocs;
+ return ret+1;
+ }
+ return 0;
+}
+
+
+void*
+amalloc(int size)
+{
+ return acalloc(size,1);
+}
+
+
+void
+afree(void *ptr)
+{
+ struct alist *p2 = ((struct alist*)ptr)-1;
+
+ if ( p2->magic == MAGIC ) {
+ p2->last->next = p2->next;
+ p2->next->last = p2->last;
+ ++frees;
+ free(p2);
+ }
+ else
+ free(ptr);
+}
+
+
+void *
+arealloc(void *ptr, int size)
+{
+ struct alist *p2 = ((struct alist*)ptr)-1;
+ struct alist save;
+
+ if ( p2->magic == MAGIC ) {
+ save.next = p2->next;
+ save.last = p2->last;
+ p2 = realloc(p2, sizeof(*p2) + size);
+
+ if ( p2 ) {
+ p2->size = size;
+ p2->next->last = p2;
+ p2->last->next = p2;
+ ++reallocs;
+ return p2+1;
+ }
+ else {
+ save.next->last = save.last;
+ save.last->next = save.next;
+ return 0;
+ }
+ }
+ return realloc(ptr, size);
+}
+
+
+void
+adump()
+{
+ struct alist *p;
+
+
+ for ( p = list.next; p && (p != &list); p = p->next ) {
+ fprintf(stderr, "allocated: %d byte%s\n", p->size, (p->size==1) ? "" : "s");
+ fprintf(stderr, " [%.*s]\n", p->size, (char*)(p+1));
+ }
+
+ if ( getenv("AMALLOC_STATISTICS") ) {
+ fprintf(stderr, "%d malloc%s\n", mallocs, (mallocs==1)?"":"s");
+ fprintf(stderr, "%d realloc%s\n", reallocs, (reallocs==1)?"":"s");
+ fprintf(stderr, "%d free%s\n", frees, (frees==1)?"":"s");
+ }
+}
@@ -0,0 +1,29 @@
+/*
+ * debugging malloc()/realloc()/calloc()/free() that attempts
+ * to keep track of just what's been allocated today.
+ */
+#ifndef AMALLOC_D
+#define AMALLOC_D
+
+#include "config.h"
+
+#ifdef USE_AMALLOC
+
+extern void *amalloc(int);
+extern void *acalloc(int,int);
+extern void *arealloc(void*,int);
+extern void afree(void*);
+extern void adump();
+
+#define malloc amalloc
+#define calloc acalloc
+#define realloc arealloc
+#define free afree
+
+#else
+
+#define adump() (void)1
+
+#endif
+
+#endif/*AMALLOC_D*/
Oops, something went wrong.

0 comments on commit 1109430

Please sign in to comment.