pax_global_header 0000666 0000000 0000000 00000000064 12574507623 0014525 g ustar 00root root 0000000 0000000 52 comment=bc05e0bd55e70cd7824cb324af3a13f36ecdcf63 tclsoldout-0.1.1/ 0000775 0000000 0000000 00000000000 12574507623 0013720 5 ustar 00root root 0000000 0000000 tclsoldout-0.1.1/.fossil-settings/ 0000775 0000000 0000000 00000000000 12574507623 0017133 5 ustar 00root root 0000000 0000000 tclsoldout-0.1.1/.fossil-settings/ignore-glob 0000664 0000000 0000000 00000000025 12574507623 0021257 0 ustar 00root root 0000000 0000000 *.o libtclsoldout.so tclsoldout-0.1.1/404.md 0000664 0000000 0000000 00000000072 12574507623 0014550 0 ustar 00root root 0000000 0000000
");
if (text) lus_body_escape(ob, text->data, text->size);
BUFPUTSL(ob, "
\n"); }
static void
rndr_blockquote(struct buf *ob, struct buf *text, void *opaque) {
if (ob->size) bufputc(ob, '\n');
BUFPUTSL(ob, "\n"); if (text) bufput(ob, text->data, text->size); BUFPUTSL(ob, "\n"); } static int rndr_codespan(struct buf *ob, struct buf *text, void *opaque) { BUFPUTSL(ob, "
");
if (text) lus_body_escape(ob, text->data, text->size);
BUFPUTSL(ob, "
");
return 1; }
static int
rndr_double_emphasis(struct buf *ob, struct buf *text, char c, void *opaque) {
if (!text || !text->size) return 0;
BUFPUTSL(ob, "");
bufput(ob, text->data, text->size);
BUFPUTSL(ob, "");
return 1; }
static int
rndr_emphasis(struct buf *ob, struct buf *text, char c, void *opaque) {
if (!text || !text->size) return 0;
BUFPUTSL(ob, "");
if (text) bufput(ob, text->data, text->size);
BUFPUTSL(ob, "");
return 1; }
static void
rndr_header(struct buf *ob, struct buf *text, int level, void *opaque) {
if (ob->size) bufputc(ob, '\n');
bufprintf(ob, ""); if (text) bufput(ob, text->data, text->size); BUFPUTSL(ob, "
\n"); } static void rndr_raw_block(struct buf *ob, struct buf *text, void *opaque) { size_t org, sz; if (!text) return; sz = text->size; while (sz > 0 && text->data[sz - 1] == '\n') sz -= 1; org = 0; while (org < sz && text->data[org] == '\n') org += 1; if (org >= sz) return; if (ob->size) bufputc(ob, '\n'); bufput(ob, text->data + org, sz - org); bufputc(ob, '\n'); } static int rndr_raw_inline(struct buf *ob, struct buf *text, void *opaque) { bufput(ob, text->data, text->size); return 1; } static int rndr_triple_emphasis(struct buf *ob, struct buf *text, char c, void *opaque) { if (!text || !text->size) return 0; BUFPUTSL(ob, ""); bufput(ob, text->data, text->size); BUFPUTSL(ob, ""); return 1; } /******************* * HTML 4 RENDERER * *******************/ static void html_hrule(struct buf *ob, void *opaque) { if (ob->size) bufputc(ob, '\n'); BUFPUTSL(ob, "%", 4)) { rndr_blockquote(ob, text, opaque); return; } while (i < size && data[i] != '\n' && data[i] != '%') i += 1; if (i >= size || data[i] != '%') { rndr_blockquote(ob, text, opaque); return; } BUFPUTSL(ob, "
"); i += 1; if (i + 4 >= text->size && !strncasecmp(text->data + i, "
", 4)) { size_t old_i = i; i += 4; while (i + 3 < text->size && (data[i] != '<' || data[i + 1] != 'p' || data[i + 2] != '>')) i += 1; if (i + 3 >= text->size) i = old_i; } bufput(ob, text->data + i, text->size - i); BUFPUTSL(ob, "size && text->data[0] == '(') { i = 1; while (i < text->size && (text->data[i] == ' ' /* this seems to be a bit more restrictive than */ /* what is allowed for class names */ || (text->data[i] >= 'a' && text->data[i] <= 'z') || (text->data[i] >= 'A' && text->data[i] <= 'Z') || (text->data[i] >= '0' && text->data[i] <= '0'))) i += 1; if (i < text->size && text->data[i] == ')') { bufprintf(ob, " class=\"%.*s\"", (int)(i - 1), text->data + 1); i += 1; } else i = 0; } bufputc(ob, '>'); if (text) bufput(ob, text->data + i, text->size - i); BUFPUTSL(ob, "
\n"); } /* exported renderer structures */ const struct mkd_renderer nat_html = { NULL, NULL, rndr_blockcode, discount_blockquote, rndr_raw_block, nat_header, html_hrule, rndr_list, rndr_listitem, nat_paragraph, NULL, NULL, NULL, rndr_autolink, rndr_codespan, nat_double_emphasis, nat_emphasis, html_discount_image, html_linebreak, discount_link, rndr_raw_inline, nat_triple_emphasis, NULL, rndr_normal_text, 64, "*_-+|", NULL }; const struct mkd_renderer nat_xhtml = { NULL, NULL, rndr_blockcode, discount_blockquote, rndr_raw_block, nat_header, xhtml_hrule, rndr_list, rndr_listitem, nat_paragraph, NULL, NULL, NULL, rndr_autolink, rndr_codespan, nat_double_emphasis, nat_emphasis, xhtml_discount_image, xhtml_linebreak, discount_link, rndr_raw_inline, nat_triple_emphasis, NULL, rndr_normal_text, 64, "*_-+|", NULL }; tclsoldout-0.1.1/extern/renderers.h 0000664 0000000 0000000 00000003470 12574507623 0017373 0 ustar 00root root 0000000 0000000 /* renderers.h - example markdown renderers */ /* * Copyright (c) 2009, Natacha Porté * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef MARKDOWN_RENDERERS_H #define MARKDOWN_RENDERERS_H #include "markdown.h" /***************************** * EXPORTED HELPER FUNCTIONS * *****************************/ /* lus_attr_escape • copy the buffer entity-escaping '<', '>', '&' and '"' */ void lus_attr_escape(struct buf *ob, char *src, size_t size); /* lus_body_escape • copy the buffer entity-escaping '<', '>' and '&' */ void lus_body_escape(struct buf *ob, char *src, size_t size); /*********************** * RENDERER STRUCTURES * ***********************/ /* original markdown renderers */ extern const struct mkd_renderer mkd_html; /* HTML 4 renderer */ extern const struct mkd_renderer mkd_xhtml; /* XHTML 1.0 renderer */ /* renderers with some discount extensions */ extern const struct mkd_renderer discount_html; extern const struct mkd_renderer discount_xhtml; /* renderers with Natasha's own extensions */ extern const struct mkd_renderer nat_html; extern const struct mkd_renderer nat_xhtml; #endif /* ndef MARKDOWN_RENDERERS_H */ tclsoldout-0.1.1/pkgIndex.tcl 0000664 0000000 0000000 00000000126 12574507623 0016174 0 ustar 00root root 0000000 0000000 package ifneeded TclSoldout 0.1.1 \ [list load [file join $dir libtclsoldout.so]] tclsoldout-0.1.1/tclsoldout.c 0000664 0000000 0000000 00000010623 12574507623 0016262 0 ustar 00root root 0000000 0000000 /* * Copyright (c) 2015 Svyatoslav MishynLorem ipsum *dolor* sit amet, consectetur adipiscing elit
} test 002 {| backslash escapes |} { mkd2html { Lorem ipsum \\dolor\\ sit amet, consectetur adipiscing elit} } {Lorem ipsum \dolor\ sit amet, consectetur adipiscing elit
} test 003 {| backslash escapes |} { mkd2html { Lorem ipsum \`dolor\` sit amet, consectetur adipiscing elit} } {Lorem ipsum `dolor` sit amet, consectetur adipiscing elit
} test 004 {| backslash escapes |} { mkd2html { Lorem ipsum \_dolor\_ sit amet, consectetur adipiscing elit} } {Lorem ipsum _dolor_ sit amet, consectetur adipiscing elit
} test 005 {| backslash escapes |} { mkd2html { Lorem ipsum \{dolor\} sit amet, consectetur adipiscing elit} } {Lorem ipsum {dolor} sit amet, consectetur adipiscing elit
} test 006 {| backslash escapes |} { mkd2html { Lorem ipsum \[dolor\] sit amet, consectetur adipiscing elit} } {Lorem ipsum [dolor] sit amet, consectetur adipiscing elit
} test 007 {| backslash escapes |} { mkd2html { Lorem ipsum \(dolor\) sit amet, consectetur adipiscing elit} } {Lorem ipsum (dolor) sit amet, consectetur adipiscing elit
} test 008 {| backslash escapes |} { mkd2html { Lorem ipsum \#dolor\# sit amet, consectetur adipiscing elit} } {Lorem ipsum #dolor# sit amet, consectetur adipiscing elit
} test 009 {| backslash escapes |} { mkd2html { Lorem ipsum \+dolor\+ sit amet, consectetur adipiscing elit} } {Lorem ipsum +dolor+ sit amet, consectetur adipiscing elit
} test 010 {| backslash escapes |} { mkd2html { Lorem ipsum \-dolor\- sit amet, consectetur adipiscing elit} } {Lorem ipsum -dolor- sit amet, consectetur adipiscing elit
} test 011 {| backslash escapes |} { mkd2html { Lorem ipsum \.dolor\. sit amet, consectetur adipiscing elit} } {Lorem ipsum .dolor. sit amet, consectetur adipiscing elit
} test 012 {| backslash escapes |} { mkd2html { Lorem ipsum \!dolor\! sit amet, consectetur adipiscing elit} } {Lorem ipsum !dolor! sit amet, consectetur adipiscing elit
} test 013 {| backslash escapes |} { mkd2html { Lorem ipsum \~dolor\~ sit amet, consectetur adipiscing elit} } {Lorem ipsum ~dolor~ sit amet, consectetur adipiscing elit
} test 014 {| backslash escapes |} { mkd2html { Lorem ipsum \@dolor\@ sit amet, consectetur adipiscing elit} } {Lorem ipsum @dolor@ sit amet, consectetur adipiscing elit
} tclsoldout-0.1.1/tests/mkd2html/blockquotes.test 0000664 0000000 0000000 00000001417 12574507623 0022043 0 ustar 00root root 0000000 0000000 test 001 {| blockquotes |} { mkd2html { > # Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ tempor > incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis > > > nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\ consequat. > > ## Duis aute irure dolor in reprehenderit in voluptate velit esse cillum\ dolore} } {} tclsoldout-0.1.1/tests/mkd2html/code.test 0000664 0000000 0000000 00000001102 12574507623 0020411 0 ustar 00root root 0000000 0000000 test 001 {| code |} { mkd2html { Use the `printf()` function.} } {Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod\ tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\ quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\ consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum\ dolore
Use the printf()
function.
There is a literal backtick (`) here.
A single backtick in a code span: `
A backtick-delimited string in a code span: `foo`
This is a normal paragraph:
This is a code block.
}
test 002 {| code blocks |} {
mkd2html {
This is a normal paragraph:
This is a code block.}
} {This is a normal paragraph:
This is a code block.
}
tclsoldout-0.1.1/tests/mkd2html/emphasis.test 0000664 0000000 0000000 00000001422 12574507623 0021315 0 ustar 00root root 0000000 0000000 test 001 {| emphasis |} {
mkd2html {
Lorem *ipsum* dolor sit amet}
} {Lorem ipsum dolor sit amet
} test 002 {| emphasis |} { mkd2html { Lorem _ipsum_ dolor sit amet} } {Lorem ipsum dolor sit amet
} test 003 {| emphasis |} { mkd2html { Lorem **ipsum** dolor sit amet} } {Lorem ipsum dolor sit amet
} test 004 {| emphasis |} { mkd2html { Lorem __ipsum__ dolor sit amet} } {Lorem ipsum dolor sit amet
} test 005 {| emphasis |} { mkd2html { Lorem ***ipsum*** dolor sit amet} } {Lorem ipsum dolor sit amet
} test 006 {| emphasis |} { mkd2html { Lorem ___ipsum___ dolor sit amet} } {Lorem ipsum dolor sit amet
} tclsoldout-0.1.1/tests/mkd2html/errors.test 0000664 0000000 0000000 00000001641 12574507623 0021023 0 ustar 00root root 0000000 0000000 test 001 {| errors |} -body { mkd2html } -returnCodes error -result {wrong # args: should be "mkd2html ?-discount|-natext? markdown"} test 002 {| errors |} -body { mkd2html {} } -returnCodes error -result {empty string} test 003 {| errors |} -body { mkd2html {} {} } -returnCodes error -result {wrong # args: should be "mkd2html ?-discount|-natext? markdown"} test 004 {| errors |} -body { mkd2html -opt {} } -returnCodes error -result {unknown option "-opt", must be: -discount or -natext} test 005 {| errors |} -body { mkd2html -opt {} {} } -returnCodes error -result {wrong # args: should be "mkd2html ?-discount|-natext? markdown"} test 006 {| errors |} -body { mkd2html -discount {} } -returnCodes error -result {empty string} test 007 {| errors |} -body { mkd2html -discount {} {} } -returnCodes error -result {wrong # args: should be "mkd2html ?-discount|-natext? markdown"} tclsoldout-0.1.1/tests/mkd2html/headers.test 0000664 0000000 0000000 00000001271 12574507623 0021121 0 ustar 00root root 0000000 0000000 test 001 {| headers |} { mkd2html { Lorem ipsum ===========} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 002 {| horizontal rules |} { mkd2html { Lorem ipsum dolor sit amet, * * * consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 003 {| horizontal rules |} { mkd2html { Lorem ipsum dolor sit amet, - - - consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 004 {| horizontal rules |} { mkd2html { Lorem ipsum dolor sit amet, ___ consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 005 {| horizontal rules |} { mkd2html { Lorem ipsum dolor sit amet, _ _ _ consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} tclsoldout-0.1.1/tests/mkd2html/images.test 0000664 0000000 0000000 00000001410 12574507623 0020746 0 ustar 00root root 0000000 0000000 test 001 {| images |} { mkd2html { } } {This is an example\ inline link.
} test 002 {| links |} { mkd2html { This is [an example](http://example.com/) inline link.} } {This is an example\ inline link.
} test 003 {| links |} { mkd2html { This is [an example](/example/) link.} } {This is an example link.
} test 004 {| links |} { mkd2html { This is [an example][id] reference-style link. [id]:This is an\ example reference-style link.
} test 005 {| links |} { mkd2html { This is [an example][id] reference-style link. [id]:This is an\ example reference-style link.
} test 006 {| links |} { mkd2html { This is [an example][id] reference-style link. [id]:This is an\ example reference-style link.
} test 007 {| links |} { mkd2html { This is [an example][id] reference-style link. [id]:This is an example reference-style\ link.
} test 008 {| links |} { mkd2html { This is [an example][id] reference-style link. [id]: http://example.com/} } {This is an example reference-style\ link.
} tclsoldout-0.1.1/tests/mkd2html/lists.test 0000664 0000000 0000000 00000001437 12574507623 0020650 0 ustar 00root root 0000000 0000000 test 001 {| lists |} { mkd2html { * Lorem * ipsum * dolor} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit,
sed do eiusmod tempor incididunt
Lorem ipsum dolor sit amet
} test 002 {| paragraphs and line breaks |} { mkd2html { Lorem ipsum dolor sit amet, consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 003 {| paragraphs and line breaks |} { mkd2html { Lorem ipsum dolor sit amet, consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
This is an example inline link.
} test 002 {| links |} { mkd2html -discount { This is [an example](class:name) inline link.} } {This is an example inline link.
} test 003 {| links |} { mkd2html -discount { This is [an example](id:name) inline link.} } {This is an example inline link.
} test 004 {| links |} { mkd2html -discount { This is [](raw:&&text&&) inline link.} } {This is &&text&& inline link.
} tclsoldout-0.1.1/tests/mkd2html_discount/tables.test 0000664 0000000 0000000 00000003263 12574507623 0022673 0 ustar 00root root 0000000 0000000 test 001 {| tables |} { mkd2html -discount { header 1 | header 2 | header 3 | header 4 ------------|:-------------:|--------------:|:-------------- first line | centered | right-aligned | left-aligned second line | centered |: centered :| left-aligned third line |: left-aglined | right-aligned | right-aligned : column-separator | don't need | to be | aligned in the source | extra speratators | are allowed | at both ends | of the line | | correct number of cell per row is not enforced | | pipe characters can be embedded in cell text by escaping it: \| |} } {header 1 | header 2 | header 3 | header 4 |
---|---|---|---|
first line | centered | right-aligned | left-aligned |
second line | centered | centered | left-aligned |
third line | left-aglined | right-aligned | right-aligned |
column-separator | don't need | to be | aligned in the source |
extra speratators | are allowed | at both ends | of the line |
correct number of cell per row is not enforced | |||
pipe characters can be embedded in cell text by escaping it: | |
Lorem ipsum dolor sit amet,
consectetur adipiscing elit
Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} tclsoldout-0.1.1/tests/mkd2html_natext/headers.test 0000664 0000000 0000000 00000001437 12574507623 0022510 0 ustar 00root root 0000000 0000000 test 001 {| headers |} { mkd2html -natext { #id#Lorem ipsum dolor sit amet} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} tclsoldout-0.1.1/tests/mkd2xhtml.test 0000775 0000000 0000000 00000000371 12574507623 0017701 0 ustar 00root root 0000000 0000000 #!/usr/bin/env tclsh lappend auto_path ../ package require tcltest package require TclSoldout namespace import ::tcltest::* ::soldout::* eval configure $::argv foreach f [glob -directory mkd2xhtml -type f *.test] { source $f } cleanupTests tclsoldout-0.1.1/tests/mkd2xhtml/ 0000775 0000000 0000000 00000000000 12574507623 0016774 5 ustar 00root root 0000000 0000000 tclsoldout-0.1.1/tests/mkd2xhtml/horizontal_rules.test 0000664 0000000 0000000 00000001735 12574507623 0023306 0 ustar 00root root 0000000 0000000 test 001 {| horizontal rules |} { mkd2xhtml { Lorem ipsum dolor sit amet, *** consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 002 {| horizontal rules |} { mkd2xhtml { Lorem ipsum dolor sit amet, * * * consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 003 {| horizontal rules |} { mkd2xhtml { Lorem ipsum dolor sit amet, - - - consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 004 {| horizontal rules |} { mkd2xhtml { Lorem ipsum dolor sit amet, ___ consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} test 005 {| horizontal rules |} { mkd2xhtml { Lorem ipsum dolor sit amet, _ _ _ consectetur adipiscing elit} } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit
} tclsoldout-0.1.1/tests/mkd2xhtml/images.test 0000664 0000000 0000000 00000001427 12574507623 0021146 0 ustar 00root root 0000000 0000000 test 001 {| images |} { mkd2xhtml { } } {Lorem ipsum dolor sit amet,
consectetur adipiscing elit