-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Current implementation works correctly when using load+getContent, convert and convertFile. * Fix 'convert' & 'convertFile' to correctly return Document type when applies * Fix WhenTwoAsciidoctorInstancesAreCreated test, not being run and having invalid code * Format RubyGemsPreloader.java and use immutable Map for options
- Loading branch information
1 parent
0240f02
commit 4b49877
Showing
14 changed files
with
522 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
8 changes: 8 additions & 0 deletions
8
asciidoctorj-api/src/main/java/org/asciidoctor/ast/ImageReference.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.asciidoctor.ast; | ||
|
||
public interface ImageReference { | ||
|
||
String getTarget(); | ||
|
||
String getImagesdir(); | ||
} |
This file contains 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
This file contains 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
39 changes: 39 additions & 0 deletions
39
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/ImageReferenceImpl.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.asciidoctor.jruby.ast.impl; | ||
|
||
import org.asciidoctor.ast.ImageReference; | ||
import org.jruby.RubyStruct; | ||
import org.jruby.javasupport.JavaEmbedUtils; | ||
|
||
public class ImageReferenceImpl implements ImageReference { | ||
|
||
private static final String IMAGESDIR_KEY_NAME = "imagesdir"; | ||
private static final String TARGET_KEY_NAME = "target"; | ||
|
||
private final String target; | ||
private final String imagesdir; | ||
|
||
private ImageReferenceImpl(String target, String imagesdir) { | ||
this.target = target; | ||
this.imagesdir = imagesdir; | ||
} | ||
|
||
static ImageReference getInstance(RubyStruct rubyFootnote) { | ||
final String target = (String) aref(rubyFootnote, TARGET_KEY_NAME); | ||
final String imagesdir = (String) aref(rubyFootnote, IMAGESDIR_KEY_NAME); | ||
return new ImageReferenceImpl(target, imagesdir); | ||
} | ||
|
||
private static Object aref(RubyStruct s, String key) { | ||
return JavaEmbedUtils.rubyToJava(s.aref(s.getRuntime().newString(key))); | ||
} | ||
|
||
@Override | ||
public String getTarget() { | ||
return target; | ||
} | ||
|
||
@Override | ||
public String getImagesdir() { | ||
return imagesdir; | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.