Repository: asciidoctor/asciidoctorj
Issue: asciidoctor.loadFile(file, options) doesn't generate complete document.

loadFile doesn't generate complete document, only first paragraph will be processed.
Reading from string (line based reading of a file done before) does work.

The project is maven based and is using version 1.5.4 of asciidoctorj.

// Example of reading via loadFile
Map<String,Object> attributes = new HashMap<String, Object>();
attributes.put("stylesdir", "adocs/css");
attributes.put("stylesheet", "asciidoctor.css");
Map<String, Object> options = new HashMap<String, Object>();
options.put("attributes", attributes);
options.put("in_place", true);
options.put("header", true);
options.put("footer", true);
options.put("safe", 0);

Document document = asciidoctor.loadFile(file, options);

// Example for asciidoctor.load:
Map<String,Object> attributes = new HashMap<String, Object>();
attributes.put("stylesdir", "adocs/css");
attributes.put("stylesheet", "asciidoctor.css");
Map<String, Object> options = new HashMap<String, Object>();
options.put("attributes", attributes);
options.put("in_place", true);
options.put("header", true);
options.put("footer", true);
options.put("safe", 0);

String lines = "";
String tmpString = "";
if (file.canRead())
{
System.out.println("File: " + file + " is readable");
try {
FileReader fileReader = new FileReader(file);
    BufferedReader bufferedReader = new BufferedReader(fileReader);
    while( (tmpString = bufferedReader.readLine()) != null )
    {
        lines = lines + "\\n" + tmpString;
    }
    bufferedReader.close();  
} catch (FileNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}
}
Document document = asciidoctor.load(lines, options);
System.out.println("content: " + document.convert());


Changed files:
asciidoctorj-core/src/main/java/org/asciidoctor/internal/JRubyAsciidoctor.java
asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciiDocIsRenderedToDocument.java

diff --git a/asciidoctorj-core/src/main/java/org/asciidoctor/internal/JRubyAsciidoctor.java b/asciidoctorj-core/src/main/java/org/asciidoctor/internal/JRubyAsciidoctor.java
index 722041e0..64d8c0fd 100644
--- a/asciidoctorj-core/src/main/java/org/asciidoctor/internal/JRubyAsciidoctor.java
+++ b/asciidoctorj-core/src/main/java/org/asciidoctor/internal/JRubyAsciidoctor.java
@@ -598,7 +598,7 @@ public class JRubyAsciidoctor implements Asciidoctor {
     @Override
     public Document loadFile(File file, Map<String, Object> options) {
         RubyHash rubyHash = RubyHashUtil.convertMapToRubyHashWithSymbols(rubyRuntime, options);
-        return new Document(this.asciidoctorModule.load(file.getAbsolutePath(), rubyHash), this.rubyRuntime);
+        return new Document(this.asciidoctorModule.load_file(file.getAbsolutePath(), rubyHash), this.rubyRuntime);
 
     }
 }
diff --git a/asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciiDocIsRenderedToDocument.java b/asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciiDocIsRenderedToDocument.java
index f8d61791..c9fe3609 100644
--- a/asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciiDocIsRenderedToDocument.java
+++ b/asciidoctorj-core/src/test/java/org/asciidoctor/WhenAsciiDocIsRenderedToDocument.java
@@ -1,9 +1,11 @@
 package org.asciidoctor;
 
+import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
 import static org.hamcrest.collection.IsMapContaining.hasKey;
 import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 
 import java.io.File;
@@ -205,4 +207,18 @@ public class WhenAsciiDocIsRenderedToDocument {
         assertThat(content, is(IOUtils.readFull(new FileReader(inputFile))));
     }
 
+    @Test
+    public void should_load_a_document_from_File() throws FileNotFoundException {
+        Map<String, Object> options = OptionsBuilder.options().safe(SafeMode.SAFE)
+            .attributes(AttributesBuilder.attributes().dataUri(false))
+            .compact(true).asMap();
+        File inputFile = classpath.getResource("rendersample.asciidoc");
+        Document document = asciidoctor.loadFile(inputFile, options);
+        assertEquals(1, document.blocks().size());
+        assertThat(document.blocks().get(0), instanceOf(Section.class));
+        Section section = (Section) document.blocks().get(0);
+        assertEquals(1, section.getBlocks().size());
+        assertEquals("<strong>Section A</strong> paragraph.", section.getBlocks().get(0).getContent());
+    }
+
 }