-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Asciidoctor images #6671
Asciidoctor images #6671
Conversation
I see the |
Block images generate an `image::` line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution, the result of this looks good. Below I list are a few things that came to mind, in no particular order.
Maybe checkout the type classe IsString
, of which Doc Text
is an instance. It allows to write a value as if it was a string. (E.g. Text 3 "foo"
can be shortened to just "foo"
).
Pattern matching on the specific Doc
constructors is clever, as it produces very compact code. But it is also fragile and would break if the return value changed, e.g. by changing the order in which values are concatenated. It would be more robust to construct the result directly. One option could be to construct a new image helper function which both blockToAsciiDoc
and inlineToAsciiDoc
can use.
It's used by both inline an block images.
I implemented @tarleb 's proposed refactoring of the common image code into a helper function that is called by I've run into some trouble though. The command
generates:
Notice the: "Another paragraph" at the the end of the block image. Yet, the native output seems fine:
As the "Another paragraph" is in its own This is the input file
Any idea, 1) if this is an issue; 2) where is the code to solve it? Regards |
Great, looking good! I believe it should be enough to append a |
Almost ready to merge, just one tiny nitpick remaining: would you break the long lines 144 and 559 such that they have 80 chars or less? We try to keep all source lines below that limit. (I'm aware that 559 was overlong before, so it may as well stay that way. But since we are fixing things anyway...) I think it could also be clearer to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good to me!
Leaving it to @jgm to double-check and merge.
Thank you for all the help @tarleb. |
Looks good, thanks for the PR! |
Addresses #6538 by implementing jgm's proposed solution.
I had to change
writer.asciidoctor
to pass the tests.Concretely:
Given the file:
my-test.markdown
This patch generates, after running:
The following file:
I think the current basic test doesn't distinguish between inline and block figures. Should the distinction be added to the basic test?
As mentioned in #3177, this fix is brittle for the time being.
I have only just seen kukimik's comment.