Skip to content

Commit

Permalink
Converted discount to 'fake submodule'
Browse files Browse the repository at this point in the history
  • Loading branch information
vdh committed Jan 20, 2011
1 parent 7085215 commit e144b9a
Show file tree
Hide file tree
Showing 98 changed files with 13,948 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion discount
Submodule discount deleted from 566ee1
47 changes: 47 additions & 0 deletions discount/COPYRIGHT
Original file line number 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.
33 changes: 33 additions & 0 deletions discount/CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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.


61 changes: 61 additions & 0 deletions discount/Csio.c
Original file line number 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);
}
41 changes: 41 additions & 0 deletions discount/INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

HOW TO BUILD AND INSTALL DISCOUNT

1) Unpacking the distribution

The DISCOUNT sources are distributed in tarballs. After extracting from
the tarball, you should end up with all the source and build files in the
directory
discount-(version)

2) Installing the distribution

DISCOUNT uses configure.sh to set itself up for compilation. To run
configure, just do ``./configure.sh'' and it will check your system for
build dependencies and build makefiles for you. If configure.sh finishes
without complaint, you can then do a ``make'' to compile everything and a
``make install'' to install the binaries.

Configure.sh has a few options that can be set:

--src=DIR where the source lives (.)
--prefix=DIR where to install the final product (/usr/local)
--execdir=DIR where to put executables (prefix/bin)
--sbindir=DIR where to put static executables (prefix/sbin)
--confdir=DIR where to put configuration information (/etc)
--libdir=DIR where to put libraries (prefix/lib)
--libexecdir=DIR where to put private executables
--mandir=DIR where to put manpages
--enable-dl-tag Use the DL tag extension
--enable-pandoc-header Use pandoc-style header blocks
--enable-superscript A^B expands to A<sup>B</sup>
--enable-amalloc Use a debugging memory allocator (to detect leaks)
--relaxed-emphasis Don't treat _ in the middle of a word as emphasis
--with-tabstops=N Set tabstops to N characters (default is 4)

3) Installing sample programs and manpages

The standard ``make install'' rule just installs the binaries. If you
want to install the sample programs, they are installed with
``make install.samples''; to install manpages, ``make install.man''.
A shortcut to install everything is ``make install.everything''
116 changes: 116 additions & 0 deletions discount/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
CC=@CC@ -I. -L.
CFLAGS=@CFLAGS@
AR=@AR@
RANLIB=@RANLIB@

BINDIR=@exedir@
MANDIR=@mandir@
LIBDIR=@libdir@
INCDIR=@prefix@/include

PGMS=markdown
SAMPLE_PGMS=mkd2html makepage
@THEME@SAMPLE_PGMS+= theme
MKDLIB=libmarkdown
OBJS=mkdio.o markdown.o dumptree.o generate.o \
resource.o docheader.o version.o toc.o css.o \
xml.o Csio.o xmlpage.o basename.o emmatch.o \
setup.o tags.o html5.o flags.o @AMALLOC@

MAN3PAGES=mkd-callbacks.3 mkd-functions.3 markdown.3 mkd-line.3

all: $(PGMS) $(SAMPLE_PGMS)

install: $(PGMS)
@INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)/$(BINDIR)
./librarian.sh install libmarkdown VERSION $(DESTDIR)/$(LIBDIR)
@INSTALL_DATA@ mkdio.h $(DESTDIR)/$(INCDIR)

install.everything: install install.samples install.man

install.samples: $(SAMPLE_PGMS) install
@INSTALL_PROGRAM@ $(SAMPLE_PGMS) $(DESTDIR)/$(BINDIR)
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man1
@INSTALL_DATA@ theme.1 makepage.1 mkd2html.1 $(DESTDIR)/$(MANDIR)/man1

install.man:
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man3
@INSTALL_DATA@ $(MAN3PAGES) $(DESTDIR)/$(MANDIR)/man3
for x in mkd_line mkd_generateline; do \
( echo '.\"' ; echo ".so man3/mkd-line.3" ) > $(DESTDIR)/$(MANDIR)/man3/$$x.3;\
done
for x in mkd_in mkd_string; do \
( echo '.\"' ; echo ".so man3/markdown.3" ) > $(DESTDIR)/$(MANDIR)/man3/$$x.3;\
done
for x in mkd_compile mkd_css mkd_generatecss mkd_generatehtml mkd_cleanup mkd_doc_title mkd_doc_author mkd_doc_date; do \
( echo '.\"' ; echo ".so man3/mkd-functions.3" ) > $(DESTDIR)/$(MANDIR)/man3/$$x.3; \
done
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man7
@INSTALL_DATA@ markdown.7 mkd-extensions.7 $(DESTDIR)/$(MANDIR)/man7
@INSTALL_DIR@ $(DESTDIR)/$(MANDIR)/man1
@INSTALL_DATA@ markdown.1 $(DESTDIR)/$(MANDIR)/man1

install.everything: install install.man

version.o: version.c VERSION
$(CC) -DVERSION=\"`cat VERSION`\" -c version.c

markdown: main.o $(MKDLIB)
$(CC) $(CFLAGS) -o markdown main.o -lmarkdown @LIBS@

# example programs
@THEME@theme: theme.o $(MKDLIB) mkdio.h
@THEME@ $(CC) -o theme theme.o -lmarkdown @LIBS@


mkd2html: mkd2html.o $(MKDLIB) mkdio.h
$(CC) -o mkd2html mkd2html.o -lmarkdown @LIBS@

makepage: makepage.c $(MKDLIB) mkdio.h
$(CC) -o makepage makepage.c -lmarkdown @LIBS@

main.o: main.c mkdio.h config.h
$(CC) -I. -c main.c

$(MKDLIB): $(OBJS)
./librarian.sh make $(MKDLIB) VERSION $(OBJS)

verify: echo tools/checkbits.sh
@./echo -n "headers ... "; tools/checkbits.sh && echo "GOOD"

test: $(PGMS) echo cols verify
@for x in tests/*.t; do \
@LD_LIBRARY_PATH@=`pwd` sh $$x || exit 1; \
done

cols: tools/cols.c config.h
$(CC) -o cols tools/cols.c
echo: tools/echo.c config.h
$(CC) -o echo tools/echo.c

clean:
rm -f $(PGMS) $(SAMPLE_PGMS) *.o
rm -f $(MKDLIB) `./librarian.sh files $(MKDLIB) VERSION`

distclean spotless: clean
rm -f @GENERATED_FILES@ @CONFIGURE_FILES@

Csio.o: Csio.c cstring.h amalloc.h config.h markdown.h
amalloc.o: amalloc.c
basename.o: basename.c config.h cstring.h amalloc.h markdown.h
css.o: css.c config.h cstring.h amalloc.h markdown.h
docheader.o: docheader.c config.h cstring.h amalloc.h markdown.h
dumptree.o: dumptree.c markdown.h cstring.h amalloc.h config.h
emmatch.o: emmatch.c config.h cstring.h amalloc.h markdown.h
generate.o: generate.c config.h cstring.h amalloc.h markdown.h
main.o: main.c config.h amalloc.h
makepage.o: makepage.c
markdown.o: markdown.c config.h cstring.h amalloc.h markdown.h
mkd2html.o: mkd2html.c config.h mkdio.h cstring.h amalloc.h
mkdio.o: mkdio.c config.h cstring.h amalloc.h markdown.h
resource.o: resource.c config.h cstring.h amalloc.h markdown.h
theme.o: theme.c config.h mkdio.h cstring.h amalloc.h
toc.o: toc.c config.h cstring.h amalloc.h markdown.h
version.o: version.c config.h
xml.o: xml.c config.h cstring.h amalloc.h markdown.h
xmlpage.o: xmlpage.c config.h cstring.h amalloc.h markdown.h
40 changes: 40 additions & 0 deletions discount/Plan9/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
% Discount on Plan 9
% Josh Wood
% 2009-06-12

# *Discount* Markdown compiler on Plan 9

## Build

% CONFIG='--enable-all-features' mk config
% mk install
% markdown -V
markdown: discount X.Y.Z DL_TAG HEADER DEBUG SUPERSCRIPT RELAXED DIV

`--enable-all-features` may be replaced by zero or more of:

--enable-dl-tag Use the DL tag extension
--enable-pandoc-header Use pandoc-style header blocks
--enable-superscript A^B becomes A<sup>B</sup>
--enable-amalloc Enable memory allocation debugging
--relaxed-emphasis underscores aren't special in the middle of words
--with-tabstops=N Set tabstops to N characters (default is 4)
--enable-div Enable >%id% divisions
--enable-alpha-list Enable (a)/(b)/(c) lists
--enable-all-features Turn on all stable optional features

## Notes

The supplied mkfile merely drives Discount's own configure script and
then APE's *psh* environment to build the Discount source, then copies
the result(s) to locations appropriate for system-wide use on Plan 9.
There are a few other *mk*(1) targets:

`install.libs`: Discount includes a C library and header.
Installation is optional. Plan 9 binaries are statically linked.

`install.man`: Add manual pages for markdown(1) and (6).

`install.progs`: Extra programs. *makepage* writes complete XHTML
documents, rather than fragments. *mkd2html* is similar, but produces
HTML.
Loading

0 comments on commit e144b9a

Please sign in to comment.