From 157dad99ac5fd12c58a7b9f808a77e6b5f4fb105 Mon Sep 17 00:00:00 2001 From: Nathan Phillip Brink Date: Mon, 13 Jul 2015 00:16:08 +0000 Subject: [PATCH] Convert --with-fenced-code to runtime flag for issue #124. This change is more invasive and difficult for me as not all existing preprocessor directives directly translate to `if () {}`. Instead of passing `--with-fenced-code` to `configure.sh`, now use `MKD_FENCEDCODE` or `-ffencedcode`. The output of `markdown -VV` will now display `FENCEDCODE` if the feature is enabled and `!FENCEDCODE` if it is disabled rather than displaying `FENCED-CODE` if the feature is enabled. --- configure.sh | 6 ++-- flags.c | 1 + markdown.1 | 2 ++ markdown.3 | 2 ++ markdown.c | 80 +++++++++++++++++++++++++-------------------------- markdown.h | 1 + mkdio.h.in | 1 + pgm_options.c | 1 + tests/code.t | 63 ++++++++++++++++++++++++++++------------ version.c.in | 3 -- 10 files changed, 94 insertions(+), 66 deletions(-) diff --git a/configure.sh b/configure.sh index ef0307dd..17e98ae2 100755 --- a/configure.sh +++ b/configure.sh @@ -11,7 +11,6 @@ ac_help='--enable-amalloc Enable memory allocation debugging --with-tabstops=N Set tabstops to N characters (default is 4) --with-id-anchor Use id= anchors for table-of-contents links --with-github-tags Allow `_` and `-` in <> tags ---with-fenced-code Allow fenced code blocks --with-urlencoded-anchor Use url-encoded chars to multibyte chars in toc links --enable-all-features Turn on all stable optional features --shared Build shared libraries (default is static)' @@ -47,14 +46,13 @@ TARGET=markdown AC_INIT $TARGET -for banned_with in dl; do - banned_with_variable_ref=\$WITH_`echo "$banned_with" | $AC_UPPERCASE` +for banned_with in dl fenced-code; do + banned_with_variable_ref=\$WITH_`echo "$banned_with" | $AC_UPPERCASE | tr - _` if [ "`eval echo "$banned_with_variable_ref"`" ]; then AC_FAIL "Invalid option: --with-$banned_with. Please use a runtime flag to configure this feature." fi done -test "$WITH_FENCED_CODE" && AC_DEFINE "WITH_FENCED_CODE" 1 test "$WITH_ID_ANCHOR" && AC_DEFINE 'WITH_ID_ANCHOR' 1 test "$WITH_GITHUB_TAGS" && AC_DEFINE 'WITH_GITHUB_TAGS' 1 test "$WITH_URLENCODED_ANCHOR" && AC_DEFINE 'WITH_URLENCODED_ANCHOR' 1 diff --git a/flags.c b/flags.c index cda0f0f8..cb7221aa 100644 --- a/flags.c +++ b/flags.c @@ -32,6 +32,7 @@ static struct flagnames flagnames[] = { { MKD_NOSTYLE, "!STYLE" }, { MKD_NODLDISCOUNT, "!DLDISCOUNT" }, { MKD_DLEXTRA, "DLEXTRA" }, + { MKD_FENCEDCODE, "FENCEDCODE" }, }; #define NR(x) (sizeof x/sizeof x[0]) diff --git a/markdown.1 b/markdown.1 index cde8745e..bdbcc1af 100644 --- a/markdown.1 +++ b/markdown.1 @@ -119,6 +119,8 @@ Enable extra-style definition lists (not default). Both styles may be enabled si Allow markdown extra-style footnotes. .It Ar style Extract