1
0
镜像自地址 https://github.com/quitesimpleorg/qsmaddy.git 已同步 2024-11-21 23:27:51 +01:00

Merge pull request #28 from martin357/master

Added another character for bullet point("-", "+")
这个提交包含在:
Petra Baranski 2020-02-08 07:54:56 +01:00 提交者 GitHub
当前提交 19338d2b56
共有 4 个文件被更改,包括 20 次插入8 次删除

查看文件

@ -6,3 +6,5 @@ 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)

查看文件

@ -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

查看文件

@ -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)

查看文件

@ -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)
{