1
0
tükörképe a: https://github.com/quitesimpleorg/qsmaddy.git synced 2025-07-01 23:23:49 +02:00

10 Commit-ok
1.1.1 ... 1.1.2

Szerző SHA1 Üzenet Dátum
38f802de09 updated version 2020-10-04 19:03:44 +02:00
348aa81607 Improved cmake setup 2020-10-04 19:02:39 +02:00
ba5cb5d6c5 Merge pull request #34 from solodolo/numeric-list
orderedlistparser: Add parsing support for fully numeric markdown lists
2020-10-04 18:40:57 +02:00
fd698d1f5f Merge branch 'master' into numeric-list 2020-10-04 18:31:29 +02:00
5b2f20041c Merge pull request #30 from eklitzke/istream
make Parser::Parse accept istreams instead of stringstream
2020-10-04 18:21:25 +02:00
cde0137e90 orderedlistparser: Add parsing support for fully numeric markdown lists 2020-10-03 17:22:21 -05:00
71ee49d1ea make Parser::Parse accept istreams instead of stringstream 2020-07-12 11:30:41 -07:00
19338d2b56 Merge pull request #28 from martin357/master
Added another character for bullet point("-", "+")
2020-02-08 07:54:56 +01:00
cb75226b4a *, + and - are equivalent for making unordered bullet lists as per https://spec-md.com/#sec-Lists
Modified tests and documentation to reflect that.
2020-02-03 22:52:57 +01:00
51d61b68fe Added another character for bullet point("-") 2020-01-30 17:38:55 +01:00
11 fájl változott, egészen pontosan 79 új sor hozzáadva és 20 régi sor törölve

Fájl megtekintése

@ -28,5 +28,5 @@ script:
- mkdir tmp
- cd tmp
- cmake ..
- make
- make -j4
- ../build/MaddyTests

Fájl megtekintése

@ -6,3 +6,6 @@ a license to everyone to use it as detailed in LICENSE.)
M. Petra Baranski (info@progsource.de)
Patrick José Pereira (patrickelectric@gmail.com)
Martin Kopecky (martin.kopecky357@gmail.com)
Andrew Mettlach (dmmettlach@gmail.com)
Evan Klitzke (evan@eklitzke.org)

Fájl megtekintése

@ -60,10 +60,9 @@ add_subdirectory(libs)
# ------------------------------------------------------------------------------
include_directories(
${LIBS_INCLUDE_DIRS}
add_library(maddy INTERFACE)
target_include_directories(maddy INTERFACE
${MADDY_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/tests
)
# ------------------------------------------------------------------------------
@ -73,5 +72,9 @@ add_executable(
${MADDY_TESTS_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/tests/main.cpp
)
target_link_libraries(MaddyTests gmock_main)
target_include_directories(MaddyTests PUBLIC
${LIBS_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/tests
)
target_link_libraries(MaddyTests maddy gmock_main)
add_test(MaddyTests ${CMAKE_CURRENT_SOURCE_DIR}/build/MaddyTests)

Fájl megtekintése

@ -1,4 +1,4 @@
Copyright 2017, 2018, 2019 M. Petra Baranski
Copyright 2017, 2018, 2019, 2020 M. Petra Baranski
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in

Fájl megtekintése

@ -1,7 +1,7 @@
# maddy
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Version: 1.1.1](https://img.shields.io/badge/Version-1.1.1-brightgreen.svg)](https://semver.org/)
[![Version: 1.1.2](https://img.shields.io/badge/Version-1.1.2-brightgreen.svg)](https://semver.org/)
[![Travis Build Status](https://travis-ci.org/progsource/maddy.svg?branch=master)](https://travis-ci.org/progsource/maddy)
[![Appveyor Build Status](https://ci.appveyor.com/api/projects/status/04m0lg27kigv1pg8/branch/master?svg=true)](https://ci.appveyor.com/project/progsource/maddy/branch/master)

Fájl megtekintése

@ -44,11 +44,13 @@ results in
## Lists
### unordered
Characters "*", "+" or "-" to make an unordered "bullet" list are equivalent.
```
* unordered
- unordered
* list
* items
+ items
```
results in
@ -66,8 +68,8 @@ results in
* list
* items
* in
* an
* hierarchy
+ an
- hierarchy
```
results in
@ -92,6 +94,26 @@ results in
```
1. ordered
2. list
3. items
```
results in
```html
<ol>
<li>ordered</li>
<li>list</li>
<li>items</li>
</ol>
```
```
1. ordered
* list
* items

Fájl megtekintése

@ -89,9 +89,9 @@ protected:
bool isStartOfNewListItem = this->isStartOfNewListItem(line);
uint32_t indentation = getIndentationWidth(line);
static std::regex orderedlineRegex("^1\\. ");
static std::regex orderedlineRegex("^[1-9]+[0-9]*\\. ");
line = std::regex_replace(line, orderedlineRegex, "");
static std::regex unorderedlineRegex("^(\\* )");
static std::regex unorderedlineRegex("^\\* ");
line = std::regex_replace(line, unorderedlineRegex, "");
if (!this->isStarted)
@ -132,7 +132,7 @@ private:
bool
isStartOfNewListItem(const std::string& line) const
{
static std::regex re("^(?:1\\. |\\* ).*");
static std::regex re("^(?:[1-9]+[0-9]*\\. |\\* ).*");
return std::regex_match(line, re);
}
}; // class OrderedListParser

Fájl megtekintése

@ -73,11 +73,11 @@ public:
* Parse
*
* @method
* @param {const std::stringstream&} markdown
* @param {const std::istream&} markdown
* @return {std::string} HTML
*/
std::string
Parse(std::stringstream& markdown) const
Parse(std::istream& markdown) const
{
std::string result = "";
std::shared_ptr<BlockParser> currentBlockParser = nullptr;

Fájl megtekintése

@ -54,7 +54,7 @@ public:
static bool
IsStartingLine(const std::string& line)
{
static std::regex re("^\\* .*");
static std::regex re("^[+*-] .*");
return std::regex_match(line, re);
}
@ -89,7 +89,7 @@ protected:
bool isStartOfNewListItem = IsStartingLine(line);
uint32_t indentation = getIndentationWidth(line);
static std::regex lineRegex("^(\\* )");
static std::regex lineRegex("^([+*-] )");
line = std::regex_replace(line, lineRegex, "");
if (!this->isStarted)

Fájl megtekintése

@ -96,3 +96,26 @@ TEST_F(MADDY_ORDEREDLISTPARSER, ItReplacesMarkdownWithAnHierachicalHtmlList)
ASSERT_EQ(expected, outputString);
}
TEST_F(MADDY_ORDEREDLISTPARSER, ItReplacesNumberedMarkdownListWithAnHtmlOrderedList)
{
std::vector<std::string> markdown = {
"1. a"
, "94. b"
, "103. c"
, ""
};
std::string expected = "<ol><li>a</li><li>b</li><li>c</li></ol>";
for (std::string md : markdown)
{
olParser->AddLine(md);
}
ASSERT_TRUE(olParser->IsFinished());
std::stringstream& output(olParser->GetResult());
const std::string& outputString = output.str();
ASSERT_EQ(expected, outputString);
}

Fájl megtekintése

@ -55,9 +55,14 @@ TEST_F(MADDY_UNORDEREDLISTPARSER, ItReplacesMarkdownWithAnHtmlUnorderedList)
std::vector<std::string> markdown = {
"* a"
, "* b"
, "- c"
, "- d"
, "+ e"
, "+ f"
, "* g"
, ""
};
std::string expected = "<ul><li>a</li><li>b</li></ul>";
std::string expected = "<ul><li>a</li><li>b</li><li>c</li><li>d</li><li>e</li><li>f</li><li>g</li></ul>";
for (std::string md : markdown)
{
@ -80,9 +85,12 @@ TEST_F(MADDY_UNORDEREDLISTPARSER, ItReplacesMarkdownWithAnHierachicalHtmlList)
, " * e"
, "* b"
, " * c"
, " + x"
, " + y"
, " - z"
, ""
};
std::string expected = "<ul><li>a<ul><li>d</li><li>e</li></ul></li><li>b<ul><li>c</li></ul></li></ul>";
std::string expected = "<ul><li>a<ul><li>d</li><li>e</li></ul></li><li>b<ul><li>c</li><li>x</li><li>y</li><li>z</li></ul></li></ul>";
for (std::string md : markdown)
{