Commit 1e52b9de authored by Alessandro Ghedini's avatar Alessandro Ghedini

Imported Upstream version 2.1.6

parent 288eee8b
->Copyright (C) 2007 David Loren Parsons.
All rights reserved.<-
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicence, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of works must retain the original copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the original copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither my name (David L Parsons) nor the names of contributors to
this code may be used to endorse or promote products derived
from this work without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
1. Redistributions of source code must retain the above copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution, and in the same place and form as other
copyright, license and disclaimer information.
3. The end-user documentation included with the redistribution, if
any, must include the following acknowledgment:
This product includes software developed by
David Loren Parsons <http://www.pell.portland.or.us/~orc>
in the same place and form as other third-party acknowledgments.
Alternately, this acknowledgment may appear in the software
itself, in the same form and location as other such third-party
acknowledgments.
4. Except as contained in this notice, the name of David Loren
Parsons shall not be used in advertising or otherwise to promote
the sale, use or other dealings in this Software without prior
written authorization from David Loren Parsons.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL DAVID LOREN PARSONS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
......@@ -73,7 +73,7 @@ isthisspace(MMIOT *f, int i)
{
int c = peek(f, i);
return isspace(c) || (c == EOF);
return isspace(c) || (c < ' ');
}
......@@ -1335,7 +1335,16 @@ text(MMIOT *f)
case '\\': switch ( c = pull(f) ) {
case '&': Qstring("&amp;", f);
break;
case '<': Qstring("&lt;", f);
case '<': c = peek(f,1);
if ( (c == EOF) || isspace(c) )
Qstring("&lt;", f);
else {
/* Markdown.pl does not escape <[nonwhite]
* sequences */
Qchar('\\', f);
shift(f, -1);
}
break;
case '^': if ( f->flags & (MKD_STRICT|MKD_NOSUPERSCRIPT) ) {
Qchar('\\', f);
......@@ -1424,8 +1433,9 @@ printheader(Paragraph *pp, MMIOT *f)
enum e_alignments { a_NONE, a_CENTER, a_LEFT, a_RIGHT };
static char* alignments[] = { "", " align=\"center\"", " align=\"left\"",
" align=\"right\"" };
static char* alignments[] = { "", " style=\"text-align:center;\"",
" style=\"text-align:left;\"",
" style=\"text-align:right;\"" };
typedef STRING(int) Istring;
......
......@@ -524,6 +524,7 @@ islist(Line *t, int *clip, DWORD flags, int *list_type)
strtoul(T(t->text)+t->dle, &q, 10);
if ( (q > T(t->text)+t->dle) && (q == T(t->text) + (j-1)) ) {
j = nextnonblank(t,j);
/* *clip = j; */
*clip = (j > 4) ? 4 : j;
*list_type = OL;
return AL;
......@@ -729,6 +730,7 @@ isdivmarker(Line *p, int start, DWORD flags)
if ( flags & (MKD_NODIVQUOTE|MKD_STRICT) )
return 0;
start = nextnonblank(p, start);
last= S(p->text) - (1 + start);
s = T(p->text) + start;
......
......@@ -26,7 +26,7 @@ void mkd_shlib_destructor();
/* compilation, debugging, cleanup
*/
int mkd_compile(MMIOT*, mkd_flag_t);
int mkd_cleanup(MMIOT*);
void mkd_cleanup(MMIOT*);
/* markup functions
*/
......
......@@ -12,5 +12,10 @@ try -fautolink 'autolink url with trailing \' \
'http://a.com/\' \
'<p><a href="http://a.com/\">http://a.com/\</a></p>'
try 'backslashes before <text' '\<code>' '<p>\<code></p>'
try 'backslashes before <{EOF}' '\<' '<p>&lt;</p>'
try 'backslashes before <[space]' '\< j' '<p>&lt; j</p>'
summary $0
exit $rc
......@@ -97,14 +97,14 @@ hello|sailor' \
'<table>
<thead>
<tr>
<th align="right">a </th>
<th align="left"> b</th>
<th style="text-align:right;">a </th>
<th style="text-align:left;"> b</th>
</tr>
</thead>
<tbody>
<tr>
<td align="right">hello</td>
<td align="left">sailor</td>
<td style="text-align:right;">hello</td>
<td style="text-align:left;">sailor</td>
</tr>
</tbody>
</table>'
......@@ -257,16 +257,16 @@ try "table with leading |'s and alignment" \
'<table>
<thead>
<tr>
<th align="left">AA</th>
<th align="center">BB</th>
<th align="right">CC</th>
<th style="text-align:left;">AA</th>
<th style="text-align:center;">BB</th>
<th style="text-align:right;">CC</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">aa</td>
<td align="center">bb</td>
<td align="right">cc</td>
<td style="text-align:left;">aa</td>
<td style="text-align:center;">bb</td>
<td style="text-align:right;">cc</td>
</tr>
</tbody>
</table>'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment