Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
58 changed files
with
8,084 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 | |||
]) | |||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
Matthew Brush <mbrush@codebrainz.ca> |
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
include $(top_srcdir)/build/vars.auxfiles.mk | |||
|
|||
SUBDIRS = discount src templates docs | |||
plugin = markdown |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1 @@ | |||
See the ``docs/README.md`` file for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 `–` and `—` | |||
translations. | |||
|
|||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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"); | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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.