Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed parsing library to flexmark #245

Merged
merged 1 commit into from
Jan 23, 2018

Conversation

kssimova
Copy link
Contributor

Fix for issues #205 and #244
Signed-off-by: Kristina S. Simova kssimovaa@gmail.com

@svilenvul
Copy link
Contributor

@martinvw, @kaikreuzer ,

it would be really great If one of you can take a look at this PR.

We would really like to include it in release 0.4.1 - #231 (comment)

Copy link
Member

@martinvw martinvw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I added some minor comments looks better great that so much code could be removed :-)

<artifactId>commonmark</artifactId>
<version>${commonmark.version}</version>
</dependency>
<dependency>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please format consistently it looks like a mixture of tabs and spaces.

@@ -251,16 +250,16 @@ protected void logMessage(String filePath, int line, String fileName, String mes
fireErrors(filePath);
dispatcher.fireFileFinished(filePath);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you add this whitespace?

@@ -51,6 +44,7 @@
* info</a>
*
* @author Erdoan Hadzhiyusein - Initial contribution
* @author Lyubomir Papazov - Change the Markdown parser to flexmark
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The author-tags and signed off seem inconsistent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, actually @lpapazow did the changes on the checks and he's the rightful author. He's been working on a new binding and he hasn't had time to update this PR. Because of #244 , we decided that it would be a good idea to include this check in the new release, so I added a new test and fixed some comments from @dstivanov.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the also-by should then be added to the commit message, see https://docs.openhab.org/developers/contributing/contributing.html#sign-your-work


MutableDataSet options = new MutableDataSet();
//By setting this option to true, the parser provides line numbers in the original markdown text for each node
options.set(Parser.TRACK_DOCUMENT_LINES, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hooray, so we do loose some of that flaky code

// The code block is not the first line, and the previous line is not empty
if (zeroBasedStartLineNumber == 0 || !StringUtils.isBlank(fileText.get(zeroBasedStartLineNumber - 1))) {
// log the one-based line number
callback.log(zeroBasedStartLineNumber + 1, EMPTY_LINE_BEFORE_CODE_MSG);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know whether you control the callback, but maybe you should do the adding of one there, it's too easy to forget one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Thanks!

@@ -66,7 +69,7 @@ public void testSpecialHeader() throws Exception {

@Test
public void testEmptyLineBeforeList() throws Exception {
String[] expectedMessages = generateExpectedMessages(1, "The line before a Markdown list must be empty.");
String[] expectedMessages = generateExpectedMessages(2, "The line before a Markdown list must be empty.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do only some of the linenumbers change is that a bug or a feature?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not a bug. After changing the parsing library and adding more tests, the logging in some cases seemed inconsistent, so we changed where the warning message should be placed.

Signed-off-by: Kristina S. Simova <kssimovaa@gmail.com>
@kssimova kssimova force-pushed the mardown-flexmark-new branch from 18bb0e4 to 755071c Compare January 22, 2018 13:03
@martinvw
Copy link
Member

LGTM

@svilenvul svilenvul merged commit b3be2ae into openhab:release-0.4.1 Jan 23, 2018
@kaikreuzer kaikreuzer added this to the 0.5.0 milestone Jan 23, 2018
@kaikreuzer
Copy link
Member

Included in 0.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants