diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 5d6a8ffe..91522c82 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -16,7 +16,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co === Breaking changes Improvement:: - +* Add `setContext` function to StructuralNode. Move `getContext` * Fix Macro APIs to take StructuralNodes and return Phrase- or StructuralNodes. (#1084) * Allow Preprocessor extensions to create new Readers and replace the original Reader. (#1081) * Set Java 11 as the minimal version (#1151) (@abelsromero) diff --git a/asciidoctorj-api/src/main/java/org/asciidoctor/ast/ContentNode.java b/asciidoctorj-api/src/main/java/org/asciidoctor/ast/ContentNode.java index 7c876853..da540746 100644 --- a/asciidoctorj-api/src/main/java/org/asciidoctor/ast/ContentNode.java +++ b/asciidoctorj-api/src/main/java/org/asciidoctor/ast/ContentNode.java @@ -16,7 +16,7 @@ public interface ContentNode { ContentNode getParent(); - String getContext(); + Document getDocument(); diff --git a/asciidoctorj-api/src/main/java/org/asciidoctor/ast/StructuralNode.java b/asciidoctorj-api/src/main/java/org/asciidoctor/ast/StructuralNode.java index 875c738d..6fe0cc32 100644 --- a/asciidoctorj-api/src/main/java/org/asciidoctor/ast/StructuralNode.java +++ b/asciidoctorj-api/src/main/java/org/asciidoctor/ast/StructuralNode.java @@ -44,6 +44,10 @@ public interface StructuralNode extends ContentNode { String getTitle(); void setTitle(String title); + String getContext(); + + void setContext(String context); + String getCaption(); void setCaption(String caption); diff --git a/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/ContentNodeImpl.java b/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/ContentNodeImpl.java index 4b181396..ec474548 100644 --- a/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/ContentNodeImpl.java +++ b/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/ContentNodeImpl.java @@ -29,12 +29,6 @@ public void setId(String id) { setString("id", id); } - @Override - public String getContext() { - return getString("context"); - } - - @Override public ContentNode getParent() { return NodeConverter.createASTNode(getRubyProperty("parent")); diff --git a/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/StructuralNodeImpl.java b/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/StructuralNodeImpl.java index 8eea1311..8d4ae061 100644 --- a/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/StructuralNodeImpl.java +++ b/asciidoctorj-core/src/main/java/org/asciidoctor/jruby/ast/impl/StructuralNodeImpl.java @@ -17,6 +17,14 @@ public StructuralNodeImpl(IRubyObject blockDelegate) { super(blockDelegate); } + @Override + public String getContext() { + return getString("context"); + } + + @Override + public void setContext(String context) { setString("context", context); } + @Override public String getTitle() { return getString("title");