Skip to content

Commit

Permalink
Fix code example, changes to the == operator
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-gromeyer committed May 25, 2023
1 parent ffc827c commit 6d1e831
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
13 changes: 8 additions & 5 deletions include/html2md.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
namespace html2md {

/*!
* \brief Options for the conversation from HTML to Markdown
* \warning Make sure to pass valid options, otherwise the output will be
* \brief Options for the conversion from HTML to Markdown
* \warning Make sure to pass valid options; otherwise, the output will be
* invalid!
*
* Example from `tests/main.cpp`:
*
* ```cpp
* auto *options = new html2md::options();
* auto *options = new html2md::Options();
* options->splitLines = false;
*
* html2md::Converter c(html, options);
Expand Down Expand Up @@ -210,8 +210,11 @@ class Converter {
* \param The Converter object to compare with
* \return true if the HTML and options matches otherwise false
*/
bool operator==(const Converter *c) const;
inline bool operator==(const Converter &c) const { return operator==(&c); };
inline bool operator==(const Converter *c) const { return *this == *c; }

inline bool operator==(const Converter &c) const {
return html_ == c.html_ && option == c.option;
}

/*!
* \brief Returns ok().
Expand Down
8 changes: 2 additions & 6 deletions src/html2md.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ Converter *Converter::appendToMd(char ch) {
return this;
}

Converter *Converter::appendToMd(const char *str) {
Converter *Converter::appendToMd(const char *str)
{
if (IsInIgnoredTag())
return this;

Expand Down Expand Up @@ -1033,9 +1034,4 @@ void Converter::TagBlockquote::OnHasLeftOpeningTag(Converter *c) {
void Converter::TagBlockquote::OnHasLeftClosingTag(Converter *c) {
--c->index_blockquote;
}

bool Converter::operator==(const Converter *c) const {
return html_ == c->html_ && option == c->option;
}

} // namespace html2md

0 comments on commit 6d1e831

Please sign in to comment.