-
Notifications
You must be signed in to change notification settings - Fork 87
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
Refactor htmlToMarkdown.ts
#845
Comments
Merged
github-merge-queue bot
pushed a commit
that referenced
this issue
Feb 29, 2024
Part of #845 This is the first refactor of `htmlToMd.ts`. It brings the following changes: - New function named `buildMathExpression` to build math expressions whether they are inlined or not - New function named `removeEmphasisSpaces` to remove the initial and trailing spaces in an emphasis node - The Unified plugin and the creation of the handlers for it were separated into two functions. The unified plugin was inlined into `generateMarkdownFile` --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 1, 2024
Part of #845 This PR refactors the `htmlToMd.ts` script. It splits the `prepareHandlers` function into some helper functions to simplify the logic and improve the readability.
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 8, 2024
### Summary Part of #845 This PR refactors the `htmlToMd.test.ts` test file. ### Changes - Three tests were removed 1. `merge contiguous emphasis` was merged with `remove spaces from emphasis boundaries`. They were using the same HTML but only adding spaces 2. `convert method and attributes to titles`. This test was incomplete and it's implicitly checked at `convert inline methods`. 3. `convert class method with a problematic output`. The test wasn't checking anything related to the script behavior. The problematic output is due to a bad HTML that should be fixed in the original repo. - Input HTML trimmed for some tests. We were using long inputs to test certain behaviors that don't need it. For example, we were testing the transformation of a table with 11 entries when the same test could use 2 or 3. - Some tests have been organized into sections to easily find them scanning the file. These sections can be found at the end of the test file leaving the uncategorized tests at the beginning. - We were using two helper functions for the tests named `toMd` and `toMdWithMeta` with the only difference that in the first one, we returned the markdown attribute of the transformation instead of the whole object. I merged these two functions with an extra argument to specify when we need to return the metadata.
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 8, 2024
### Summary Part of #845 This PR creates more sections for the `htmlToMd.test.ts` and merges some tests. ### Changes - Merged `parse inline attributes section` and `convert method and attributes to titles and handle inlined methods` into `handle inlined methods and attributes` - Merged `handle <` and `handle {` into `handle special characters: < and {`. - Created three new sections to classify some tests: 1. Transform methods and attributes 2. transform description HTML tags 3. transform admonitions
github-merge-queue bot
pushed a commit
that referenced
this issue
Mar 11, 2024
Closes #845 The PR finishes classifying all tests into sections and removes unnecessary HTML code from `handle inlined methods and attributes`
frankharkins
pushed a commit
to frankharkins/documentation
that referenced
this issue
Jul 22, 2024
Part of Qiskit#845 This is the first refactor of `htmlToMd.ts`. It brings the following changes: - New function named `buildMathExpression` to build math expressions whether they are inlined or not - New function named `removeEmphasisSpaces` to remove the initial and trailing spaces in an emphasis node - The Unified plugin and the creation of the handlers for it were separated into two functions. The unified plugin was inlined into `generateMarkdownFile` --------- Co-authored-by: Eric Arellano <14852634+Eric-Arellano@users.noreply.github.com>
frankharkins
pushed a commit
to frankharkins/documentation
that referenced
this issue
Jul 22, 2024
Part of Qiskit#845 This PR refactors the `htmlToMd.ts` script. It splits the `prepareHandlers` function into some helper functions to simplify the logic and improve the readability.
frankharkins
pushed a commit
to frankharkins/documentation
that referenced
this issue
Jul 22, 2024
frankharkins
pushed a commit
to frankharkins/documentation
that referenced
this issue
Jul 22, 2024
### Summary Part of Qiskit#845 This PR refactors the `htmlToMd.test.ts` test file. ### Changes - Three tests were removed 1. `merge contiguous emphasis` was merged with `remove spaces from emphasis boundaries`. They were using the same HTML but only adding spaces 2. `convert method and attributes to titles`. This test was incomplete and it's implicitly checked at `convert inline methods`. 3. `convert class method with a problematic output`. The test wasn't checking anything related to the script behavior. The problematic output is due to a bad HTML that should be fixed in the original repo. - Input HTML trimmed for some tests. We were using long inputs to test certain behaviors that don't need it. For example, we were testing the transformation of a table with 11 entries when the same test could use 2 or 3. - Some tests have been organized into sections to easily find them scanning the file. These sections can be found at the end of the test file leaving the uncategorized tests at the beginning. - We were using two helper functions for the tests named `toMd` and `toMdWithMeta` with the only difference that in the first one, we returned the markdown attribute of the transformation instead of the whole object. I merged these two functions with an extra argument to specify when we need to return the metadata.
frankharkins
pushed a commit
to frankharkins/documentation
that referenced
this issue
Jul 22, 2024
### Summary Part of Qiskit#845 This PR creates more sections for the `htmlToMd.test.ts` and merges some tests. ### Changes - Merged `parse inline attributes section` and `convert method and attributes to titles and handle inlined methods` into `handle inlined methods and attributes` - Merged `handle <` and `handle {` into `handle special characters: < and {`. - Created three new sections to classify some tests: 1. Transform methods and attributes 2. transform description HTML tags 3. transform admonitions
frankharkins
pushed a commit
to frankharkins/documentation
that referenced
this issue
Jul 22, 2024
Closes Qiskit#845 The PR finishes classifying all tests into sections and removes unnecessary HTML code from `handle inlined methods and attributes`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Split out of #223 and relates to #715.
To do: Split out the huge function into smaller helper functions & write more focused unit tests for those. Right now our unit tests are a bit hard to read and update since they have to mock so much.
The text was updated successfully, but these errors were encountered: