Commit Graph
20 Commits
Author SHA1 Message Date
david parsons 0308244ec8 shuffle around some of the definitions to make everything happily(?) compile with all instances of flags being mkd_flag_t 2018-09-18 08:32:03 -07:00
david parsons 7fdc188f07 clean up all references to flags; define them EVERYWHERE as mkd_flag_t 2018-09-18 08:25:27 -07:00
david parsons f555d4c1c4 fix all places where I pass flags to be DWORDs 2018-09-14 20:18:17 -07:00
david parsons b591d39757 Rework the internals of CLIP() so that it always assigns something to S(t);
this makes anal-compulsive C compilers (I'm looking at _you_, clang) stop
whining about unused values in expressions.
2012-01-24 09:40:42 -08:00
david parsons 9a8436fcbf Tweak the initialization in CREATE() to work around gcc deficiencies 2011-01-13 09:47:51 -08: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 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 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 7ba17fc9c0 Use Csio functions to generate the stylesheet sections,
and move the css output functions off into their own file.
2009-05-12 01:55:10 -07:00
david parsons 142e1155bd Tweak function names (__mkd_reparse -> ___mkd_reparse and
`__mkd_emblock` -> `___mkd_emblock`), add prototypes in `markdown.h`,
change `Csputc()` from an int to a void function, make `Csreparse()`
a void function.
2009-02-28 09:54:42 -08:00
David Parsons 9397c0a5c7 Redo toc.c to add the new function mkd_toc(), which writes the
generate toc to a string.   Documented in `markdown.3`
and `mkd-functions.3`, requires a new file (`Csio.c`) that has
functions for writing to a Cstring, requires that some of the
internal functions in `generate.c` be exposed (and renaed to
`__mkd_`*function* to reduce namespace collisions.

The new functions in Csio (particularly `Csprintf()` should make
it easier to convert many of the other "we print to a `FILE*` and
you need to lump it" functions into a pair of "print to a string"
and "print to a file" functions.
2009-02-27 16:47:02 -08:00
david parsons ed662dfea3 Implement a somewhat better way of handling embedded emphasis,
by writing compiled output into a token queue, then running
an emphasis maker on that queue.  The token queue is an array
of TEXT and EMPHASIS tokens -- `TEXT` being what you'd expect,
and `EMPHASIS` holding counts of consecutive emphasis characters.

It's easier to explain with pretty pictures:

During the process of compiling the string `***HI***`, it gets
broken into five tokens:

1. TEXT `<p>`
2. EMPHASIS `*`3
3. TEXT `HI`
4. EMPHASIS `*`3
5. TEXT `</p>`

and then pasted together into a compiled document.  During the
pasting, emphasis tokens are paired with the next matching emphasis
token, then rewritten into two text sections (opens & closes) which
are treated as normal text during the pasting.

The above tokens are processed like so;  first to

1. TEXT `<p>`
2. EMPHASIS `*`1 [] [`<strong>`]
3. TEXT `HI`
4. EMPHASIS `*`1 [`</strong>`] []
5. TEXT `</p>`

then to

1. TEXT `<p>`
2. EMPHASIS `*`0 [] [`<strong><em>`]
3. TEXT `HI`
4. EMPHASIS `*`0 [`</em></strong>`] []
5. TEXT `</p>`

which is then concatenated to

    <p><strong><em>HI</em></strong></p>

And Bob's your uncle.
2008-04-10 15:49:19 -07:00
david parsons fb1804d0f4 Add additional ()'s in EXPAND() to make certain that we don't run wild allocating memory while
building up a string.
2008-04-03 11:32:19 -07:00
david parsons 5c6115c601 1. Add the new amalloc module, which (if enabled with
--enable-amalloc) replaced malloc and its ilk with
    versions that attempt to maintain a linked list of
    allocated blocks that can be printed to stderr with
    the `adump()` function.

2.  Clean up a couple more places where I leak memory
    during the first level parse.

3.  tweak cstring.h to try to chase down places where
    the C compiler might optimize EXPAND() into producing
    broken code.
2008-04-03 11:22:07 -07:00
david parsons 3c6a7d88d0 Need to #include <string.h> for memmove() 2008-03-01 15:25:10 -08:00
david parsons 084e1df93a Revert the changes to cstring.h (blows up gcc on MacOS) 2008-03-01 15:23:33 -08:00
david parsons dd79f848b7 1. version[] -> markdown_version[]
2. clean up \-escapes so that only special characters will be escaped.
 3. Use the entity &#0; as a token break.
 4. check for the existance of goddamn gcc
2008-02-18 10:09:23 -08:00
David Parsons 880d338ffb 1. Trim back leading spaces when returning fields from the document header.
2. `#include <string.h>` in cstring.h so we can get the prototype for
   `memmove()`
3. Update the mkd2html test program.
2008-01-13 01:40:33 -08:00
david parsons c27ea14dd6 Import a mass of changes from boobook
1. Add the new method mkd_string(), which assembles a list from a string.
2. Add a tests directory and three test files.
3. Move the smartypants code out into a separate function, so I can
   (eventually) pass a /don't_be_clever/ flag in to the markdown()
   function.
4. Redo the mail address mangler so I can mangle the
   mailto: as well as the address.
5. Fix a bug in the DELETE() macro in cstring.h
6. Fix dependencies in the Makefile so that a reconfigure forces a
   complete recompile.
7. Code tweaks to make gcc stfu
8. Tweak the build dependencies again.
2007-12-21 12:03:00 -08:00
David Parsons bd7a799f35 Check all of the bits of markdown into version control before
some horrible catastrophe happens
2007-12-20 18:20:26 -08:00