azu / promises-book

JavaScript Promiseの本

Home Page:https://azu.github.io/promises-book/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PDF出力結果が意図しない結果である可能性があります

t-mochizuki opened this issue · comments

ソースコードには次のようにあります。

var promise = new Promise(function (resolve){
console.log("inner promise");(1)
resolve(42);
});
promise.then(function(value){
console.log(value); (3)
});
console.log("outer promise");(2)

しかし、ダウンロードしたPDFで同じ箇所を確認したところ次のようになっていました。

promise-book

参照

http://azu.github.io/promises-book/#promise-is-always-async
https://github.com/azu/promises-book/blob/master/Ch2_HowToWrite/column-promise-resolve.adoc

勘違いかもしれませんが、念のためご連絡致しました。
また、適切な修正方法がわかりませんでしたので、Issueのほうに投稿させていただきました。

commented

@t-mochizuki ありがとうございます。
恐らく、PDF生成に使ってる https://github.com/asciidoctor/asciidoctor-fopub のバグの可能性が高そうな気がします。(// <1> という指定をみないで、上から順に連番になってる)

後で、最小で再現するか確認してみます。

@azu 返信が遅くなってしまい申し訳ありません。
ご確認いただきありがとうございます。

@azu すでに確認した後かもしれませんが、ご連絡致します。
最小で再現するか確認してみました。(最小ではないかもしれませんが。。。)

次のようなsample.adocで確認しました。

= Document Title
Doc Writer <doc@example.com>

A sample http://asciidoc.org[AsciiDoc] document.

== Introduction

A paragraph followed by a simple list.

* item 1
* item 2

Here's how you say "`Hello, World!`" in Ruby.

.A basic Ruby application
[source,ruby]
----
var promise = new Promise(function (resolve){
console.log("inner promise");// <1>
resolve(42);
});
promise.then(function(value){
console.log(value);// <3>
});
console.log("outer promise");// <2>
----

TIP: asciidoctor-fopub takes the pain out of converting a DocBook file to a PDF file like this one.
All you need is a Java Development Kit (JDK) and this project.
The rest of the software is fetched and configured by Gradle.

これを次のコマンドでsample.xmlに変換します。

$ asciidoctor -b docbook -d book -a data-uri! sample.adoc

sample.xmlは次のようになります。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<?asciidoc-toc?>
<?asciidoc-numbered?>
<book xmlns="http://docbook.org/ns/docbook" lang="en">
<bookinfo>
<title>Document Title</title>
<date>2014-10-22</date>
<author>
<firstname>Doc</firstname>

<surname>Writer</surname>
<email>doc@example.com</email>
</author>

<authorinitials>DW</authorinitials>



</bookinfo>
<preface>
<title></title>
<simpara>A sample <ulink url="http://asciidoc.org">AsciiDoc</ulink> document.</simpara>
</preface>

<chapter id="_introduction">
<title>Introduction</title>
<simpara>A paragraph followed by a simple list.</simpara>
<itemizedlist>
<listitem>
<simpara>item 1</simpara>
</listitem>
<listitem>
<simpara>item 2</simpara>
</listitem>
</itemizedlist>

<simpara>Here&#8217;s how you say "<literal>Hello, World!</literal>" in Ruby.</simpara>
<formalpara>
<title>A basic Ruby application</title>
<para>
<programlisting language="ruby" linenumbering="unnumbered">var promise = new Promise(function (resolve){
console.log("inner promise");<co id="CO1-1"/>
resolve(42);
});
promise.then(function(value){
console.log(value);<co id="CO1-2"/>
});
console.log("outer promise");<co id="CO1-3"/></programlisting>
</para>
</formalpara>

<tip>
<simpara>asciidoctor-fopub takes the pain out of converting a DocBook file to a PDF file like this one.
All you need is a Java Development Kit (JDK) and this project.
The rest of the software is fetched and configured by Gradle.</simpara>
</tip>

</chapter>
</book>

この時点で// <1>という指定をみないで、上から順に連番になってるようです。

commented

@t-mochizuki 追試ありがとうございます!

asciidoctorのdocbook対応が怪しい or docbookの仕様な感じなみたいですね。

とりあえず、// <1>を避ける方向で修正しました。

2014-10-22_16-35-28

気力あればasciidoctorの方にもIssue立てておきます。。

@azu ありがとうございます!

同じような現象を見つけましたので、念のためご連絡致します。

Ch4_AdvancedPromises/resolve-thenable.adoc

PDF1
promise1

WEB1
promise2

Ch4_AdvancedPromises/not-throw-use-reject.adoc

PDF2
promise3

WEB2
promise4

PDF3
promise5

WEB3
promise6

参照

https://github.com/azu/promises-book/blob/master/Ch4_AdvancedPromises/resolve-thenable.adoc
https://github.com/azu/promises-book/blob/master/Ch4_AdvancedPromises/not-throw-use-reject.adoc

commented

@t-mochizuki ありがとうございます。
修正しました ed48700

PDF2のパースバグがPDF3までやってきて謎のができてたみたいです。

�$B$"$j$,$H$&$4$6$$$^$9!!!*�(B
�$BM>7W$J$3$H$r$7$?$+$H>/$7?4G[$7$^$7$?!#�(B