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

use load instead of convert #542

Merged
merged 3 commits into from
Mar 11, 2022
Merged

Conversation

ggrossetie
Copy link
Member

@ggrossetie ggrossetie commented Mar 6, 2022

What I Did

  • Add tests on Import.Image.getCurrentImagesDir
  • Change the signature of getCurrentImagesDir to make it easier to test
  • Fix the regular expression that checks if the string starts with a protocol: /^(?:[a-z]+:)?\/\//i (remote)
  • Use the load function in attributeReferenceProvider.ts, tableOfContentsProvider.ts and image-paste.ts since we only need an Asciidoctor.Document (instead of the parse/convert)

In a following pull request, I will probably remove a layer of indirection since we don't really need both AsciidocEngine and AsciidocParser.
In other words, AsciidocEngine has little to no value.

@ggrossetie ggrossetie requested a review from danyill March 6, 2022 14:29
@ggrossetie ggrossetie merged commit 789e438 into asciidoctor:master Mar 11, 2022
@ggrossetie ggrossetie deleted the load-fn-usage branch March 11, 2022 19:09
@danyill
Copy link
Contributor

danyill commented Mar 11, 2022

Add tests on Import.Image.getCurrentImagesDir

I'm so happy to see some tests! 😀

In a following pull request, I will probably remove a layer of indirection since we don't really need both AsciidocEngine and AsciidocParser. In other words, AsciidocEngine has little to no value.

One of the problems with the existing approach is sometimes we've been directly calling the convertUsingJavascript and there are times we've been doing it through the AsciidocEngine which is instantiated on startup.
They're not the same and there are undesirable side effects on error messages and other things so I think this would be an improvement.

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.

None yet

2 participants