قرینه از
https://github.com/quitesimpleorg/qsmaddy.git
synced 2024-11-24 16:22:36 +01:00
*, + and - are equivalent for making unordered bullet lists as per https://spec-md.com/#sec-Lists
Modified tests and documentation to reflect that.
This commit is contained in:
والد
51d61b68fe
کامیت
cb75226b4a
2
AUTHORS
2
AUTHORS
@ -6,3 +6,5 @@ a license to everyone to use it as detailed in LICENSE.)
|
|||||||
|
|
||||||
M. Petra Baranski (info@progsource.de)
|
M. Petra Baranski (info@progsource.de)
|
||||||
Patrick José Pereira (patrickelectric@gmail.com)
|
Patrick José Pereira (patrickelectric@gmail.com)
|
||||||
|
Martin Kopecky (martin.kopecky357@gmail.com)
|
||||||
|
|
||||||
|
@ -44,11 +44,13 @@ results in
|
|||||||
## Lists
|
## Lists
|
||||||
|
|
||||||
### unordered
|
### unordered
|
||||||
|
Characters "*", "+" or "-" to make an unordered "bullet" list are equivalent.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* unordered
|
- unordered
|
||||||
* list
|
* list
|
||||||
* items
|
+ items
|
||||||
|
|
||||||
```
|
```
|
||||||
results in
|
results in
|
||||||
@ -66,8 +68,8 @@ results in
|
|||||||
* list
|
* list
|
||||||
* items
|
* items
|
||||||
* in
|
* in
|
||||||
* an
|
+ an
|
||||||
* hierarchy
|
- hierarchy
|
||||||
|
|
||||||
```
|
```
|
||||||
results in
|
results in
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
static bool
|
static bool
|
||||||
IsStartingLine(const std::string& line)
|
IsStartingLine(const std::string& line)
|
||||||
{
|
{
|
||||||
static std::regex re("^[\\*-] .*");
|
static std::regex re("^[+*-] .*");
|
||||||
return std::regex_match(line, re);
|
return std::regex_match(line, re);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ protected:
|
|||||||
bool isStartOfNewListItem = IsStartingLine(line);
|
bool isStartOfNewListItem = IsStartingLine(line);
|
||||||
uint32_t indentation = getIndentationWidth(line);
|
uint32_t indentation = getIndentationWidth(line);
|
||||||
|
|
||||||
static std::regex lineRegex("^([\\*-] )");
|
static std::regex lineRegex("^([+*-] )");
|
||||||
line = std::regex_replace(line, lineRegex, "");
|
line = std::regex_replace(line, lineRegex, "");
|
||||||
|
|
||||||
if (!this->isStarted)
|
if (!this->isStarted)
|
||||||
|
@ -55,9 +55,14 @@ TEST_F(MADDY_UNORDEREDLISTPARSER, ItReplacesMarkdownWithAnHtmlUnorderedList)
|
|||||||
std::vector<std::string> markdown = {
|
std::vector<std::string> markdown = {
|
||||||
"* a"
|
"* a"
|
||||||
, "* b"
|
, "* 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)
|
for (std::string md : markdown)
|
||||||
{
|
{
|
||||||
@ -80,9 +85,12 @@ TEST_F(MADDY_UNORDEREDLISTPARSER, ItReplacesMarkdownWithAnHierachicalHtmlList)
|
|||||||
, " * e"
|
, " * e"
|
||||||
, "* b"
|
, "* b"
|
||||||
, " * c"
|
, " * 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)
|
for (std::string md : markdown)
|
||||||
{
|
{
|
||||||
|
بارگذاری…
مرجع در شماره جدید
Block a user