Commit 7b80997f authored by Alessandro Ghedini's avatar Alessandro Ghedini

Update upstream source from tag 'upstream/2.2.4'

Update to upstream version '2.2.4'
with Debian dir 36974492b91650ee7d7dff7ff7805d90e9c0b424
parents 35177b72 0f874ad9
......@@ -35,6 +35,8 @@ Configure.sh has a few options that can be set:
--h1-title Have theme & mkd2html use the first h1 in a document
as the title if there's no pandoc header or title
specified on the command line.
--cxx-binding Wrap mkdio.h with (conditional) 'extern "C"' for c++
binding.
3) Installing sample programs and manpages
......
......@@ -32,9 +32,7 @@ install: $(PGMS) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCDIR) $(D
@INSTALL_PROGRAM@ $(PGMS) $(DESTDIR)$(BINDIR)
./librarian.sh install libmarkdown VERSION $(DESTDIR)$(LIBDIR)
@INSTALL_DATA@ mkdio.h $(DESTDIR)$(INCDIR)
@MK_PKGCONFIG@$(DESTDIR)$(PKGDIR)/$(MKDLIB).pc: $(MKDLIB).pc $(DESTDIR)$(PKGDIR)
@MK_PKGCONFIG@ @INSTALL_DATA@ $(MKDLIB).pc $(DESTDIR)$(PKGDIR)
@MK_PKGCONFIG@@INSTALL_DATA@ $(MKDLIB).pc $(DESTDIR)$(PKGDIR)
install.everything: install install.samples install.man
......@@ -136,7 +134,7 @@ clean:
rm -f $(MKDLIB) `./librarian.sh files $(MKDLIB) VERSION`
distclean spotless: clean
rm -f @GENERATED_FILES@ @CONFIGURE_FILES@ ./mktags ./blocktags ./librarian.sh
@DISTCLEAN@ @GENERATED_FILES@ @CONFIGURE_FILES@ ./mktags ./blocktags
Csio.o: Csio.c cstring.h amalloc.h config.h markdown.h
amalloc.o: amalloc.c
......
DISCOUNT is a implementation of John Gruber's Markdown markup
language. It implements, as far as I can tell, all of the
language as described in
<http://daringfireball.net/projects/markdown/syntax>
DISCOUNT is a implementation of John Gruber & Aaron Swartz's
Markdown markup language. It implements, as far as I can tell,
all of the language as described in
<http://daringfireball.net/projects/markdown/syntax>
and passes the Markdown test suite at
<http://daringfireball.net/projects/downloads/MarkdownTest_1.0.zip>
DISCOUNT is free software written by David Parsons <orc@pell.portland.or.us>;
it is released under a BSD-style license that allows you to do
as you wish with it as long as you don't attempt to claim it as
your own work.
DISCOUNT is free software written by David Parsons
<orc@pell.portland.or.us>; it is released under a BSD-style license
that allows you to do as you wish with it as long as you don't
attempt to claim it as your own work.
Most of the programs included in the DISCOUNT distribution have
manual pages describing how they work.
......
cmake_minimum_required(VERSION 2.8.12)
project(DISCOUNT C)
get_filename_component(_ROOT "${CMAKE_CURRENT_LIST_DIR}" PATH)
file(READ "${_ROOT}/VERSION" ${PROJECT_NAME}_VERSION)
string(STRIP "${${PROJECT_NAME}_VERSION}" ${PROJECT_NAME}_VERSION)
set(${PROJECT_NAME}_WITH_TABSTOPS "4" CACHE STRING
"Set tabstops to N characters (default is 4)")
set(TABSTOP "${${PROJECT_NAME}_WITH_TABSTOPS}")
set(${PROJECT_NAME}_MAKE_INSTALL ON CACHE BOOL
"Set to OFF to disable install rules (default is ON)")
set(${PROJECT_NAME}_INSTALL_SAMPLES OFF CACHE BOOL
"Set to ON to install sample programs (default is OFF)")
# Check headers
include(CheckIncludeFile)
check_include_file(libgen.h HAVE_LIBGEN_H)
check_include_file(pwd.h HAVE_PWD_H)
check_include_file(alloca.h HAVE_ALLOCA_H)
check_include_file(malloc.h HAVE_MALLOC_H)
check_include_file(sys/stat.h HAVE_STAT)
# Types detection (from configure.inc: AC_SCALAR_TYPES ())
include(CheckTypeSize)
check_type_size("unsigned long" SIZEOF_ULONG BUILTIN_TYPES_ONLY)
check_type_size("unsigned int" SIZEOF_UINT BUILTIN_TYPES_ONLY)
check_type_size("unsigned short" SIZEOF_USHORT BUILTIN_TYPES_ONLY)
if(SIZEOF_ULONG EQUAL 4)
set(DWORD "unsigned long")
elseif(SIZEOF_UINT EQUAL 4)
set(DWORD "unsigned int")
else()
message(FATAL_ERROR "Could not detect DWORD type")
endif()
if(SIZEOF_UINT EQUAL 2)
set(WORD "unsigned int")
elseif(SIZEOF_USHORT EQUAL 2)
set(WORD "unsigned short")
else()
message(FATAL_ERROR "Could not detect WORD type")
endif()
set(BYTE "unsigned char")
# Check symbols
include(CheckSymbolExists)
foreach(_symbol
bzero
strcasecmp _stricmp
strncasecmp _strnicmp)
string(TOUPPER ${_symbol} _SYMBOL)
check_symbol_exists(${_symbol} string.h HAVE_${_SYMBOL})
endforeach()
check_symbol_exists(random stdlib.h HAVE_RANDOM)
check_symbol_exists(srandom stdlib.h HAVE_SRANDOM)
check_symbol_exists(getpwuid pwd.h HAVE_GETPWUID)
check_symbol_exists(basename libgen.h HAVE_BASENAME)
check_symbol_exists(fchdir unistd.h HAVE_FCHDIR)
if(HAVE_STAT)
check_symbol_exists(S_ISCHR sys/stat.h HAVE_S_ISCHR)
check_symbol_exists(S_ISFIFO sys/stat.h HAVE_S_ISFIFO)
check_symbol_exists(S_ISSOCK sys/stat.h HAVE_S_ISSOCK)
endif()
if(NOT HAVE_BZERO)
set(DEFINE_BZERO "#define bzero(p, n) memset(p, 0, n)")
endif()
if(NOT HAVE_STRCASECMP)
if(HAVE__STRICMP)
set(DEFINE_STRCASECMP "#define strcasecmp _stricmp")
else()
set(DEFINE_STRCASECMP "#error The symbol strcasecmp is not defined.")
endif()
endif()
if(NOT HAVE_STRNCASECMP)
if(HAVE__STRNICMP)
set(DEFINE_STRNCASECMP "#define strncasecmp _strnicmp")
else()
set(DEFINE_STRNCASECMP "#error The symbol strncasecmp is not defined.")
endif()
endif()
if(NOT HAVE_S_ISCHR OR NOT HAVE_S_ISFIFO OR NOT HAVE_S_ISSOCK)
set(HAVE_STAT "")
endif()
configure_file(config.h.in
"${_ROOT}/config.h"
@ONLY)
configure_file("${_ROOT}/version.c.in"
"${_ROOT}/version.c"
@ONLY)
set_property(SOURCE "${_ROOT}/version.c" APPEND PROPERTY COMPILE_DEFINITIONS
BRANCH=""
VERSION="${${PROJECT_NAME}_VERSION}")
configure_file("${_ROOT}/mkdio.h.in"
"${_ROOT}/mkdio.h"
@ONLY)
include_directories("${_ROOT}")
add_executable(mktags
"${_ROOT}/mktags.c")
add_custom_command(OUTPUT "${_ROOT}/blocktags"
COMMAND mktags > blocktags
WORKING_DIRECTORY "${_ROOT}")
add_library(libmarkdown
"${_ROOT}/mkdio.c"
"${_ROOT}/markdown.c"
"${_ROOT}/dumptree.c"
"${_ROOT}/generate.c"
"${_ROOT}/resource.c"
"${_ROOT}/docheader.c"
"${_ROOT}/version.c"
"${_ROOT}/toc.c"
"${_ROOT}/css.c"
"${_ROOT}/xml.c"
"${_ROOT}/Csio.c"
"${_ROOT}/xmlpage.c"
"${_ROOT}/basename.c"
"${_ROOT}/emmatch.c"
"${_ROOT}/github_flavoured.c"
"${_ROOT}/setup.c"
"${_ROOT}/blocktags" "${_ROOT}/tags.c"
"${_ROOT}/html5.c"
"${_ROOT}/flags.c")
set_target_properties(libmarkdown PROPERTIES
OUTPUT_NAME markdown)
add_library(common OBJECT
"${_ROOT}/pgm_options.c"
"${_ROOT}/gethopt.c")
add_executable(markdown
"${_ROOT}/main.c"
$<TARGET_OBJECTS:common>)
target_link_libraries(markdown PRIVATE libmarkdown)
add_executable(mkd2html
"${_ROOT}/mkd2html.c"
$<TARGET_OBJECTS:common>
"${_ROOT}/notspecial.c")
target_link_libraries(mkd2html PRIVATE libmarkdown)
add_executable(makepage
"${_ROOT}/makepage.c"
$<TARGET_OBJECTS:common>)
target_link_libraries(makepage PRIVATE libmarkdown)
if(${PROJECT_NAME}_MAKE_INSTALL)
string(TOLOWER ${PROJECT_NAME} _PACKAGE_NAME)
include(GNUInstallDirs)
if(NOT DEFINED CMAKE_INSTALL_CMAKEDIR)
set(CMAKE_INSTALL_CMAKEDIR
"${CMAKE_INSTALL_LIBDIR}/cmake/${_PACKAGE_NAME}"
CACHE STRING "CMake packages")
endif()
install(FILES "${_ROOT}/mkdio.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
target_include_directories(libmarkdown INTERFACE
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
set(_TARGETS libmarkdown markdown)
if(${PROJECT_NAME}_INSTALL_SAMPLES)
list(APPEND _TARGETS mkd2html makepage)
endif()
install(TARGETS ${_TARGETS} EXPORT ${_PACKAGE_NAME}-targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(EXPORT ${_PACKAGE_NAME}-targets
NAMESPACE ${_PACKAGE_NAME}::
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${_PACKAGE_NAME}-config-version.cmake"
VERSION ${${PROJECT_NAME}_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file("${CMAKE_CURRENT_LIST_DIR}/discount-config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/${_PACKAGE_NAME}-config.cmake"
@ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${_PACKAGE_NAME}-config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${_PACKAGE_NAME}-config-version.cmake"
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}")
unset(_TARGETS)
unset(_PACKAGE_NAME)
endif()
unset(_ROOT)
/*
* Pre-digested configuration header.
* Generated from cmake/config.h.in.
* Tested with MSVC, MinGW on Windows and with GCC on Linux.
* File prototype: msvc/config.h.vc.
*/
#ifndef _CONFIG_D
#define _CONFIG_D 1
/*
* `discount` feature macros - we want them all!
*/
#ifndef WITH_ID_ANCHOR
#define WITH_ID_ANCHOR 1
#endif
#ifndef WITH_FENCED_CODE
#define WITH_FENCED_CODE 1
#endif
#ifndef WITH_GITHUB_TAGS
#define WITH_GITHUB_TAGS 1
#endif
#ifndef USE_DISCOUNT_DL
#define USE_DISCOUNT_DL 1
#endif
#ifndef USE_EXTRA_DL
#define USE_EXTRA_DL 1
#endif
#ifdef _MSC_VER
/*
* The Visual C++ "C" compiler has a `__inline` keyword implemented
* in Visual Studio 2008 and later, see
* <http://msdn.microsoft.com/de-de/library/cx3b23a3%28v=vs.90%29.aspx>
*/
#if _MSC_VER >= 1500 /* VC 9.0, MSC_VER 15, Visual Studio 2008 */
#define inline __inline
#else
#define inline
#endif /* _MSC_VER >= 1500 */
#endif /* _MSC_VER */
@DEFINE_BZERO@
@DEFINE_STRCASECMP@
@DEFINE_STRNCASECMP@
/*
* Beware of conflicts with <Windows.h>, which typedef's these names.
*/
#ifndef WINVER
#define DWORD @DWORD@
#define WORD @WORD@
#define BYTE @BYTE@
#endif
#cmakedefine HAVE_PWD_H 1
#cmakedefine HAVE_GETPWUID 1
#cmakedefine HAVE_LIBGEN_H 1
#cmakedefine HAVE_BASENAME 1
#cmakedefine HAVE_RANDOM 1
#cmakedefine HAVE_SRANDOM 1
#define INITRNG(x) srand((unsigned int)x)
#define COINTOSS() (rand()&1)
#cmakedefine HAVE_FCHDIR 1
#cmakedefine HAVE_ALLOCA_H 1
#cmakedefine HAVE_MALLOC_H 1
#cmakedefine HAVE_STAT 1
#define TABSTOP @TABSTOP@
#endif /* _CONFIG_D */
include("${CMAKE_CURRENT_LIST_DIR}/@_PACKAGE_NAME@-targets.cmake")
This diff is collapsed.
......@@ -10,7 +10,11 @@
ac_help='--enable-amalloc Enable memory allocation debugging
--with-tabstops=N Set tabstops to N characters (default is 4)
--shared Build shared libraries (default is static)
--pkg-config Install pkg-config(1) glue files'
--pkg-config Install pkg-config(1) glue files
--cxx-binding Install header files with c++ wrappers
--github-checkbox[=input] Enable github-style checkboxes in lists
(if =input, use <input checkbox>, otherwise
use html ballot entities)'
LOCAL_AC_OPTIONS='
set=`locals $*`;
......@@ -38,6 +42,16 @@ locals() {
--PKG-CONFIG)
echo PKGCONFIG=T
;;
--CXX-BINDING)
echo CXX_BINDING=T
;;
--GITHUB-CHECKBOX)
echo GITHUB_CHECKBOX=T
;;
--GITHUB-CHECKBOX=INPUT)
echo GITHUB_CHECKBOX=T
echo GITHUB_CHECKBOX_AS_INPUT=T
;;
esac
}
......@@ -70,7 +84,8 @@ AC_DEFINE THEME_CF "$THEME_CF"
test "$DEBIAN_GLITCH" && AC_DEFINE 'DEBIAN_GLITCH' 1
AC_PROG_CC
AC_CHECK_NORETURN
AC_QUIET AC_PROG git && AC_DEFINE 'HAS_GIT' '1'
AC_CHECK_ATTRIBUTE destructor
test "$TRY_SHARED" && AC_COMPILER_PIC && AC_CC_SHLIBS
......@@ -112,7 +127,37 @@ AC_CHECK_BASENAME
AC_CHECK_ALLOCA
AC_CHECK_HEADERS sys/types.h pwd.h && AC_CHECK_FUNCS getpwuid
AC_CHECK_HEADERS sys/stat.h && AC_CHECK_FUNCS stat
if AC_CHECK_HEADERS sys/stat.h && AC_CHECK_FUNCS stat; then
# need to check some of the S_ISxxx stat macros, because they may not
# exist (for notspecial.c)
cat > ngc$$.c << EOF
#include <sys/stat.h>
main(argc, argv)
char **argv;
{
struct stat info;
if ( stat(argv[0], &info) != 0 )
return 1;
return MACRO(info.st_mode);
}
EOF
LOGN "special file macros in sys/stat.h:"
_none="none"
for x in ISSOCK ISCHR ISFIFO; do
if $AC_CC -DMACRO=S_$x -o ngc$$.o ngc$$.c; then
LOGN " S_${x}"
AC_DEFINE "HAS_${x}" '1'
unset _none
fi
done
LOG "${_none}."
__remove ngc$$.o ngc$$.c
fi
if AC_CHECK_FUNCS srandom; then
AC_DEFINE 'INITRNG(x)' 'srandom((unsigned int)x)'
......@@ -122,13 +167,9 @@ else
AC_DEFINE 'INITRNG(x)' '(void)1'
fi
if AC_CHECK_FUNCS 'bzero((char*)0,0)'; then
: # Yay
elif AC_CHECK_FUNCS 'memset((char*)0,0,0)'; then
AC_DEFINE 'bzero(p,s)' 'memset(p,s,0)'
else
AC_FAIL "$TARGET requires bzero or memset"
fi
AC_CHECK_FUNCS 'memset((char*)0,0,0)' 'string.h' || \
AC_CHECK_FUNCS 'memset((char*)0,0,0)' || \
AC_FAIL "$TARGET requires memset"
if AC_CHECK_FUNCS random; then
AC_DEFINE 'COINTOSS()' '(random()&1)'
......@@ -185,6 +226,11 @@ else
AC_SUB 'H1TITLE' ''
fi
if [ "$GITHUB_CHECKBOX" ]; then
AC_DEFINE 'GITHUB_CHECKBOX' '1'
test "$GITHUB_CHECKBOX_AS_INPUT" && AC_DEFINE 'CHECKBOX_AS_INPUT' '1'
fi
[ "$OS_FREEBSD" -o "$OS_DRAGONFLY" ] || AC_CHECK_HEADERS malloc.h
......@@ -197,3 +243,16 @@ if [ "$PKGCONFIG" ]; then
fi
AC_OUTPUT $GENERATE
if [ "$CXX_BINDING" ]; then
LOG "applying c++ glue to mkdio.h"
mv mkdio.h mkdio.h$$
( echo '#ifdef __cplusplus'
echo 'extern "C" {'
echo '#endif'
cat mkdio.h$$
echo '#ifdef __cplusplus'
echo '}'
echo '#endif' ) > mkdio.h
rm mkdio.h$$
fi
......@@ -111,6 +111,12 @@ dumptree(Paragraph *pp, Stack *sp, FILE *f)
d = fprintf(f, "[%s", Pptype(pp->typ));
if ( pp->ident )
d += fprintf(f, " %s", pp->ident);
#ifdef GITHUB_CHECKBOX
if ( pp->flags )
d += fprintf(f, " %x", pp->flags);
#endif
if ( pp->align > 1 )
d += fprintf(f, ", <%s>", Begin[pp->align]);
......
......@@ -644,6 +644,32 @@ extra_linky(MMIOT *f, Cstring text, Footnote *ref)
} /* extra_linky */
/* check a url (or url fragment to see that it begins with a known good
* protocol (or no protocol at all)
*/
static int
safelink(Cstring link)
{
char *p, *colon;
if ( T(link) == 0 ) /* no link; safe */
return 1;
p = T(link);
if ( (colon = memchr(p, ':', S(link))) == 0 )
return 1; /* no protocol specified: safe */
if ( !isalpha(*p) ) /* protocol/method is [alpha][alnum or '+.-'] */
return 1;
while ( ++p < colon )
if ( !(isalnum(*p) || *p == '.' || *p == '+' || *p == '-') )
return 1;
return isautoprefix(T(link), S(link));
}
/* print out a linky (or fail if it's Not Allowed)
*/
static int
......@@ -658,9 +684,7 @@ linkyformat(MMIOT *f, Cstring text, int image, Footnote *ref)
if ( f->flags & (MKD_NO_EXT|MKD_SAFELINK) )
return 0;
}
else if ( (f->flags & MKD_SAFELINK) && T(ref->link)
&& (T(ref->link)[0] != '/')
&& !isautoprefix(T(ref->link), S(ref->link)) )
else if ( (f->flags & MKD_SAFELINK) && !safelink(ref->link) )
/* if MKD_SAFELINK, only accept links that are local or
* a well-known protocol
*/
......@@ -1619,9 +1643,10 @@ printtable(Paragraph *pp, MMIOT *f)
static int
printblock(Paragraph *pp, MMIOT *f)
{
Line *t = pp->text;
static char *Begin[] = { "", "<p>", "<p style=\"text-align:center;\">" };
static char *End[] = { "", "</p>","</p>" };
Line *t = pp->text;
int align = pp->align;
while (t) {
if ( S(t->text) ) {
......@@ -1641,9 +1666,9 @@ printblock(Paragraph *pp, MMIOT *f)
}
t = t->next;
}
Qstring(Begin[pp->align], f);
Qstring(Begin[align], f);
text(f);
Qstring(End[pp->align], f);
Qstring(End[align], f);
return 1;
}
......@@ -1694,17 +1719,57 @@ printhtml(Line *t, MMIOT *f)
static void
htmlify(Paragraph *p, char *block, char *arguments, MMIOT *f)
htmlify_paragraphs(Paragraph *p, MMIOT *f)
{
___mkd_emblock(f);
if ( block )
Qprintf(f, arguments ? "<%s %s>" : "<%s>", block, arguments);
___mkd_emblock(f);
while (( p = display(p, f) )) {
___mkd_emblock(f);
Qstring("\n\n", f);
}
}
#ifdef GITHUB_CHECKBOX
static void
li_htmlify(Paragraph *p, char *arguments, int flags, MMIOT *f)
{
___mkd_emblock(f);
Qprintf(f, "<li");
if ( arguments )
Qprintf(f, " %s", arguments);
if ( flags & GITHUB_CHECK )
Qprintf(f, " class=\"github_checkbox\"");
Qprintf(f, ">");
#if CHECKBOX_AS_INPUT
if ( flags & GITHUB_CHECK ) {
Qprintf(f, "<input disabled=\"\" type=\"checkbox\"");
if ( flags & IS_CHECKED )
Qprintf(f, " checked=\"checked\"");
Qprintf(f, "/>");
}
#else
if ( flags & GITHUB_CHECK )
Qprintf(f, flags & IS_CHECKED ? "&#x2611;" : "&#x2610;");
#endif
htmlify_paragraphs(p, f);
Qprintf(f, "</li>");
___mkd_emblock(f);
}
#endif
static void
htmlify(Paragraph *p, char *block, char *arguments, MMIOT *f)
{
___mkd_emblock(f);
if ( block )
Qprintf(f, arguments ? "<%s %s>" : "<%s>", block, arguments);
htmlify_paragraphs(p, f);
if ( block )
Qprintf(f, "</%s>", block);
......@@ -1746,7 +1811,11 @@ listdisplay(int typ, Paragraph *p, MMIOT* f)
Qprintf(f, ">\n");
for ( ; p ; p = p->next ) {
#ifdef GITHUB_CHECKBOX
li_htmlify(p->down, p->ident, p->flags, f);
#else
htmlify(p->down, "li", p->ident, f);
#endif
Qchar('\n', f);
}
......@@ -1830,12 +1899,12 @@ mkd_extra_footnotes(MMIOT *m)
for ( j=0; j < S(m->footnotes->note); j++ ) {
t = &T(m->footnotes->note)[j];
if ( (t->refnumber == i) && (t->flags & REFERENCED) ) {
Csprintf(&m->out, "<li id=\"%s:%d\">\n<p>",
Csprintf(&m->out, "<li id=\"%s:%d\">\n",
p_or_nothing(m), t->refnumber);
Csreparse(&m->out, T(t->title), S(t->title), 0);
htmlify(t->text, 0, 0, m);
Csprintf(&m->out, "<a href=\"#%sref:%d\" rev=\"footnote\">&#8617;</a>",
p_or_nothing(m), t->refnumber);
Csprintf(&m->out, "</p></li>\n");
Csprintf(&m->out, "</li>\n");
}
}
}
......@@ -1873,4 +1942,3 @@ mkd_document(Document *p, char **res)
}
return EOF;
}
......@@ -7,7 +7,6 @@
#include <string.h>
#include "gethopt.h"
#include "config.h" /* for bzero() macro on systems that don't have it */
void
......@@ -16,7 +15,7 @@ struct h_context *ctx;
int argc;
char **argv;
{
bzero(ctx, sizeof *ctx);
memset(ctx, 0, sizeof *ctx);
ctx->argc = argc;
ctx->argv = argv;
ctx->optind = 1;
......
......@@ -66,9 +66,9 @@ gfm_populate(getc_func getc, void* ctx, int flags)
*/
Line *headers = T(a->content);
a->title = headers; __mkd_header_dle(a->title);
a->author= headers->next; __mkd_header_dle(a->author);
a->date = headers->next->next; __mkd_header_dle(a->date);
a->title = headers; __mkd_trim_line(a->title, 1);
a->author= headers->next; __mkd_trim_line(a->author, 1);
a->date = headers->next->next; __mkd_trim_line(a->date, 1);
T(a->content) = headers->next->next->next;
}
......
......@@ -13,7 +13,6 @@ mkd_with_html5_tags()
mkd_define_tag("ASIDE", 0);
mkd_define_tag("FOOTER", 0);
mkd_define_tag("HEADER", 0);
mkd_define_tag("HGROUP", 0);
mkd_define_tag("NAV", 0);
mkd_define_tag("SECTION", 0);
mkd_define_tag("ARTICLE", 0);
......
......@@ -137,8 +137,8 @@ main(int argc, char **argv)
show_flags(1, version);
exit(0);
}
else if ( !set_flag(&flags, hoptarg(&blob)) )
complain("unknown option <%s>", hoptarg(&blob));
else if ( q=set_flag(&flags, hoptarg(&blob)) )
complain("unknown option <%s>", q);
break;
case 'G': github_flavoured = 1;
break;
......@@ -151,7 +151,8 @@ main(int argc, char **argv)
case 't': text = hoptarg(&blob);
use_mkd_line = 1;
break;
case 'T': toc = 1;
case 'T': flags |= MKD_TOC;
toc = 1;
break;
case 'C': extra_footnote_prefix = hoptarg(&blob);
break;
......
......@@ -66,8 +66,8 @@ char **argv;
show_flags(1,version);
exit(0);
}
else if ( !set_flag(&flags, hoptarg(&blob)) )
fprintf(stderr, "unknown option <%s>\n", hoptarg(&blob));
else if ( q = set_flag(&flags, hoptarg(&blob)) )
fprintf(stderr, "unknown option <%s>\n", q);
break;
}
}
......
......@@ -170,8 +170,10 @@ splitline(Line *t, int cutpoint)
tmp->next = t->next;
t->next = tmp;
tmp->dle = t->dle;
SUFFIX(tmp->text, T(t->text)+cutpoint, S(t->text)-cutpoint);
EXPAND(tmp->text) = 0;
S(tmp->text)--;
S(t->text) = cutpoint;
}
}
......@@ -608,8 +610,7 @@ codeblock(Paragraph *p)
Line *t = p->text, *r;
for ( ; t; t = r ) {
CLIP(t->text,0,4);
t->dle = mkd_firstnonblank(t);
__mkd_trim_line(t,4);
if ( !( (r = skipempty(t->next)) && iscode(r)) ) {
___mkd_freeLineRange(t,r);
......@@ -804,9 +805,8 @@ quoteblock(Paragraph *p, DWORD flags)
/* clip next space, if any */
if ( T(t->text)[qp] == ' ' )
qp++;
CLIP(t->text, 0, qp);
__mkd_trim_line(t,qp);
UNCHECK(t);
t->dle = mkd_firstnonblank(t);
}