Skip to content

Commit a7d9faa

Browse files
committed
Remove deprecated code
1 parent 4015d08 commit a7d9faa

File tree

6 files changed

+8
-51
lines changed

6 files changed

+8
-51
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ maddy uses [semver versioning](https://semver.org/).
2020
* ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) clang-format
2121
* ![**ADDED**](https://img.shields.io/badge/-ADDED-%23099) automatic update dependencies ci
2222
* ![**FIXED**](https://img.shields.io/badge/-FIXED-%23090) `(This is a [link](/ABC/some file) (the URL will include this).)` should not put the later parenthesis into the link url.
23+
* ![**REMOVED**](https://img.shields.io/badge/-REMOVED-%23900) config flags `isEmphasizedParserEnabled` and `isHTMLWrappedInParagraph`
2324

2425
## version 1.3.0 2023-08-26
2526

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,8 @@ std::stringstream markdownInput("");
7070

7171
// config is optional
7272
std::shared_ptr<maddy::ParserConfig> config = std::make_shared<maddy::ParserConfig>();
73-
// config->isEmphasizedParserEnabled = false; // default true - this flag is deprecated
74-
// config->isHTMLWrappedInParagraph = false; // default true - this flag is deprecated
75-
config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER; // equivalent to !isEmphasizedParserEnabled
76-
config->enabledParsers |= maddy::types::HTML_PARSER; // equivalent to !isHTMLWrappedInParagraph
73+
config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER; // disable emphasized parser
74+
config->enabledParsers |= maddy::types::HTML_PARSER; // do not wrap HTML in paragraph
7775

7876
std::shared_ptr<maddy::Parser> parser = std::make_shared<maddy::Parser>(config);
7977
std::string htmlOutput = parser->Parse(markdownInput);

docs/definitions.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ destroy the output, if there was HTML in your markdown.
77
The Parser expects you to use spaces and not tabs for indentation in the
88
markdown.
99

10-
If a line starts with `<` and `config->isHTMLWrappedInParagraph` is false, it
11-
expects that the upcoming line is HTML and therefor will not be surrounded by a
12-
paragraph.
10+
If a line starts with `<` and `config->enabledParsers |= maddy::types::HTML_PARSER;`
11+
is set, it expects that the upcoming line is HTML and therefor will not be
12+
surrounded by a paragraph.
1313

1414
## Headlines
1515

@@ -279,7 +279,7 @@ results in
279279

280280
## emphasized
281281

282-
This can be disabled by setting `config->isEmphasizedParserEnabled = false`.
282+
This can be disabled by setting `config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER;`.
283283

284284
```
285285
_emphasized text_

include/maddy/parser.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,17 +72,6 @@ class Parser
7272
*/
7373
Parser(std::shared_ptr<ParserConfig> config = nullptr) : config(config)
7474
{
75-
// deprecated backward compatibility
76-
// will be removed in 1.4.0 latest including the booleans
77-
if (this->config && !this->config->isEmphasizedParserEnabled)
78-
{
79-
this->config->enabledParsers &= ~maddy::types::EMPHASIZED_PARSER;
80-
}
81-
if (this->config && !this->config->isHTMLWrappedInParagraph)
82-
{
83-
this->config->enabledParsers |= maddy::types::HTML_PARSER;
84-
}
85-
8675
if (!this->config ||
8776
(this->config->enabledParsers & maddy::types::BREAKLINE_PARSER) != 0)
8877
{

include/maddy/parserconfig.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -58,20 +58,6 @@ enum PARSER_TYPE : uint32_t
5858
*/
5959
struct ParserConfig
6060
{
61-
/**
62-
* @deprecated will be removed in 1.4.0 latest
63-
*
64-
* this flag = false == `enabledParsers &= ~maddy::types::EMPHASIZED_PARSER`
65-
*/
66-
bool isEmphasizedParserEnabled;
67-
68-
/**
69-
* @deprecated will be removed in 1.4.0 latest
70-
*
71-
* this flag = false == `enabledParsers |= maddy::types::HTML_PARSER`
72-
*/
73-
bool isHTMLWrappedInParagraph;
74-
7561
/**
7662
* en-/disable headline inline-parsing
7763
*
@@ -85,9 +71,7 @@ struct ParserConfig
8571
uint32_t enabledParsers;
8672

8773
ParserConfig()
88-
: isEmphasizedParserEnabled(true)
89-
, isHTMLWrappedInParagraph(true)
90-
, isHeadlineInlineParsingEnabled(true)
74+
: isHeadlineInlineParsingEnabled(true)
9175
, enabledParsers(maddy::types::DEFAULT)
9276
{}
9377
}; // class ParserConfig

tests/maddy/test_maddy_parser.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,6 @@ TEST(MADDY_PARSER, ItShouldParse)
2121
ASSERT_EQ(testHtml, output);
2222
}
2323

24-
TEST(MADDY_PARSER, ItShouldParseWithConfig)
25-
{
26-
auto config = std::make_shared<maddy::ParserConfig>();
27-
config->isEmphasizedParserEnabled = false;
28-
config->isHTMLWrappedInParagraph = false;
29-
30-
auto parser = std::make_shared<maddy::Parser>(config);
31-
32-
std::stringstream markdown(testMarkdown);
33-
34-
const std::string output = parser->Parse(markdown);
35-
36-
ASSERT_EQ(testHtml2, output);
37-
}
38-
3924
TEST(MADDY_PARSER, ItShouldParseWithBitwiseConfig)
4025
{
4126
auto config = std::make_shared<maddy::ParserConfig>();

0 commit comments

Comments
 (0)