diff --git a/config_host/config_md4c.h.in b/config_host/config_md4c.h.in new file mode 100644 index 000000000000..510693f3d3de --- /dev/null +++ b/config_host/config_md4c.h.in @@ -0,0 +1,7 @@ +#ifndef CONFIG_MD4C_H +#define CONFIG_MD4C_H + +#undef MD4C_MAJOR +#undef MD4C_MINOR + +#endif diff --git a/configure.ac b/configure.ac index 67f6f68965a3..bf305646be63 100644 --- a/configure.ac +++ b/configure.ac @@ -10141,6 +10141,8 @@ if test "x$with_system_md4c" = "xauto"; then fi AC_MSG_CHECKING([which md4c to use]) +MD4C_MAJOR=0 +MD4C_MINOR=6 case "$with_system_md4c" in yes) AC_MSG_RESULT([system]) @@ -10160,6 +10162,10 @@ case "$with_system_md4c" in AC_CHECK_LIB([md4c-html], [md_html], [ MD4C_LIBS="$MD4C_LIBS -lmd4c-html" ], [ AC_MSG_ERROR([system md4c-html library not found or broken.]) ]) + + MD4C_VERSION=`$PKG_CONFIG --modversion md4c 2>/dev/null` + MD4C_MAJOR=`echo $MD4C_VERSION | cut -d"." -f1` + MD4C_MINOR=`echo $MD4C_VERSION | cut -d"." -f2` ;; ""|no) @@ -10180,6 +10186,9 @@ AC_SUBST(MD4C_LIBS) AC_SUBST(MD4C_CFLAGS) AC_SUBST(BUILD_TYPE) +AC_DEFINE_UNQUOTED(MD4C_MAJOR,$MD4C_MAJOR) +AC_DEFINE_UNQUOTED(MD4C_MINOR,$MD4C_MINOR) + dnl =================================================================== dnl Check for system jpeg dnl =================================================================== @@ -16562,6 +16571,7 @@ AC_CONFIG_HEADERS([config_host/config_lgpl.h]) AC_CONFIG_HEADERS([config_host/config_libcxx.h]) AC_CONFIG_HEADERS([config_host/config_liblangtag.h]) AC_CONFIG_HEADERS([config_host/config_locales.h]) +AC_CONFIG_HEADERS([config_host/config_md4c.h]) AC_CONFIG_HEADERS([config_host/config_mpl.h]) AC_CONFIG_HEADERS([config_host/config_oox.h]) AC_CONFIG_HEADERS([config_host/config_options.h]) diff --git a/sw/source/filter/md/mdcallbcks.cxx b/sw/source/filter/md/mdcallbcks.cxx index db74a16d5706..a8bddb7d36d2 100644 --- a/sw/source/filter/md/mdcallbcks.cxx +++ b/sw/source/filter/md/mdcallbcks.cxx @@ -33,6 +33,8 @@ #include #include +#include + #include "swmd.hxx" int SwMarkdownParser::enter_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata) @@ -83,11 +85,13 @@ int SwMarkdownParser::enter_block_callback(MD_BLOCKTYPE type, void* detail, void parser->StartTable(nRow, nCol); break; } +#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6) case MD_BLOCK_ADMONITION: case MD_BLOCK_BLANK: case MD_BLOCK_FOOTNOTE_DEF: case MD_BLOCK_FOOTNOTE_DEF_SECTION: break; +#endif case MD_BLOCK_THEAD: case MD_BLOCK_TBODY: break; @@ -142,11 +146,13 @@ int SwMarkdownParser::leave_block_callback(MD_BLOCKTYPE type, void* /*detail*/, case MD_BLOCK_TABLE: parser->EndTable(); break; +#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6) case MD_BLOCK_ADMONITION: case MD_BLOCK_BLANK: case MD_BLOCK_FOOTNOTE_DEF: case MD_BLOCK_FOOTNOTE_DEF_SECTION: break; +#endif case MD_BLOCK_THEAD: case MD_BLOCK_TBODY: break; @@ -226,6 +232,7 @@ int SwMarkdownParser::enter_span_callback(MD_SPANTYPE type, void* detail, void* case MD_SPAN_LATEXMATH: case MD_SPAN_LATEXMATH_DISPLAY: break; +#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6) case MD_SPAN_FOOTNOTE_REF: case MD_SPAN_INS: case MD_SPAN_MARK: @@ -233,6 +240,7 @@ int SwMarkdownParser::enter_span_callback(MD_SPANTYPE type, void* detail, void* case MD_SPAN_SUPERSCRIPT: case MD_SPAN_SUBSCRIPT: break; +#endif case MD_SPAN_WIKILINK: { const MD_SPAN_WIKILINK_DETAIL* pWikilink @@ -274,6 +282,7 @@ int SwMarkdownParser::leave_span_callback(MD_SPANTYPE type, void* /*detail*/, vo case MD_SPAN_WIKILINK: case MD_SPAN_U: break; +#if MD4C_MAJOR > 0 || (MD4C_MAJOR == 0 && MD4C_MINOR >= 6) case MD_SPAN_FOOTNOTE_REF: case MD_SPAN_INS: case MD_SPAN_MARK: @@ -281,6 +290,7 @@ int SwMarkdownParser::leave_span_callback(MD_SPANTYPE type, void* /*detail*/, vo case MD_SPAN_SUBSCRIPT: case MD_SPAN_SUPERSCRIPT: break; +#endif } return 0; }