Last active
May 8, 2016 19:51
-
-
Save bclozel/9efef280e8ac43f222f28deabea517a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.asciidoctor.Asciidoctor; | |
import org.asciidoctor.Attributes; | |
import org.asciidoctor.OptionsBuilder; | |
import org.asciidoctor.SafeMode; | |
import org.junit.Test; | |
import static org.assertj.core.api.Assertions.assertThat; | |
public class IncludeUrlsTests { | |
@Test | |
public void includeUrls() throws Exception { | |
String testDoc = "== Example Title\n" + | |
"\n" + | |
"include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/master/prereq_editor_jdk_buildtools.adoc[]"; | |
Asciidoctor engine = Asciidoctor.Factory.create(); | |
Attributes attributes = new Attributes(); | |
attributes.setAllowUriRead(true); | |
String doc = engine.convert(testDoc, OptionsBuilder.options().safe(SafeMode.UNSAFE).attributes(attributes)); | |
assertThat(doc).contains("Example Title").contains("JDK"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>org.asciidoctorj.issues</groupId> | |
<artifactId>asciidoctorj-includeurls</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<dependencies> | |
<!-- Works with 1.5.3 | |
<dependency> | |
<groupId>org.asciidoctor</groupId> | |
<artifactId>asciidoctorj</artifactId> | |
<version>1.5.3</version> | |
</dependency> | |
--> | |
<!-- Fails with 1.5.4 --> | |
<dependency> | |
<groupId>org.asciidoctor</groupId> | |
<artifactId>asciidoctorj</artifactId> | |
<version>1.5.4</version> | |
</dependency> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.12</version> | |
</dependency> | |
<dependency> | |
<groupId>org.assertj</groupId> | |
<artifactId>assertj-core</artifactId> | |
<version>3.3.0</version> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment