| | @@ -0,0 +1,206 @@ |
| 1 | +/*
|
| 2 | +** Copyright (c) 2009 Robert Ledger
|
| 3 | +**
|
| 4 | +** {{{ License
|
| 5 | +**
|
| 6 | +** This program is free software; you can redistribute it and/or
|
| 7 | +** modify it under the terms of the GNU General Public
|
| 8 | +** License version 2 as published by the Free Software Foundation.
|
| 9 | +**
|
| 10 | +** This program is distributed in the hope that it will be useful,
|
| 11 | +** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +** General Public License for more details.
|
| 14 | +**
|
| 15 | +** You should have received a copy of the GNU General Public
|
| 16 | +** License along with this library; if not, write to the
|
| 17 | +** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
| 18 | +** Boston, MA 02111-1307, USA.
|
| 19 | +**
|
| 20 | +** Author contact information:
|
| 21 | +** [email protected]
|
| 22 | +** http://pytrash.co.uk
|
| 23 | +**}}}
|
| 24 | +*******************************************************************************
|
| 25 | +**
|
| 26 | +** This file contains code to render creole 1.0 formated text as html.
|
| 27 | +*/
|
| 28 | +#include <assert.h>
|
| 29 | +#include "config.h"
|
| 30 | +#include "creoleparser.h"
|
| 31 | +
|
| 32 | +#if INTERFACE
|
| 33 | +#define HAVE_MACRO_EXTENSIONSE
|
| 34 | +#define HAVE_CREOLE_MACRO 1
|
| 35 | +#endif
|
| 36 | +
|
| 37 | +//{{{ LOCAL INTERFACE
|
| 38 | +#if LOCAL_INTERFACE
|
| 39 | +
|
| 40 | +#d#define ZE 100
|
| 41 | +
|
| 42 | +//{{ { KIND
|
| 43 | +#defi 2009 Robert/ms of the GNU Gen/*
|
| 44 | +** Copyright (c) 200 /pytrash.co.uk
|
| 45 | +**}}} 0x0000010
|
| 46 | +#define ED_LIST 0x0 KIND_TABLE{{{ KIND
|
| 47 | +#define K40
|
| 48 | +#define 000020
|
| 49 | +#defin BLOCK 0x00 00080
|
| 50 | +
|
| 51 | +#define KIND_PA 0x00004IPT 0x000100ITALIC efine KIND_ITALIC 0x00008 0x0001RIPT 0x000100SUBSCRIPT UPERSCRIPT 0x0001000
|
| 52 | +#define efine KIND_MONOSPACED 0 ONOSPACED 0x0004000
|
| 53 | +#define 0x0010000
|
| 54 | +
|
| 55 | +#define KIND_MARKER
|
| 56 | +*start;
|
| 57 | + char *end;
|
| 58 | +
|
| 59 | + int kind;
|
| 60 | + int level;
|
| 61 | + int flags;
|
| 62 | +
|
| 63 | + Node *parent;odePool *next;
|
| 64 | + //}}}
|
| 65 | +struct Parser {//{{{
|
| 66 | +
|
| 67 | + Renderer *r;
|
| 68 | +
|
| 69 | + evious;
|
| 70 | + Node * int nFree;
|
| 71 | +
|
| 72 | + Node *this;
|
| 73 | + Node *previous;
|
| 74 | + Node *list;
|
| 75 | +
|
| 76 | + char *cursor;
|
| 77 | +
|
| 78 | + /*
|
| 79 | +** Copyright (cLedger
|
| 80 | +**
|
| 81 | +** {{{ License
|
| 82 | +**
|
| 83 | +** This program is free software; you can redistribute it anAuthor contact information:
|
| 84 | +** [email protected]
|
| 85 | +** http://pytrash.co.uk
|
| 86 | +**}}}
|
| 87 | +*******************************************************************************
|
| 88 | +**
|
| 89 | +** This file contains code to render creole 1.0 formated text as html.
|
| 90 | +*/
|
| 91 | +#include <assert.h>
|
| 92 | +#include "config.h"
|
| 93 | +#include "creoleparser.h"
|
| 94 | +
|
| 95 | +#if INTERFACE
|
| 96 | +#define HAVE_MACRO_EXTENSIONSE
|
| 97 | +#define HAVE_CREOLE_MACRO 1
|
| 98 | +#endif
|
| 99 | +
|
| 100 | +//{{{ LOCAL INTERFACE
|
| 101 | +#if LOCAL_INTERFACE
|
| 102 | +
|
| 103 | +#define POOL_CHUNK_SIZE 100
|
| 104 | +
|
| 105 | +//{{{ KIND
|
| 106 | +#define KIND_ROOT 0x0000001
|
| 107 | +#define KIND_HORIZONTAL_RULE 0x0000002
|
| 108 | +#define KIND_HEADING 0x0000004
|
| 109 | +#define KIND_ORDERED_LIST 0x0000008
|
| 110 | +
|
| 111 | +#define KIND_UNORDERED_LIST 0x0000010
|
| 112 | +#define KIND_PARAGRAPH 0x0000020
|
| 113 | +#define KIND_TABLE 0x0000040
|
| 114 | +#define KIND_NO_WIKI_BLOCK 0x0000080
|
| 115 | +
|
| 116 | +#define KIND_PARA_BREAK 0x0000100
|
| 117 | +#define KIND_END_WIKI_MARKER 0x0000200
|
| 118 | +
|
| 119 | +#define KIND_BOLD 0x0000400
|
| 120 | +#define KIND_ITALIC 0x0000800
|
| 121 | +#define KIND_SUPERSCRIPT 0x0001000
|
| 122 | +#define KIND_SUBSCRIPT 0x0002000
|
| 123 | +#define KIND_MONOSPACED 0x0004000
|
| 124 | +#define KIND_BREAK 0x0008000
|
| 125 | +
|
| 126 | +#define KIND//}}}
|
| 127 | +//{{{ FLAG
|
| 128 | +/
|
| 129 | +#define FLAG_CENTER e {//{{{
|
| 130 | +
|
| 131 | + char *start;
|
| 132 | + char *end;
|
| 133 | +
|
| 134 | + int kind;
|
| 135 | + int level;
|
| 136 | + int flags;
|
| 137 | +
|
| 138 | + Node *parent;
|
| 139 | + Node *next;
|
| 140 | + truct NodePool {//{{{
|
| 141 | + NodePool *next;
|
| 142 | + //}}}
|
| 143 | +struct Parser {//{{{
|
| 144 | +
|
| 145 | + Renderer *r;
|
| 146 | +
|
| 147 | + evious;
|
| 148 | + Node * int nFree;
|
| 149 | +
|
| 150 | + Node *this;
|
| 151 | + Node *previous;
|
| 152 | + Node *list;
|
| 153 | +
|
| 154 | + char *cursor;
|
| 155 | +
|
| 156 | + /*
|
| 157 | +** Copyright (cLedger
|
| 158 | +**
|
| 159 | +** {{{ License
|
| 160 | +**
|
| 161 | +** This program is free software; you can redistribute it anyellow42 free software; you can redistribute it and/or
|
| 162 | +** modify it under the terms of the GNU General/*
|
| 163 | +** Copyright blue+2-2y it under the terms of the/*
|
| 164 | +** Copyr
|
| 165 | +** Copyright (c) 2009/*
|
| 166 | +*{{{
|
| 167 | +
|
| 168 | + char *start;
|
| 169 | + char *end;
|
| 170 | +
|
| 171 | + int kind;
|
| 172 | + int level;
|
| 173 | + int flags;
|
| 174 | +
|
| 175 | + Node *parent;
|
| 176 | + Node *next;
|
| 177 | + truct NodePool {//{{{
|
| 178 | + NodePool *next;
|
| 179 | + //}}}
|
| 180 | +struct Parser {//{{{
|
| 181 | +
|
| 182 | + Renderer *r;
|
| 183 | +
|
| 184 | + evious;
|
| 185 | + Node * int nFree;
|
| 186 | +
|
| 187 | + Node *this;
|
| 188 | + Node *previous;
|
| 189 | + Node *list;
|
| 190 | +
|
| 191 | + char *cursor;
|
| 192 | +
|
| 193 | + /*
|
| 194 | +** Copyright (cLedger
|
| 195 | +**
|
| 196 | +** {{{ License
|
| 197 | +**
|
| 198 | +** This program is free software; you can redistribute it an
|
| 199 | +** Copyright (c) 2009/*
|
| 200 | +** Copyright (
|
| 201 | + Node/*
|
| 202 | +** Copyright (c) 20/*
|
| 203 | + "\n<h%d>%s</h%d>\n",
|
| 204 | + ,
|
| 205 | + node->level
|
| 206 | + s + level |