-
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.
Merge pull request #1171 from abelsromero/issue-1166-retrieve-all-ima…
…ges-in-catalog-during-conversion Retrieve all images in catalog during conversion
- Loading branch information
Showing
15 changed files
with
523 additions
and
83 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
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.