Closed rahmanusta closed 10 years ago
Would you be willing to write a failing test in AsciidoctorJ? That way, we can not only track down the source of the error but ensure it doesn't break in the future.
I don't see the Asciidoctor.js integration in AsciidoctorJ yet, but I found a repository Alex has setup for testing Rhino.
https://github.com/lordofthejars/asciidoctorjs
Perhaps you can add a test for Nashhorn there or perhaps @lordofthejars can advise where to add the test?
Hi yes I have a repo where I played with Rhino and Nashorn. Currently there are some problems with Nashorn, it seems that during the integration between AsciidoctorJs and AsciidoctorJ using Nashorn I have found a bug in Nashorn. There is one workaround that is using eval method in any case without using getInterface approach. Probably this weekend I will integrate the workaround into my repo and if it works then I will create a branch on asciidoctorJ with asciidoctorjs integrated.
Excellent! Aha, so this is the same issue you mentioned on the list. I wasn't sure, but now it's clear. Thanks for clarifying.
I'll definitely lend a hand as soon as I can. I'm still focused on getting Asciidoctor core ready for the 1.5.0 release. I'm confident we'll have this working in Nashorn in no time.
Yes I have a workaround so at least I will be able to release it with a workaround on it. But of course I would like to release it with the final version, but if it cannot be then workaround on the way :)
2014-07-30 11:56 GMT+02:00 Dan Allen notifications@github.com:
Excellent! Aha, so this is the same issue you mentioned on the list. I wasn't sure, but now it's clear. Thanks for clarifying.
I'll definitely lend a hand as soon as I can. I'm still focused on getting Asciidoctor core ready for the 1.5.0 release. I'm confident we'll have this working in Nashorn in no time.
— Reply to this email directly or view it on GitHub https://github.com/asciidoctor/asciidoctor.js/issues/40#issuecomment-50595461 .
+----------------------------------------------------------+ Alex Soto Bueno - Computer Engineer www.lordofthejars.com +----------------------------------------------------------+
I'm waiting for this workaround :) im using older versions in https://github.com/rahmanusta/AsciidocFX, it works well.
When this problem will be solved? :=)
Maybe it has something to do with the fact that we aren't registering the DocBook 5 converter when compiling Asciidoctor.js :) I'm okay with doing it, but I think we should compile it in to a separate JavaScript file (asciidoctor-docbook5.js) and only bundle it in asciidoctor-all.js since it's used much less often in a JavaScript environment.
I see, but AsciidocFX need it :)
I hear you loud and clear :) We'll make it happen, just saying that we didn't need it before and cut the converter to save file size.
@anthonny and @Mogztter we need to determine how we want to compile and ship DocBook support for Asciidoctor.js. We can treat it as a separate load path in the build, just like how we convert the extensions.
I'm curious, for what purpose are you creating DocBook in AsciidocFX? Understanding the use case will also help us test it.
very thanks Dan, in AsciidocFX im converting asciidoc book to single docbook file by using asciidoctor.js with Nashorn. And generating PDF book from it by using asciidoctor-fopub. I can use AsciidoctorJ with ruby port but Nashorn and Asciidoctorjs comes me more lightweight. Because of file size and Nashorn's seamless integrity.
That makes sense. Thanks for clarifying!
Thanks from me :)
we need to determine how we want to compile and ship DocBook support for Asciidoctor.js. We can treat it as a separate load path in the build, just like how we convert the extensions. @mojavelinux
Yes we can treat it like that, and then merge it with asciidoctor-core.js
I'd like to keep it out of asciidoctor-core.js to keep the filesize down. I'm okay with putting it in asciidoctor-all.js, but ideally we just keep it separate.
Ok, so an asciidoctor-converters.js (with only Docbook5 in a first time) could be a good solution ?
asciidoctor-docbook5 is more good, i think.
I agree. Just keep it simple for now as asciidoctor-docbook.js (or asciidoctor-docbook-converter.js) (include both DocBook 4.5 and 5 since it's not much extra code).
-Dan
On Wed, Aug 20, 2014 at 1:26 PM, Rahman Usta notifications@github.com wrote:
asciidoctor-docbook5 is more good, i think.
— Reply to this email directly or view it on GitHub https://github.com/asciidoctor/asciidoctor.js/issues/40#issuecomment-52830704 .
Dan Allen | http://google.com/profiles/dan.j.allen
@rahmanusta can you try with my fork : https://github.com/anthonny/asciidoctor.js/tree/docbook-backend
@anthonny i've tried it with asciidoctor-all.js. Then, im getting JSException: TypeError: 'undefined' is not a function (evaluating 'val.$rpartition(": ")') this.
@rahmanusta Can you give me the file and attributes with which you tried ?
It's caused when using : character in title @anthonny . For example;
[[jsr-356-java-api-for-websocket]] == JSR 356: Java API for WebSocket
WebSocket protokolü (RFC 6455) IETF kuruluşu tarafından standardize edilmiştir. WebSocket protokolünü destek sunmak isteyen ortamlar ise bu standarda dayanarak kendi API ve şartnamelerini geliştirmektedirler.
Another problem is that, images surrounded with formalpara instead of figure element.
<formalpara>
<title>WebSocket bağlantı el sıkışması (Handshake)</title>
<para><inlinemediaobject>
<imageobject>
<imagedata fileref="images/image001.png"/>
</imageobject>
<textobject><phrase>image001.png</phrase></textobject>
</inlinemediaobject></para>
</formalpara>
`
I'll look this evening, i will compare asciidoctor
result with asciidoctor.js
result for the same document.
Thanks @anthonny.
I've found another issue;
= Book title :author: Rahman Usta :encoding: utf-8 :lang: tr
include::01-one.asc[] include::02-two.asc[] include::03-three.asc[]
when you convert this to docbook with asciidoctorjs, it wraps elements with "preface" element.
<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc?>
<?asciidoc-numbered?>
<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" lang="tr">
<info>
<title>Book title</title>
<date>2014-08-21</date>
<author>
<personname>
<firstname>Rahman</firstname>
<othername>Usta</othername>
<surname></surname>
</personname>
</author>
<authorinitials>RU</authorinitials>
</info>
<preface>
<title></title>
<simpara><link xlink:href="01-one.asc">01-websocket-protokol.asc</link></simpara>
<simpara><link xlink:href="02-two.asc">02-w3c-api.asc</link></simpara>
<simpara><link xlink:href="03-three.asc">03-jsr356-notasyon.asc</link></simpara>
</preface>
</book>
with preface element, when rendering PDF with apache-fopub, it produces those exceptions.
org.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: "fo:page-sequence" is not a valid child of "fo:flow"! (No context info available) at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:303) at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130) at com.kodcu.service.FopPdfService.generate(FopPdfService.java:74) at com.kodcu.controller.AsciiDocController$1.call(AsciiDocController.java:181) at com.kodcu.controller.AsciiDocController$1.call(AsciiDocController.java:177) at javafx.concurrent.Task$TaskCallable.call(Task.java:1426) at java.util.concurrent.FutureTask.run(FutureTask.java:266)
When you remove preface element, errors goes away.
On Thu, Aug 21, 2014 at 2:43 AM, Rahman Usta notifications@github.com wrote:
org.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: "fo:page-sequence" is not a valid child of "fo:flow"! (No context info available)
There's a good chance this is actually a document structure issue. Verify first that you can use the output if generated with AsciidoctorJ or Asciidoctor core?
Pretty high chance the rpartition method isn't implemented in Opal. We might have to monkey patch. For now, I think you can workaround if your title doesn't contain a colon.
I can workaround with colon by removing it :) I rendered this Asciidoc content with asciidoctor to docbook. it produced like below, there is no preface...
<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc?>
<?asciidoc-numbered?>
<article xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" lang="tr">
<info>
<title>Book title</title>
<date>2014-08-21</date>
<author>
<personname>
<firstname>Rahman</firstname>
<surname>Usta</surname>
</personname>
</author>
<authorinitials>RU</authorinitials>
</info>
<simpara>
Unresolved directive in preface.asc - include::01-one.asc[]
Unresolved directive in preface.asc - include::02-two.asc[]
Unresolved directive in preface.asc - include::03-three.asc[]
</simpara>
</article>
In https://github.com/asciidoctor/asciidoctor.js/issues/40#issuecomment-52893509 the doctype seems to be book
And in https://github.com/asciidoctor/asciidoctor.js/issues/40#issuecomment-52895641 the doctype seems to be article
Maybe this can explain the difference
@anthonny I've append :doctype: book attribute and rendered again with asciidoctor.
<?xml version="1.0" encoding="UTF-8"?>
<?asciidoc-toc?>
<?asciidoc-numbered?>
<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0" lang="tr">
<info>
<title>Book title</title>
<date>2014-08-21</date>
<author>
<personname>
<firstname>Rahman</firstname>
<surname>Usta</surname>
</personname>
</author>
<authorinitials>RU</authorinitials>
</info>
<preface>
<title></title>
<simpara>
Unresolved directive in preface.asc - include::01-one.asc[]
Unresolved directive in preface.asc - include::02-two.asc[]
Unresolved directive in preface.asc - include::03-three.asc[]
</simpara>
</preface>
</book>
But, why preface element brokes PDF generation?
I've detected that when rendering with asciidoctor,
<preface>
and <title></title>
after it removed concluded result. I must remove it manually.
In asciidoctor.js, im rendering each included parts and combining them single xml output. When following this path, preface is not removed normally. I will remove it AsciidocFX manually.
Keep in mind that the preface issue should be handled upstream in Asciidoctor. Thanks!
In latest version of asciidoctor, im getting;
netscape.javascript.JSException: TypeError: 'undefined' is not an object (evaluating '$scope.DocBook5Converter.$new'
I'm using Nashorn JS Engine