@Test public void an_inner_class_should_be_registered() { TestHttpServer.start(Collections.singletonMap("http://example.com/asciidoctorclass.rb", classpath.getResource("org/asciidoctor/internal/asciidoctorclass.rb"))); this.asciidoctor.createGroup() .includeProcessor(new RubyIncludeSource(new HashMap<String, Object>())) .register(); String content = asciidoctor.convertFile( classpath.getResource("sample-with-uri-include.ad"), options().toFile(false).get()); org.jsoup.nodes.Document doc = Jsoup.parse(content, "UTF-8"); Element contentElement = doc.getElementsByAttributeValue("class", "language-ruby").first(); assertThat(contentElement.text(), startsWith(ASCIIDOCTORCLASS_PREFIX)); }
@Test public void a_include_instance_processor_should_be_executed_when_include_macro_is_found() { TestHttpServer.start(Collections.singletonMap("http://example.com/asciidoctorclass.rb", classpath.getResource("org/asciidoctor/internal/asciidoctorclass.rb"))); this.asciidoctor.createGroup() .includeProcessor(new UriIncludeProcessor(new HashMap<String, Object>())) .register(); String content = asciidoctor.convertFile( classpath.getResource("sample-with-uri-include.ad"), options().toFile(false).get()); org.jsoup.nodes.Document doc = Jsoup.parse(content, "UTF-8"); Element contentElement = doc.getElementsByAttributeValue("class", "language-ruby").first(); assertThat(contentElement.text(), startsWith(ASCIIDOCTORCLASS_PREFIX)); }
@Test public void a_include_processor_should_only_handle_its_handles() { this.asciidoctor.createGroup() .includeProcessor(UriIncludeProcessor.class) .register(); String content = asciidoctor.convertFile(classpath.getResource("sample-with-include.ad"), options().toFile(false).get()); org.jsoup.nodes.Document doc = Jsoup.parse(content, "UTF-8"); Element contentElement = doc.getElementsByAttributeValue("class", "bare").first(); assertThat(contentElement.text(), startsWith("sample-book.adoc")); }
@Test public void a_include_processor_can_handle_positional_attrs() { this.asciidoctor.createGroup() .includeProcessor(PositionalAttrsIncludeProcessor.class) .register(); String content = asciidoctor.convertFile(classpath.getResource("sample-with-include-pos-attrs.ad"), options().toFile(false).get()); org.jsoup.nodes.Document doc = Jsoup.parse(content, "UTF-8"); Element contentElement = doc.getElementsByAttributeValue("class", "paragraph IncludeBlock").first(); assertThat(contentElement.text(), startsWith("My,Positional,Attribute List")); }
@Test public void a_include_processor_as_string_should_be_executed_when_include_macro_is_found() { TestHttpServer.start(Collections.singletonMap("http://example.com/asciidoctorclass.rb", classpath.getResource("org/asciidoctor/internal/asciidoctorclass.rb"))); this.asciidoctor.createGroup() .includeProcessor("org.asciidoctor.extension.UriIncludeProcessor") .register(); String content = asciidoctor.convertFile( classpath.getResource("sample-with-uri-include.ad"), options().toFile(false).get()); org.jsoup.nodes.Document doc = Jsoup.parse(content, "UTF-8"); Element contentElement = doc.getElementsByAttributeValue("class", "language-ruby").first(); assertThat(contentElement.text(), startsWith(ASCIIDOCTORCLASS_PREFIX)); }
@Test public void a_include_processor_should_be_executed_when_include_macro_is_found() { TestHttpServer.start(Collections.singletonMap("http://example.com/asciidoctorclass.rb", classpath.getResource("org/asciidoctor/internal/asciidoctorclass.rb"))); this.asciidoctor.createGroup() .includeProcessor(UriIncludeProcessor.class) .register(); String content = asciidoctor.convertFile( classpath.getResource("sample-with-uri-include.ad"), options().toFile(false).get()); org.jsoup.nodes.Document doc = Jsoup.parse(content, "UTF-8"); Element contentElement = doc.getElementsByAttributeValue("class", "language-ruby").first(); assertThat(contentElement.text(), startsWith(ASCIIDOCTORCLASS_PREFIX)); }
.includeProcessor(new IncludeProcessor(new HashMap<String, Object>()) {