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

Cleanup MarkdownGenerator #1152

Merged
merged 1 commit into from Dec 5, 2019
Merged

Conversation

@isomarcte
Copy link
Contributor

isomarcte commented Dec 5, 2019

  • blocksToMarkdown had an unused parameter listLevel. It appears as though the intent was to pass this value to the blockToMarkdown function which also has a parameter by the same name to keep track of indentation level. This is now the case. As a result of this change, there is now no situation in which the default argument value of listLevel in the function blockToMarkdown is used, thus it was removed.
  • In the function blockToMarkdown the matches on UnorderedList and OrderedList are identical code, except for choosing a different bullet character, either - or *, based on the type. This logic was factored out into two new functions, listBlockIndent and listBlocksIndent which allow for a reduction in repeated code in the body of blockToMarkdown.
* `blocksToMarkdown` had an unused parameter `listLevel`. It appears as though the intent was to pass this value to the `blockToMarkdown` function which also has a parameter by the same name to keep track of indentation level. This is now the case. As a result of this change, there is now no situation in which the default argument value of `listLevel` in the function `blockToMarkdown` is used, thus it was removed.
* In the function `blockToMarkdown` the matches on `UnorderedList` and `OrderedList` are identical code, except for choosing a different bullet character, either `-` or `*`, based on the type. This logic was factored out into two new functions, `listBlockIndent` and `listBlocksIndent` which allow for a reduction in repeated code in the body of `blockToMarkdown`.
@isomarcte isomarcte force-pushed the isomarcte:cleanup-markdown-generator branch from 9f5307a to 704a810 Dec 5, 2019
@tgodzik
tgodzik approved these changes Dec 5, 2019
Copy link
Collaborator

tgodzik left a comment

Looks good! Thanks for taking a look!

@tgodzik tgodzik merged commit aa18eaf into scalameta:master Dec 5, 2019
10 checks passed
10 checks passed
ubuntu-latest tests
Details
windows-latest tests
Details
macOS-latest tests
Details
Sbt integration
Details
Maven integration
Details
Gradle integration
Details
Mill integration
Details
Slow tests
Details
Scala cross tests
Details
Scalafmt/Scalacheck/Docs
Details
@isomarcte isomarcte deleted the isomarcte:cleanup-markdown-generator branch Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.