asciidocfx / AsciidocFX

Asciidoc Editor and Toolchain written with JavaFX 21 (Build PDF, Epub, Mobi and HTML books, documents and slides)
http://www.asciidocfx.com/
Apache License 2.0
1.9k stars 299 forks source link

AsciidoxFX Source Code Block Include Content by Line Ranges NOT WORKING #618

Closed life888888 closed 8 months ago

life888888 commented 9 months ago

AsciidoxFX Source Code Block Include Content by Line Ranges NOT WORKING

AsciidoxFX Source Code Block Include Content by Line Ranges NOT WORKING

AsciidocFX Test Version

AsciidocFX 1.8.6 Deb

Test Adoc

Source Code Block Include Content by Line Ranges

[source,java]  
.HelloWorld.java
---- 
include::code/HelloWorld.java[lines=3..5]
----

I want include HelloWorld.java only line 3 to line 5.

But AsciidocFX , include full contents of HelloWorld.java.

Test Result

AsciidocFX preview or save to html is same result : include full contents of HelloWorld.java.

FAIL: include full content of file.

asciidocfx-preview

Other Test - A

sciidoctor and AsciidoctorJ

I also test the adoc file using :

It OK , only include HelloWorld.java only line 3 to line 5.

My Test Code

.
├── code
│   ├── HelloWorld.java
│   └── index.html
├── demo-code-include.adoc
└── docinfo.html

demo-code-include.adoc

= Demo Source Codes Include
:imagesdir: img
:source-highlighter: rouge
:docinfo: shared

Demo Source Codes Include

'''

[source,java]  
.HelloWorld.java
---- 
include::code/HelloWorld.java[lines=3..5]
----

[%linenums,java]  
.HelloWorld.java - show line numbers
---- 
include::code/HelloWorld.java[lines=3..5]
----

'''

[source,html]  
.index.html
---- 
include::code/index.html[lines=8..10]
----

[%linenums,html]  
.index.html - show line numbers
---- 
include::code/index.html[lines=8..10]
----

<<<

code/index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World</title>
</head>

<body>
  <div>Hello World</div>
</body>

</html>

code/HelloWorld.java

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }

}

docinfo.html

<style>
pre.rouge .hll {
  background-color: #ffc;
  display: block;
}
pre.rouge .hll * {
  background-color: initial;
}
</style>

Other Test Code - Asciidoctor and AsciidoctorJ

# Use Asciidoctor Docker
$ docker run --rm -u $(id -u):$(id -g) -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor -o demo-code-include-docker-asciidoctor-2.0.20.html demo-code-include.adoc 

# Use asciidoctorj-2.5.10
$ TOOLS/asciidoctorj-2.5.10/bin/asciidoctorj -o demo-code-include-asciidoctorj-2.5.10.html demo-code-include.adoc 

# Use asciidoctorj-3.0.0-alpha.2-SNAPSHOT
$ TOOLS/asciidoctorj-3.0.0-alpha.2-SNAPSHOT/bin/asciidoctorj -o demo-code-include-asciidoctorj-3.0.0-alpha.2.html demo-code-include.adoc 

Test OK

Only include Content by Line Ranges

asciidoctorj-2 5 10

life888888 commented 9 months ago

Using AsciidocFX 1.8.5 works as expected.

However, using AsciidocFX 1.8.6 results in nonfunctional behavior.

rahmanusta commented 9 months ago

Thanks for reporting, it is in progress to resolve that issue

rahmanusta commented 8 months ago

Hi, you can see the fix in https://github.com/asciidocfx/AsciidocFX/releases/tag/v1.8.7

life888888 commented 8 months ago

Test OK.