7 Commits
1.0.0 ... 1.0.2

Author SHA1 Message Date
0f7f7c1b9d updated version 2017-12-26 05:25:02 +01:00
2ee6840008 fixed the inline code now also for not directly following letters
* em
* s
* strong

updated regex
2017-12-26 05:24:01 +01:00
6619f03879 updated version also in image in readme 2017-12-25 21:28:06 +01:00
7d43a6c593 updated version number 2017-12-25 21:24:14 +01:00
91b687d5e7 fixed inline code for bold, em and s
In inline code the markdown for bold , emphasized
and strike trhough  is not parsed anymore.

Additionally the linker might be now faster on Linux.
2017-12-25 21:21:59 +01:00
82b320d967 fixed spelling in readme 2017-12-25 14:50:26 +01:00
4ef069b356 Created Github issue template 2017-12-25 13:45:45 +01:00
9 changed files with 71 additions and 6 deletions

View File

@ -27,11 +27,26 @@ file(GLOB_RECURSE MADDY_TESTS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tests/maddy/*.cp
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions" # -O2
"${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions"
)
# ------------------------------------------------------------------------------
if (UNIX AND NOT APPLE)
execute_process(COMMAND ${CMAKE_CXX_COMPILER}
-fuse-ld=gold -Wl,--version
ERROR_QUIET OUTPUT_VARIABLE ld_version)
if ("${ld_version}" MATCHES "GNU gold")
message(STATUS "Found Gold linker, use faster linker")
set(CMAKE_EXE_LINKER_FLAGS
"${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
set(CMAKE_SHARED_LINKER_FLAGS
"${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold ")
endif()
endif()
# ------------------------------------------------------------------------------
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libs/gtest/googlemock)
add_subdirectory(libs)

17
ISSUE_TEMPLATE.md Normal file
View File

@ -0,0 +1,17 @@
## Minimal Code Example
```
```
## Conditions
. | .
--------------------- | ------------------
**Operating System:** | ?
**Compiler:** | ?
**Compiler flags:** | ?
**maddy version:** | ?
## Description
What did you try? What is not working?

View File

@ -1,11 +1,11 @@
# maddy
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-brightgreen.svg)](https://semver.org/)
[![Version: 1.0.2](https://img.shields.io/badge/Version-1.0.2-brightgreen.svg)](https://semver.org/)
maddy is a C++ Markdown to HTML **header-only** parser library.
## Supportes OS
## Supported OS
It actually should work on any OS, that supports the C++14 standard library.

View File

@ -41,7 +41,7 @@ public:
void
Parse(std::string& line) override
{
static std::regex re("\\*([^\\*]*)\\*");
static std::regex re("(?!.*`.*|.*<code>.*)\\*(?!.*`.*|.*<\\/code>.*)([^\\*]*)\\*(?!.*`.*|.*<\\/code>.*)");
static std::string replacement = "<em>$1</em>";
line = std::regex_replace(line, re, replacement);

View File

@ -39,7 +39,7 @@ public:
void
Parse(std::string& line) override
{
static std::regex re("\\~\\~([^\\~]*)\\~\\~");
static std::regex re("(?!.*`.*|.*<code>.*)\\~\\~(?!.*`.*|.*<\\/code>.*)([^\\~]*)\\~\\~(?!.*`.*|.*<\\/code>.*)");
static std::string replacement = "<s>$1</s>";
line = std::regex_replace(line, re, replacement);

View File

@ -41,7 +41,7 @@ public:
void
Parse(std::string& line) override
{
static std::regex re("\\*\\*([^\\*\\*]*)\\*\\*");
static std::regex re("(?!.*`.*|.*<code>.*)\\*\\*(?!.*`.*|.*<\\/code>.*)([^\\*\\*]*)\\*\\*(?!.*`.*|.*<\\/code>.*)");
static std::string replacement = "<strong>$1</strong>";
line = std::regex_replace(line, re, replacement);

View File

@ -20,3 +20,14 @@ TEST(MADDY_EMPHASIZEDPARSER, ItReplacesMarkdownWithEmphasizedHTML)
ASSERT_EQ(expected, text);
}
TEST(MADDY_EMPHASIZEDPARSER, ItDoesNotParseInsideInlineCode)
{
std::string text = "some text `*bla*` `/**text*/` testing *it* out";
std::string expected = "some text `*bla*` `/**text*/` testing <em>it</em> out";
auto emphasizedParser = std::make_shared<maddy::EmphasizedParser>();
emphasizedParser->Parse(text);
ASSERT_EQ(expected, text);
}

View File

@ -20,3 +20,14 @@ TEST(MADDY_STRIKETHROUGHPARSER, ItReplacesMarkdownWithStrikeThroughHTML)
ASSERT_EQ(expected, text);
}
TEST(MADDY_STRIKETHROUGHPARSER, ItDoesNotParseInsideInlineCode)
{
std::string text = "some text `~~bla~~` ` ~~text~~ ` testing <code>~~it~~</code> out";
std::string expected = "some text `~~bla~~` ` ~~text~~ ` testing <code>~~it~~</code> out";
auto strikeThroughParser = std::make_shared<maddy::StrikeThroughParser>();
strikeThroughParser->Parse(text);
ASSERT_EQ(expected, text);
}

View File

@ -31,3 +31,14 @@ TEST(MADDY_STRONGPARSER, ItReplacesEmphasizedMarkdownNotWithStrongHTML)
ASSERT_EQ(expected, text);
}
TEST(MADDY_STRONGPARSER, ItDoesNotParseInsideInlineCode)
{
std::string text = "some text **bla** `/**text**/` testing `**it**` out";
std::string expected = "some text **bla** `/**text**/` testing `**it**` out";
auto strongParser = std::make_shared<maddy::StrongParser>();
strongParser->Parse(text);
ASSERT_EQ(expected, text);
}