100 Commits
Author SHA1 Message Date
David Parsons 15912e009a Up the version# because of the [a\[b\]c](d) bugfix 2010-06-12 19:18:08 -07:00
David Parsons 4176e8c8a6 Add a testcase for escaped []s in embedded links 2010-06-12 18:48:43 -07:00
David Parsons ed6505cfc8 Escape both the in and out characters in the parenthetical() function. 2010-06-12 18:46:12 -07:00
David Parsons a695a5b909 Don't forget to add html5.c to SCCS 2010-06-04 10:17:13 -07:00
David Parsons a4756602f1 Strip the --with-html5 configure.sh option out, make html5 support into a library function.
This involves reworking the blocktag[] array into a STRING(), and moving the entire
kit and kaboodle out into a separate file with a public initializer (mkd_prepare_tags),
definer (mkd_define_tag) sort (mkd_sort_tags, and lookup (mkd_search_tags) function.
The html5 tags are further removed into their own function (mkd_with_html5_tags) which
can be included when someone wishes to have html5 support.

Note that html5 support is library-wide;  once you call mkd_with_html5_tags, you're
stuck with them everywhere and can't back them out.   This might be revisited later,
2010-06-04 10:16:51 -07:00
David Parsons 945258644c Add a VALID_DOCUMENT magic flag to the Document structure.
Set it when a Document is allocated, clear it when it is
deallocated.
2010-05-27 21:40:29 -07:00
David Parsons a781017a2e Properly handle html comments without spaces.
Add a testcase for the nested lists followed by header defect.
2010-05-27 11:27:28 -07:00
David Parsons eb6c643122 Tweak list block detection a little more;
the clipping depth for the contents of a list block needs to
be at least 2 (1 for the list marker, one for the mandatory
space) plus I only care about not counting setext headers
(a line of text, followed by a line of dashes) as list items.
2010-05-27 08:38:29 -07:00
David Parsons 457a6aae0b Merge in html5 support with --with-html5 flag in configure.sh.
This is probably not the final form of this patch;  I should
redo it with a STRING() array to hold the tags and have a
with_html5() function that adds the html5 tags to the array.
(Or something like that.)
2010-05-21 23:25:02 -07:00
David Parsons 879c3c05de Merge branch 'master' of http://github.com/rcrowley/discount 2010-05-14 17:11:37 -07:00
David Parsons 74f20d3b4f Add config.h to the dependency lists for cols & echo, so those
functions will rebuild after a reconfig
2010-05-10 11:40:02 -07:00
David Parsons a26cb8ba1a Plan9 fixes from Josh Wood:
>[...] changes to the APE environment had broken Discount builds
>there. The compiler is being choosy in a new way about *snprintf,
>and no longer liked Csio.c:29.
>
>Working around this takes a one-line edit in Plan9/mkfile, as shown
>in the attached patch, and results in a clean build, passes tests,
>etc.
>
>Long form explanation from the APE docs, for curiosity's sake:
>
>>_C99_SNPRINTF_EXTENSION
>>This extension permits the use of the return values of .I snprintf
>>and .I vsnprintf . Before C99, the 1999 C standard, these functions
>>usually returned the number of bytes, excluding terminating NUL,
>>actually stored in the target string. (GNU, as usual, had to be
>>different and returned -1 if the target string was too small.) C99
>>requires them to instead return the number of bytes, excluding
>>terminating NUL, that would have been written into the target string
>>if it were infinitely large or a negative value if an `encoding
>>error' occurs, so old programs compiled under C99 rules will be
>>prone to overrunning their buffers. This extension is a way for the
>>programmer to declare that he or she understands the situation and
>>has adjusted the code being compiled to compensate.
2010-04-09 06:42:30 -07:00
David Parsons 19b61eac92 don't describe <style> blocks as mystery node during markdown -d 2010-03-30 08:48:33 -07:00
David Parsons b7be677d83 Add the pseudo-protocol `lang', which generates a
span with a `lang=` attribute.
2010-03-25 09:04:57 -07:00
David Parsons 34f491ee66 Add two test cases from (old, fixed) reddit defect described in
<http://code.reddit.com/ticket/695>
2010-03-16 12:30:16 -07:00
David Parsons 39e8c7f859 Additional smartypants for 're, 'll, 've, 'm, and 'd (from ryan tomayko@github) 2010-03-15 09:23:12 -07:00
David Parsons f70287c060 Fix a defect in how inline html blocks (& comments) are handled;
if the line with the closing tag has text after the close tag, break
that into a new line so it can be blockified in the normal fashion.
2010-03-14 00:09:46 -08:00
David Parsons 444178882d Add a new code test case, change the descriptions on a couple of the
other ones.
2010-03-06 19:43:48 -08:00
David Parsons c0ed1ec04d 1. Rearrange some of the functions so I don't need forward
declarations.
2. redo, again, the internals of codeblock() [renamed back to
   code()], codespan(), and printcode() so that code() simply
   prints out code (with `<` & `&` properly expanded, but nothing
   else) and codespan() & printcode() simply call it after doing
   whatever trimming and framing they want to do.
2010-03-06 18:00:50 -08:00
David Parsons 1f7b8057df 1. If a full tick match isn't found, choose the closest
substring match.
2. Move code test cases to code.t
3. Add new code test cases to check that the code handler
   works like the standard does.
2010-03-06 15:07:46 -08:00
David Parsons b238e8e3c3 Clean up the code span handler a little bit more
by removing some of the really ancient cruft that
had been sitting there since 2007.
2010-03-06 11:41:10 -08:00
David Parsons 25fc193666 Redo the ` code ` handler so that it matches
between equal runs of `'s
2010-03-05 22:19:20 -08:00
David Parsons fa814ba6ae Now we're really version 1.6.2 2010-02-25 20:31:50 -08:00
David Parsons 9c23be1907 Strip out a pair of unused variables from emmatch() 2010-02-25 19:19:04 -08:00
David Parsons cbd19b4796 1. Tweak some of the strncmp() loops so that they have a pointer
walking the array that's being checked against.
2. set the version to prerelease 2
2010-02-19 19:29:35 -08:00
David Parsons f5f332c811 Add the test case for autolink prefix fragments 2010-02-16 23:13:36 -08:00
David Parsons 421c23be0d Fix a defect in automatic links; I was not checking for input
length in isautolink(), and an inline link followed by a prefix
fragment would result in both being considered as autolinks
2010-02-16 23:07:25 -08:00
David Parsons 9131d15a85 Write the first (clumsy) pass at a mkd-callbacks manpage, and .Xr
it the other manpages as appropriate.
2010-02-16 20:11:54 -08:00
David Parsons ace5dbb458 Add a pair of callback test cases for the -b and -E flags
in the markdown program
2010-01-29 22:19:20 -08:00
David Parsons 38f897342e Tweak AC_SCALAR_TYPES some more (compile warnings & a
real error (`sat` instead of `say`; it worked on MacOS,
but nowhere else.)
2010-01-29 18:26:56 -08:00
David Parsons 9de2ee872a Mixup for the function name to write to the context data field 2010-01-29 18:24:22 -08:00
David Parsons 4bb5cad8ac Bitten by goddamn C99; I'd mixed up variable declarations with
code in AC_SCALAR_TYPES.
2010-01-29 18:22:11 -08:00
David Parsons 924cda8934 Clean up prototypes, and make a typedef for the callback
free funtion.
2010-01-29 18:19:58 -08:00
David Parsons b23c1f801b Don't forget to
1. Add basename.c to source control, and
 2. bump up the version#
2010-01-29 18:10:54 -08:00
David Parsons 0011b23c23 Remove the hardwired "apply a url prefix" code and replace
it with a callback.  Move the whole shebang (mkd_basename,
e_basename, e_free) into `basename.c` so it won't get linked
unless it's used.
2010-01-29 18:08:25 -08:00
David Parsons 4e47508782 Modify configure.inc so that AC_SCALAR_TYPES can be
used to generate either #defines for config.h or
substitutions for config.sub
2010-01-28 17:52:53 -08:00
David Parsons 81b8310061 Pull the `img'' and `a'' tag prefix printing (the code
that prints the `<img src="link"` and `<a href="link"`)
out into its own subroutine so I don't have to duplicate
the mass of code that handles callback and the url base
prefixes.
2010-01-28 09:58:08 -08:00
David Parsons a35df7e423 Formatting tweaks 2010-01-28 09:40:29 -08:00
David Parsons 5c863a444f Put all of the e_ variables into a context structure, and
have the mmiot's always point up to the parental Document's
context structure.
2010-01-28 09:34:15 -08:00
David Parsons 1c5e9a7a91 Change e_func to mkd_callback_t 2010-01-27 19:06:58 -08:00
David Parsons 1087e3f2dc Update the dependencies in Makefile.in 2010-01-27 18:56:00 -08:00
David Parsons c04ffa9cef add callbacks for editing urls and flags in [] and <> links. 2010-01-27 18:45:06 -08:00
David Parsons 3e7af52b76 Add tests for width-only and height-only dimensions on
an image.
2009-12-29 21:24:02 -08:00
David Parsons f9f25e1a8c Version 1.5.8:
Add 1 feature;  allow the user to specify only the width
   or height of an image by the simple expedient of leaving
   a number off the =WxH parameter.
   Fix 2 table bugs: first, don't treat a single line with
   pipes as a table, and secondly don't silently delete
   tables that are just the header lines.
2009-12-29 21:00:48 -08:00
David Parsons 7b145d975f Fix a bug in htmlblock where an unclosed <table></table
causes a null pointer dereference.
2009-12-13 08:16:27 -08:00
David Parsons dbd75077ed Fix a difference from the standard markdown; in Markdown.pl, a
construct like `<foo [bar](foo) <s>hi</s>` will result in everything
between the first < and the next > being passed through untouched.
It's pretty gross, but It's The Standard(tm).
2009-12-01 20:14:44 -08:00
David Parsons 8ebcb24ffa Don't treat <word as an html tag unless it's followed by a '>' 2009-12-01 20:06:01 -08:00
David Parsons a91884273a Don't use bzero() -- use memset() instead 2009-11-30 22:02:12 -08:00
David Parsons 3761275fa1 Version 1.5.6: documentation patches, check for bzero in
configure.sh, change fdate.
2009-11-29 09:04:07 -08:00
David Parsons 3fb96fd388 Add a check for bzero() or memset(). This requires some stupid thrashing
to deal with the stupid FSF compiler, which has ArCaNe KnOwLeDgE about bzero
and memset and will fall over and die if you don't provide arguments for
the functions even if you don't #include <string.h> (or whatever include
file has the prototype)
2009-11-28 21:58:23 -08:00
David Parsons 8c5936dde6 Documentation corrections by Josh Wood 2009-10-05 07:34:45 -07:00
David Parsons 9ac510faa4 Version 1.5.5: fix a defect in table output 2009-09-18 10:04:31 -07:00
David Parsons 7edeaefaa9 Misdid a comparison in the table parsing code, which
caused `splat()` to end up picking up uninitialized
data from the `align` string, which resulted in core
dumps when that data was used to figure out which
alignment to use.
2009-09-17 22:11:21 -07:00
David Parsons 4d395899cb Version 1.5.4: repair table-of-content support after the
new footnote code in 1.5.2 broke it.
2009-09-11 09:28:15 -07:00
David Parsons 800e7f22a7 When I restructured the source tree after changing the footnote
code handler, I forgot to revisit the table of contents code, and
this made it break.  I also added a test case to check that the
table of contents is actually being generated.
2009-09-11 09:17:04 -07:00
David Parsons 442947858c 1.5.3: immediate links aren't if there's whitespace between the [] and () 2009-09-03 14:49:21 -07:00
David Parsons b9302c7920 1. Add the new E(x) abstraction for the ANCHOR() class, use
that when processing Lines in compile_document().
2. Add some test cases for [footnote] links showing up in
   random places.
3. In `dumptree()`, show the `ident` string ,if any, associated
   with a given block.
2009-08-12 12:21:53 -07:00
David Parsons a688ca0af9 Strip an unused variable from compile() [the struct kw
was only being used to pick up html blocks, which are now
processed elsewhere.]
2009-08-12 01:12:33 -07:00
David Parsons b196dcb641 Strip out a c++ style comment (line should have already been deleted) 2009-08-12 01:10:56 -07:00
David Parsons b134f9532b 1. Add "table" to the list of tokens recognised in dumptree.
2. Don't bother to consume blank lines when we start in `compile_document()`
2009-08-12 01:06:06 -07:00
David Parsons a94c6b7f2b 1.5.2: fix two defects
- footnotes can go anywhere except in html blocks
 - I should be able to do two consecutive >%class% blocks
2009-08-12 00:49:02 -07:00
David Parsons fe3138bfd0 First pass at code to fix the [footnote]: anywhere defect; split
`compile()` out into `compile_document()` (toplevel; split documents
into html, style, sourcecode, extracts all footnotes) and `compile()`
(compiles all content, but does not process html blocks or footnotes)

Not perfect: I should not need the SOURCE object type -- I should be
able to simple compile a block of source and append that source onto
the top-level paragraph list, but when I do that I end up with memory
leaks and test failures.
2009-08-12 00:43:32 -07:00
David Parsons 83872c7ba8 Plan9 manpage changes courtesy of Josh Wood 2009-08-07 12:56:29 -07:00
David Parsons 7c2fd02b36 In textblock(), Only do isfootnote() checking if
it's a top level block (kludge)
2009-08-06 11:31:08 -07:00
David Parsons 33ce6f3e71 1. Fix a bug in >%div% blocks -- allow one %div% block to
follow another.
2. Add testcases for >%div% blocks.
3. Add a testcase for a footnote being cuddled up next to
   a textblock.
2009-08-06 10:42:39 -07:00
David Parsons 9279c80327 Bug: Footnotes terminate text blocks 2009-08-06 09:55:13 -07:00
David Parsons 30ac0d157c Return from printtable() with a good status code when it prints a table 2009-08-03 23:30:20 -07:00
David Parsons 281ef43a52 Document (briefly and incoherently) the table extension 2009-08-03 23:27:51 -07:00
David Parsons f2968d463b Document the notables flag 2009-08-03 10:59:14 -07:00
David Parsons 1e3ef2422d Version 1.5.1: -fnotables, fix /tbody, /table order 2009-08-03 10:56:11 -07:00
David Parsons 44860e8d86 1. I was putting out the /tbody and /table (in printtable()) in the
reverse order,
2. Add `<iframe>` to the list of block html elements.
2009-08-03 09:58:33 -07:00
David Parsons ba815654fc Remove an unused variable from tableblock(), comment it. 2009-08-02 10:40:06 -07:00
David Parsons 958b18dfcc Make istable() static, comment it. 2009-08-02 10:36:19 -07:00
David Parsons 94c0e700b4 1. Add a new flag (MKD_NOTABLES) to turn off the table extension.
2. Theme is /still/ broken for generating output files -- try to fix again.
3. Add more table test cases.
2009-08-02 10:32:02 -07:00
David Parsons 1b465fe9db Add some table testcases 2009-07-31 22:43:50 -07:00
David Parsons b1b246649d Put some paranoia checking into printtable(),
fix an inverted isspace() test in istable()
2009-07-31 22:35:33 -07:00
David Parsons a4d07d2fef Markdown Extra-style table support 2009-07-31 11:09:48 -07:00
David Parsons 2dbf88792d Add a couple of files I never checked in 2009-07-31 08:21:43 -07:00
David Parsons 9d165c26ff Add test cases for dl followed by non-dl, non-dl followed by dl 2009-07-31 08:17:29 -07:00
David Parsons 63736979d1 1. Push out a newline after a <dd>...</dd> section.
2. Definition lists don't combine with other lists.
2009-07-31 08:11:59 -07:00
David Parsons e9c6511c64 1. Add More Plan9 + documentation patches from Josh Wood
2. Tweak the paragraph wrapping in `generate()` so that all
   paragraphs in a multiple-paragraph item/blockquote will
   be properly wrapped with `<p>`...`</p>` (or whatever is
   appropriate.)
3. Attempt to follow indentation better inside lists, so
   a list item with multiple paragraphs is parsed correctly
   when the second (& up) paragraphs are indented the same
   as the first paragraph.
2009-07-26 10:53:11 -07:00
David Parsons afe81a2672 Add <map> to the html blocks we know about, and
redo some of the internals to the html tests to make
the test code a little more legible.
2009-06-22 20:30:53 -07:00
David Parsons 237a6d9c5f Clean up the utf-8 support in cols so it actually works;
trigger on c & 0xC0, then loop on utf-8 stanzas until we hit
something else, but keep track of width and stop printing if
we run out of space in the middle of a string of > U+007F
characters.
2009-06-17 21:16:39 -07:00
David Parsons 1c2a403e63 tryify list3deep.t 2009-06-17 18:02:41 -07:00
David Parsons 7e41ce2551 tryify list.t 2009-06-17 17:58:27 -07:00
David Parsons d1a76a5cb4 tryify compat.t, emphasis.t, and linkypix.t 2009-06-17 17:26:37 -07:00
David Parsons 5bd99c2fd0 tryify html.t, peculiarities.t, tabstop.t, and xml.t 2009-06-17 17:08:26 -07:00
David Parsons 8c0e7da95a tryify dl.t and footnotes.t 2009-06-17 16:34:55 -07:00
David Parsons e4ba09cd54 Use the existing reddit-style autolink termination characters instead
of the ones I'd guessed about.
2009-06-17 16:20:59 -07:00
David Parsons ebdd489ed7 1. Fix a bug in generate.c where MKD_NO_EXT was not being handled.
2. Add -fext to the options for the markdown program
3. `try`ify a bunch more of the test cases.
2009-06-17 14:30:43 -07:00
David Parsons 2887caf2c3 tryify three more testcases 2009-06-17 13:03:36 -07:00
David Parsons bb51894f18 tryify the paragraph flow testsuite 2009-06-17 12:18:51 -07:00
David Parsons e5d6de933a Plan9 documentation corrections from Josh Wood 2009-06-17 11:51:09 -07:00
David Parsons 46f934d147 Revise a whole bunch of test cases to use my try function.
Find and fix a bug where a url with an embedded double quote
 is printed out with that doublequote in plaintext.
2009-06-17 11:39:55 -07:00
David Parsons 8f2ce06098 Add utf-8 support to cols.c 2009-06-17 10:22:50 -07:00
David Parsons b3a8d1f07c Add ( to the acceptable nonalnum list for autolinks 2009-06-16 21:18:30 -07:00
David Parsons 97787cebd5 Add a few more Mike Schiraldi test cases. 2009-06-16 19:11:05 -07:00
David Parsons 9fd5dc06d1 Widen the range of permissible non-alnum characters in
an autolink, add more testcases for those new characters.
2009-06-16 18:22:03 -07:00
David Parsons 0f64df4d52 Don't do the backslash escaping in the main switch loop of puturl,
but treat backslashes as prefixes.   Also be more paranoid when
building the possible url and don't capture EOF if there's a
trailing backslash.
2009-06-16 16:03:20 -07:00
David Parsons cbb3b45a8d Update some tests, add some more tests from Mike Schiraldi,
redo puturl and the url grabbers to do debackslashification
in puturl
2009-06-16 15:12:22 -07:00