[Reproducible-commits] [discount] 112/121: Imported Upstream version 2.1.7
Jérémy Bobbio
lunar at moszumanska.debian.org
Tue Sep 23 20:56:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository discount.
commit 03d27c820b538b581ba4f6ea9aed0769c61593aa
Author: Alessandro Ghedini <alessandro at ghedini.me>
Date: Fri Oct 18 23:41:48 2013 +0200
Imported Upstream version 2.1.7
---
COPYRIGHT | 2 +-
Makefile.in | 14 +++++++-------
VERSION | 2 +-
configure.inc | 15 +++++++++++++--
generate.c | 16 +++++++++++++---
markdown.c | 30 ++++++++++++++++++++++--------
markdown.h | 1 +
mkd2html.c | 2 +-
resource.c | 2 ++
tags.c | 3 +++
tests/code.t | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
11 files changed, 113 insertions(+), 23 deletions(-)
diff --git a/COPYRIGHT b/COPYRIGHT
index 7780f19..cab1d3d 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -10,7 +10,7 @@ are met:
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
+3. 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.
diff --git a/Makefile.in b/Makefile.in
index 9bb438a..3bda63d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -64,7 +64,7 @@ $(DESTDIR)$(LIBDIR):
@INSTALL_DIR@ $(DESTDIR)$(LIBDIR)
version.o: version.c VERSION
- $(CC) -DVERSION=\"`cat VERSION`\" -c version.c
+ $(CC) $(CFLAGS) -DVERSION=\"`cat VERSION`\" -c version.c
VERSION:
@true
@@ -76,23 +76,23 @@ blocktags: mktags
# example programs
@THEME at theme: theme.o $(MKDLIB) mkdio.h
- at THEME@ $(CC) $(LFLAGS) -o theme theme.o pgm_options.o -lmarkdown @LIBS@
+ at THEME@ $(CC) $(CFLAGS) $(LFLAGS) -o theme theme.o pgm_options.o -lmarkdown @LIBS@
mkd2html: mkd2html.o $(MKDLIB) mkdio.h
- $(CC) $(LFLAGS) -o mkd2html mkd2html.o -lmarkdown @LIBS@
+ $(CC) $(CFLAGS) $(LFLAGS) -o mkd2html mkd2html.o -lmarkdown @LIBS@
markdown: main.o pgm_options.o $(MKDLIB)
- $(CC) $(LFLAGS) -o markdown main.o pgm_options.o -lmarkdown @LIBS@
+ $(CC) $(CFLAGS) $(LFLAGS) -o markdown main.o pgm_options.o -lmarkdown @LIBS@
makepage: makepage.c pgm_options.o $(MKDLIB) mkdio.h
- $(CC) $(LFLAGS) -o makepage makepage.c pgm_options.o -lmarkdown @LIBS@
+ $(CC) $(CFLAGS) $(LFLAGS) -o makepage makepage.c pgm_options.o -lmarkdown @LIBS@
pgm_options.o: pgm_options.c mkdio.h config.h
- $(CC) -I. -c pgm_options.c
+ $(CC) $(CFLAGS) -I. -c pgm_options.c
main.o: main.c mkdio.h config.h
- $(CC) -I. -c main.c
+ $(CC) $(CFLAGS) -I. -c main.c
$(MKDLIB): $(OBJS)
./librarian.sh make $(MKDLIB) VERSION $(OBJS)
diff --git a/VERSION b/VERSION
index 399088b..04b10b4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.6
+2.1.7
diff --git a/configure.inc b/configure.inc
index 091497f..7b4ac48 100755
--- a/configure.inc
+++ b/configure.inc
@@ -868,6 +868,18 @@ AC_C_INLINE() {
# AC_SCALAR_TYPES checks to see if the compiler can generate 2 and 4 byte ints.
#
AC_SCALAR_TYPES () {
+
+ rc=1
+ LOGN "defining WORD & DWORD scalar types"
+
+ if AC_QUIET AC_CHECK_HEADERS WinDef.h; then
+ # windows machine; BYTE, WORD, DWORD already
+ # defined
+ echo "#include <WinDef.h>" >> $__cwd/config.h
+ TLOG " (defined in WinDef.h)"
+ return 0
+ fi
+
cat > ngc$$.c << EOF
#include <stdio.h>
#include <string.h>
@@ -908,8 +920,6 @@ char **argv;
exit(0);
}
EOF
- rc=1
- LOGN "defining WORD & DWORD scalar types"
if $AC_CC ngc$$.c -o ngc$$; then
while [ "$1" ]; do
case "$1" in
@@ -933,6 +943,7 @@ EOF
0) TLOG "" ;;
*) AC_FAIL " ** FAILED **" ;;
esac
+ return $rc
}
diff --git a/generate.c b/generate.c
index 48b0910..7180a1e 100644
--- a/generate.c
+++ b/generate.c
@@ -73,6 +73,10 @@ isthisspace(MMIOT *f, int i)
{
int c = peek(f, i);
+ if ( c == EOF )
+ return 1;
+ if ( c & 0x80 )
+ return 0;
return isspace(c) || (c < ' ');
}
@@ -1582,11 +1586,17 @@ printblock(Paragraph *pp, MMIOT *f)
static void
-printcode(Line *t, MMIOT *f)
+printcode(Line *t, char *lang, MMIOT *f)
{
int blanks;
- Qstring("<pre><code>", f);
+ Qstring("<pre><code", f);
+ if (lang) {
+ Qstring(" class=\"", f);
+ Qstring(lang, f);
+ Qstring("\"", f);
+ }
+ Qstring(">", f);
for ( blanks = 0; t ; t = t->next ) {
if ( S(t->text) > t->dle ) {
while ( blanks ) {
@@ -1699,7 +1709,7 @@ display(Paragraph *p, MMIOT *f)
break;
case CODE:
- printcode(p->text, f);
+ printcode(p->text, p->lang, f);
break;
case QUOTE:
diff --git a/markdown.c b/markdown.c
index 7ed7436..13c4d66 100644
--- a/markdown.c
+++ b/markdown.c
@@ -177,6 +177,9 @@ splitline(Line *t, int cutpoint)
}
#define UNCHECK(l) ((l)->flags &= ~CHECKED)
+#define UNLESS_FENCED(t) if (fenced) { \
+ other = 1; l->count += (c == ' ' ? 0 : -1); \
+ } else { t; }
/*
* walk a line, seeing if it's any of half a dozen interesting regular
@@ -188,8 +191,8 @@ checkline(Line *l)
int eol, i;
int dashes = 0, spaces = 0,
equals = 0, underscores = 0,
- stars = 0, tildes = 0,
- backticks = 0;
+ stars = 0, tildes = 0, other = 0,
+ backticks = 0, fenced = 0;
l->flags |= CHECKED;
l->kind = chk_text;
@@ -206,16 +209,19 @@ checkline(Line *l)
if ( c != ' ' ) l->count++;
switch (c) {
- case '-': dashes = 1; break;
- case ' ': spaces = 1; break;
+ case '-': UNLESS_FENCED(dashes = 1); break;
+ case ' ': UNLESS_FENCED(spaces = 1); break;
case '=': equals = 1; break;
- case '_': underscores = 1; break;
+ case '_': UNLESS_FENCED(underscores = 1); break;
case '*': stars = 1; break;
#if WITH_FENCED_CODE
- case '~': tildes = 1; break;
- case '`': backticks = 1; break;
+ case '~': if (other) return; fenced = 1; tildes = 1; break;
+ case '`': if (other) return; fenced = 1; backticks = 1; break;
#endif
- default: return;
+ default:
+ other = 1;
+ l->count--;
+ if (!fenced) return;
}
}
@@ -638,6 +644,14 @@ fencedcodeblock(ParagraphRoot *d, Line **ptr)
if ( iscodefence(r->next, first->count, first->kind) ) {
(*ptr) = r->next->next;
ret = Pp(d, first->next, CODE);
+ if (S(first->text) - first->count > 0) {
+ char *lang_attr = T(first->text) + first->count;
+ while ( *lang_attr != 0 && *lang_attr == ' ' ) lang_attr++;
+ ret->lang = strdup(lang_attr);
+ }
+ else {
+ ret->lang = 0;
+ }
___mkd_freeLine(first);
___mkd_freeLine(r->next);
r->next = 0;
diff --git a/markdown.h b/markdown.h
index 775948a..4ddd928 100644
--- a/markdown.h
+++ b/markdown.h
@@ -49,6 +49,7 @@ typedef struct paragraph {
struct paragraph *down; /* recompiled contents of this paragraph */
struct line *text; /* all the text in this paragraph */
char *ident; /* %id% tag for QUOTE */
+ char *lang; /* lang attribute for CODE */
enum { WHITESPACE=0, CODE, QUOTE, MARKUP,
HTML, STYLE, DL, UL, OL, AL, LISTITEM,
HDR, HR, TABLE, SOURCE } typ;
diff --git a/mkd2html.c b/mkd2html.c
index 42b3770..e269bd0 100644
--- a/mkd2html.c
+++ b/mkd2html.c
@@ -81,7 +81,7 @@ char **argv;
CREATE(footers);
pgm = basename(argv[0]);
- while ( argc ) {
+ while ( argc > 1 ) {
if ( strcmp(argv[1], "-css") == 0 ) {
EXPAND(css) = argv[2];
argc -= 2;
diff --git a/resource.c b/resource.c
index 1dee8e3..327c705 100644
--- a/resource.c
+++ b/resource.c
@@ -51,6 +51,8 @@ ___mkd_freeParagraph(Paragraph *p)
___mkd_freeLines(p->text);
if (p->ident)
free(p->ident);
+ if (p->lang)
+ free(p->lang);
free(p);
}
diff --git a/tags.c b/tags.c
index b5043dd..792ef92 100644
--- a/tags.c
+++ b/tags.c
@@ -26,6 +26,9 @@ mkd_define_tag(char *id, int selfclose)
* either the standard or extra tag tables.
*/
if ( !(p = mkd_search_tags(id, strlen(id))) ) {
+ /* extratags could be deallocated */
+ if ( S(extratags) == 0 )
+ CREATE(extratags);
p = &EXPAND(extratags);
p->id = id;
p->size = strlen(id);
diff --git a/tests/code.t b/tests/code.t
index a5e480a..731f2c1 100644
--- a/tests/code.t
+++ b/tests/code.t
@@ -100,6 +100,55 @@ code
code
~~~</p>'
+try 'fenced code block with lang attribute' \
+'```lang
+code
+```' \
+'<pre><code class="lang">code
+</code></pre>'
+
+try 'fenced code block with lang-name attribute' \
+'```lang-name
+code
+```' \
+'<pre><code class="lang-name">code
+</code></pre>'
+
+try 'fenced code block with lang_name attribute' \
+'```lang_name
+code
+```' \
+'<pre><code class="lang_name">code
+</code></pre>'
+
+try 'fenced code block with lang attribute and space' \
+'``` lang
+code
+```' \
+'<pre><code class="lang">code
+</code></pre>'
+
+try 'fenced code block with lang attribute and multiple spaces' \
+'``` lang
+code
+```' \
+'<pre><code class="lang">code
+</code></pre>'
+
+try 'fenced code block with lang-name attribute and space' \
+'``` lang-name
+code
+```' \
+'<pre><code class="lang-name">code
+</code></pre>'
+
+try 'fenced code block with lang_name attribute and space' \
+'``` lang_name
+code
+```' \
+'<pre><code class="lang_name">code
+</code></pre>'
+
fi
summary $0
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/discount.git
More information about the Reproducible-commits
mailing list