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

Add the option to skip docbook for single page #1391

Merged
merged 2 commits into from
Nov 8, 2019

Conversation

nik9000
Copy link
Member

@nik9000 nik9000 commented Nov 8, 2019

This adds the option to generate html directly from asciidoctor for
single page books with --direct_html. Right now no books use this but
we'd like to migrate all of them too it once we're sure the output looks
good for them!

Relates to #743

This adds the option to generate html directly from asciidoctor for
single page books with `--direct_html`. Right now no books use this but
we'd like to migrate all of them too it once we're sure the output looks
good for them!

Relates to elastic#743
@nik9000 nik9000 requested review from JoshMock and olksdr November 8, 2019 13:00
@@ -206,27 +208,7 @@ sub build_single {
$raw_dest->mkpath;
}

my %xsltopts = (
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved next to the xslt invocation.

my ( $output, $died );
my $dest_xml = $index->basename;
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved into the branch that deals with the xml.

@@ -267,25 +254,47 @@ sub build_single {
} or do { $output = $@; $died = 1; };
_check_build_error( $output, $died, $lenient );

if ( !$lenient ) {
unless ( $direct_html ) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Everything in here is either moved from above or the same as it was before, just indented one more time.

@@ -52,7 +52,6 @@ module.exports = templateSource => {
* at the end of the chunk in case the marker is on the edge. */
const slice = Math.max(0, chunk.length - preserve);
chunk = chunk.slice(slice) + result.value;
// TODO check if slice + keeps a copy of internal memory. This implementation assumes it *doesn't*
Copy link
Member Author

Choose a reason for hiding this comment

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

I checked this while debugging the failure below.

@@ -189,7 +193,8 @@ module.exports = templateSource => {
const out = apply(raw[Symbol.asyncIterator](), lang, initialJsState);
write.on("close", resolve);
write.on("error", reject);
out.on("error", write.destroy);
// out.on("error", write.destroy) doesn't properly forward the error!
out.on("error", err => write.destroy(err));
Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea why this is required. Maybe destroy is altered once you start the pipe or something.

Copy link
Contributor

@olksdr olksdr left a comment

Choose a reason for hiding this comment

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

perl LGTM! :shipit:

@nik9000 nik9000 merged commit 4439415 into elastic:master Nov 8, 2019
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.

2 participants