| Author | SHA1 | Message | Date |
|---|---|---|---|
|
|
fc621e2ced | * renamed Text::Markdown::XS to Text::Markdown::PegMarkdown | 16 years ago |
|
|
432c1f483c | * started to use MYEXTLIB to link ext/libpeg_markdown.so to XS.so | 16 years ago |
|
|
c9d1aa6fba | * added some rules to ignore files under "ext" dir | 16 years ago |
|
|
be4858209a | * modified library name as the same as rpeg-markdown | 16 years ago |
|
|
23e56d1433 | * added ext/Makefile.PL to make a shared library: libpeg_markdown.so | 16 years ago |
|
|
cb2b9d4751 | * use git submodules to track peg-markdown | 16 years ago |
|
|
2265321e90 | * use peg-markdown instead of discount | 16 years ago |
|
|
4afeedc0a5 | * use tidy | 16 years ago |
|
|
3f5d58f450 | *added the vim swap-file: *.swp | 16 years ago |
| @ -0,0 +1,3 @@ | |||||
| [submodule "peg-markdown"] | |||||
| path = peg-markdown | |||||
| url = git://github.com/jgm/peg-markdown.git | |||||
| @ -0,0 +1,28 @@ | |||||
| #include "EXTERN.h" | |||||
| #include "perl.h" | |||||
| #include "XSUB.h" | |||||
| #include "ppport.h" | |||||
| #include <markdown_lib.h> | |||||
| MODULE = Text::Markdown::PegMarkdown PACKAGE = Text::Markdown::PegMarkdown PREFIX = TextMarkdown_ | |||||
| PROTOTYPES: DISABLE | |||||
| SV * | |||||
| TextMarkdown__markdown(text) | |||||
| char *text; | |||||
| PREINIT: | |||||
| SV* r = &PL_sv_undef; | |||||
| char *out = NULL; | |||||
| int extensions = 0; | |||||
| int output_format = HTML_FORMAT; | |||||
| CODE: | |||||
| out = markdown_to_string(text, extensions, output_format); | |||||
| r = newSVpvn(out, strlen(out)); | |||||
| Safefree(out); | |||||
| RETVAL = r; | |||||
| OUTPUT: | |||||
| RETVAL | |||||
| @ -1,45 +0,0 @@ | |||||
| #include "EXTERN.h" | |||||
| #include "perl.h" | |||||
| #include "XSUB.h" | |||||
| #include "ppport.h" | |||||
| #include <string.h> | |||||
| #include <mkdio.h> | |||||
| MODULE = Text::Markdown::XS PACKAGE = Text::Markdown::XS PREFIX = TextMarkdown_ | |||||
| PROTOTYPES: DISABLE | |||||
| SV * | |||||
| TextMarkdown_markdown(text) | |||||
| char *text; | |||||
| PREINIT: | |||||
| SV* r = &PL_sv_undef; | |||||
| int flags = MKD_NOHEADER|MKD_NOPANTS; | |||||
| char *html = NULL; | |||||
| int szhtml; | |||||
| MMIOT *doc; | |||||
| CODE: | |||||
| if ( (doc = mkd_string(text, strlen(text), flags)) == 0 ) { | |||||
| croak("failed at mkd_string"); | |||||
| } | |||||
| if ( !mkd_compile(doc, flags) ) { | |||||
| Safefree(doc); | |||||
| croak("failed at mkd_compile"); | |||||
| } | |||||
| if ( (szhtml = mkd_document(doc, &html)) == EOF ) {; | |||||
| Safefree(doc); | |||||
| croak("failed at mkd_document"); | |||||
| } | |||||
| r = newSVpvn(html, szhtml); | |||||
| sv_catpv(r, "\n"); | |||||
| Safefree(html); | |||||
| Safefree(doc); | |||||
| RETVAL = r; | |||||
| OUTPUT: | |||||
| RETVAL | |||||
| @ -0,0 +1,29 @@ | |||||
| use 5.008000; | |||||
| use ExtUtils::MakeMaker; | |||||
| # See lib/ExtUtils/MakeMaker.pm for details of how to influence | |||||
| # the contents of the Makefile that is written. | |||||
| sub MY::postamble { | |||||
| return <<'MAKE_FRAG'; | |||||
| MARKDOWN_OBJS=markdown_lib.o markdown_output.o markdown_parser.o | |||||
| $(MARKDOWN_OBJS): | |||||
| (cd ../peg-markdown; make) | |||||
| @ for i in $@; do \ | |||||
| $(CP) ../peg-markdown/$$i .;\ | |||||
| done | |||||
| libpeg_markdown.$(DLEXT): $(MARKDOWN_OBJS) | |||||
| $(LD) $(LDDLFLAGS) -o libpeg_markdown.$(DLEXT) $(MARKDOWN_OBJS) | |||||
| MAKE_FRAG | |||||
| } | |||||
| WriteMakefile( | |||||
| NAME => 'libpeg_markdown', | |||||
| PREREQ_PM => {}, # e.g., Module::Name => 1.1 | |||||
| LIBS => `pkg-config --libs glib-2.0`, | |||||
| DEFINE => '', # e.g., '-DHAVE_SOMETHING' | |||||
| INC => `pkg-config --cflags glib-2.0`, | |||||
| # OBJECT => '$(O_FILES)', # link all the C files too | |||||
| clean => { FILES => '*.so *.o'}, | |||||
| ); | |||||