Commit Graph
100 Commits
Author SHA1 Message Date
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
David Parsons c1f5a20363 Changes to the Plan9 code supplied by Josh Wood 2009-06-15 23:22:01 -07:00
David Parsons c6d355740d Add defect & wish cases reported by Mike Schiraldi 2009-06-15 22:59:22 -07:00
David Parsons 19e194eddd Add testcases for the Markdown.pl compatability snakepit 2009-06-15 21:39:25 -07:00
David Parsons ff8af93540 Version 1.4.3: Go back in again and hack away at linkyurl()
to try and better follow the horrid behavior of the reference
implementation.
2009-06-15 19:26:24 -07:00
David Parsons 027e728b6d Add Plan9 support (from Josh Wood @ utopian.net) 2009-06-14 10:28:09 -07:00
David Parsons fd212c1c30 1. When testing, use my own tool cols instead of cut (cut doesn't
exist on plan9) and `grep` (with appropriate backslashing) instead
   of `fgrep` (`fgrep` doesn't exist on plan9) or `grep -F` (`-F` option
   doesn't exist on plan9?)
2. move the source for `echo` and `cols` into the new `tools` directory.
2009-06-14 10:23:28 -07:00
David Parsons 61f2d30154 In the mail address validator, FAIL if the first character in the domain
is a `.`, and don't count a trailing `.` as a valid-for-domain `.`
2009-06-13 22:16:11 -07:00
David Parsons 9113820197 Add some testcases for backslash interpretation. 2009-06-13 15:32:22 -07:00
David Parsons db3d3eef44 Rework some of the logic for figuring out if an automatic
link is a mail address, then tuck that logic into a separate
function.   Also make a (failed) stab at the horrible syntax
for `[links](with'comment-like urls)`
2009-06-13 15:32:04 -07:00
David Parsons 3671ed6994 1. Rework maybe_tag_or_link() into three functions; maybe_tag_or_link()
is for `<`automatic links`>`, the new function `maybe_autolink()` is
   for reddit-style inline autolinks, and the new function
   `process_possible_link()` handles the formatting of the token picked
    up by `maybe_tag_or_link()` or `maybe_autolink()`.

2. Fix a bug in `ishdr()` so that it won't pick up a line containing
   a single `#` and emit it as a `<h0>`.

3. Modify the behavior of backslash escaping in `parenthetical()` so
   that all punctuation can be escaped.
2009-06-12 23:26:11 -07:00
David Parsons 633ae61f46 In the implicit link test, verify that we're not consuming any of
the text that follows the implicit link.
2009-06-08 16:58:18 -07:00
David Parsons c99e478aad Rework all of linkylinky() to make it a little bit less of a huge
monster bodge.   It's no shorter, but it's a little bit clearer, I
hope, and now I can revisit it and rework the whole link name gathering
scheme if need be.
2009-06-08 10:39:57 -07:00
David Parsons ddea19ef39 Move the empty []() with baseurl crash test into crash.t 2009-06-07 07:59:53 -07:00
David Parsons f4e66da8e0 There are several places that assume that link.link is non-null,
so it's safer to pre-allocate some room and guarantee that it
will always be non-null instead of hoping I checked everywhere.
2009-06-07 01:22:33 -07:00
David Parsons ac1f28804e Add a test for the baseurl + []() crash. 2009-06-07 00:40:00 -07:00
David Parsons 28e3617384 In linkylinky(), don't examine link.link for base url expansions
unless it has been defined and is longer than the prefix size.
2009-06-07 00:37:24 -07:00
David Parsons e2360b91f7 Rearrange the guts of maybe_tag_or_link to make it better reject
non-tag items.
2009-06-06 22:10:05 -07:00
David Parsons 3bf1f8767d Tweak the version to a beta test version, change out a
duplicate test in linkylinky.t
2009-06-06 10:12:15 -07:00
David Parsons 9b4acbb748 Flag the raw: pseudo-protocol with DENY_HTML -- if -fnohtml is set,
the raw: protocol is disabled no matter what because it lets you
stuff random html into your code.
2009-06-05 23:37:24 -07:00
David Parsons 2cb51b7e38 A few bug fixes and a feature enhancement.
The bug fixes (bugs reported by Mike Schiraldi @ reddit) are
1. If -fautolink is turned on, a naked @ becomes a mailto:
   link.  Fixed by only triggering `maybe_tag_or_link()` on
   alphabetic characters.
2. If -fnohtml is set, forced linebreaks become &lt;br/>.
   Fixed by filtering out nonprinting nonwhitespace characters
   on the input and using ^C as the <br/> generator character
   instead of converting the forced linebreak directly to <br/>.
3. inline links (via []()) don't allow spaces or escaped ) characters.
   Fixed by rewriting `linkyurl()` so it builds a new `Cstring` for
   link.link (which needs to be deleted after use, so I added a new
   `deallocate` field to the bookmark record for `linkylinky` to use,)
   changing the link gobbler to absorb input until a terminator instead
   of until whitespace or a terminator) and allowing \ to escape ), =,
   or ".
4. Change `Qchar` to take an integer instead of a char.

The feature enhancement is the `abbr:` pseudo-protocol, which I had not
implemented because it collided with the old 'eat until whitespace' version
of `linkyurl()`
2009-06-05 22:18:17 -07:00
David Parsons 268bd67729 Document MKD_SAFELINK and MKD_AUTOLINK 2009-05-30 12:39:51 -07:00
David Parsons 9071680841 1. Comment the safelink check in linkylinky
2. Add a testcase for safelink
2009-05-30 11:13:29 -07:00
David Parsons b039e3b1d9 Add two features suggested by Mike Schiraldi (mike@reddit.com);
1. "autolinks" -- expand unbracketed urls into links
      (flag MKD_AUTOLINK, -fautolink in the markdown program)
   2. "safe links" -- don't linkify footnotes where the link protocol
      isn't a well-known protocol (currently http: https:,ftp:,news:)
      (flag MKD_SAFELINK, -fsafelink in the markdown program)
2009-05-28 23:05:17 -07:00
David Parsons cb40546d8a Change the function type for generatexml from void to int 2009-05-12 12:53:16 -07:00
David Parsons 14823c8329 Fix the (broken) prototype for mkd_xml(), mkd_generatexml() 2009-05-12 12:46:55 -07:00
David Parsons af2cfd5a32 Add prototypes for mkd_xml(), mkd_generatexml(), and mkd_line();
change the mkd_text() prototype to mkd_generateline(), add a
`#define` for mkd_text()
2009-05-12 12:44:29 -07:00
David Parsons 73367c3a23 Fix the makefile to install mkd-line, and the links for the new mkd_ functions 2009-05-12 12:40:17 -07:00