Updated Upskirt. :)

This commit is contained in:
Frank
2011-05-17 00:24:38 +02:00
parent ab5d00cb9f
commit 70eb1982ef
4 changed files with 29 additions and 12 deletions

View File

@@ -9,7 +9,7 @@ News/Changelog
* Added a ``toc`` function that outputs a table of contents.
* Renamed ``markdown`` function to ``html``.
* Updated Upskirt files;
See commits from 2011-05-02 to 2011-05-07:
See commits from 2011-05-02 to 2011-05-16:
https://github.com/tanoku/upskirt/commits/master/

View File

@@ -278,11 +278,11 @@ rndr_header(struct buf *ob, struct buf *text, int level, void *opaque)
if (ob->size)
bufputc(ob, '\n');
if (options->flags & HTML_TOC) {
bufprintf(ob, "<a name=\"toc_%d\"></a>", options->toc_data.header_count++);
}
if (options->flags & HTML_TOC)
bufprintf(ob, "<h%d id=\"toc_%d\">", level, options->toc_data.header_count++);
else
bufprintf(ob, "<h%d>", level);
bufprintf(ob, "<h%d>", level);
if (text) bufput(ob, text->data, text->size);
bufprintf(ob, "</h%d>\n", level);
}
@@ -511,20 +511,20 @@ toc_header(struct buf *ob, struct buf *text, int level, void *opaque)
{
struct html_renderopt *options = opaque;
if (level > options->toc_data.current_level) {
if (level > 1)
while (level > options->toc_data.current_level) {
if (options->toc_data.current_level > 0)
BUFPUTSL(ob, "<li>");
BUFPUTSL(ob, "<ul>\n");
options->toc_data.current_level++;
}
if (level < options->toc_data.current_level) {
while (level < options->toc_data.current_level) {
BUFPUTSL(ob, "</ul>");
if (options->toc_data.current_level > 1)
BUFPUTSL(ob, "</li>\n");
options->toc_data.current_level--;
}
options->toc_data.current_level = level;
bufprintf(ob, "<li><a href=\"#toc_%d\">", options->toc_data.header_count++);
if (text)
bufput(ob, text->data, text->size);

View File

@@ -2215,4 +2215,12 @@ ups_markdown(struct buf *ob, struct buf *ib, const struct mkd_renderer *rndrer,
parr_free(&rndr.work_bufs[BUFFER_BLOCK]);
}
void
ups_version(int *ver_major, int *ver_minor, int *ver_revision)
{
*ver_major = UPSKIRT_VER_MAJOR;
*ver_minor = UPSKIRT_VER_MINOR;
*ver_revision = UPSKIRT_VER_REVISION;
}
/* vim: set filetype=c: */

View File

@@ -21,6 +21,11 @@
#include "buffer.h"
#define UPSKIRT_VERSION "1.2.0"
#define UPSKIRT_VER_MAJOR 1
#define UPSKIRT_VER_MINOR 2
#define UPSKIRT_VER_REVISION 0
/********************
* TYPE DEFINITIONS *
********************/
@@ -104,10 +109,14 @@ is_safe_link(const char *link, size_t link_len);
* EXPORTED FUNCTIONS *
**********************/
/* markdown parses the input buffer and renders it into the output buffer */
/* ups_markdown * parses the input buffer and renders it into the output buffer */
extern void
ups_markdown(struct buf *ob, struct buf *ib, const struct mkd_renderer *rndr, unsigned int extensions);
/* ups_version * returns the library version as major.minor.rev */
extern void
ups_version(int *major, int *minor, int *revision);
#endif
/* vim: set filetype=c: */