Removed leftover files, adapter OSGi descriptors to new packaging structure
MODIFY
asciidoctorj-api/build.gradle
asciidoctorj-api/build.gradle
@@ -10,7 +10,10 @@ jar {
instruction 'Export-Package',
"org.asciidoctor;version=\"${version}\"",
"org.asciidoctor.ast;version=\"${version}\"",
- "org.asciidoctor.converter;version=\"${version}\""
+ "org.asciidoctor.converter;version=\"${version}\"",
+ "org.asciidoctor.extension;version=\"${version}\"",
+ "org.asciidoctor.log;version=\"${version}\"",
+ "org.asciidoctor.spi;version=\"${version}\""
}
}

MODIFY
asciidoctorj-core/build.gradle
asciidoctorj-core/build.gradle
@@ -51,12 +51,7 @@ jar {
manifest {
symbolicName = 'org.asciidoctor'
instruction 'Export-Package',
- "org.asciidoctor;version=\"${version}\"",
- "org.asciidoctor.ast;version=\"${version}\"",
- "org.asciidoctor.converter;version=\"${version}\"",
- "org.asciidoctor.converter.spi;version=\"${version}\"",
- "org.asciidoctor.extension;version=\"${version}\"",
- "org.asciidoctor.extension.spi;version=\"${version}\""
+ "org.asciidoctor.jruby;version=\"${version}\""
instruction 'Import-Package',
'com.beust.jcommander;resolution:=optional',
'*'

DELETE
asciidoctorj-core/src/main/java/org/asciidoctor/converter/ConverterProxy.java
-package org.asciidoctor.converter;
-
-import org.asciidoctor.ast.ContentNode;
-import org.asciidoctor.jruby.ast.impl.NodeConverter;
-import org.asciidoctor.jruby.internal.RubyHashMapDecorator;
-import org.asciidoctor.jruby.internal.RubyHashUtil;
-import org.asciidoctor.jruby.internal.RubyOutputStreamWrapper;
-import org.jruby.*;
-import org.jruby.anno.JRubyMethod;
-import org.jruby.java.proxies.JavaProxy;
-import org.jruby.javasupport.JavaEmbedUtils;
-import org.jruby.runtime.Block;
-import org.jruby.runtime.Helpers;
-import org.jruby.runtime.ObjectAllocator;
-import org.jruby.runtime.ThreadContext;
-import org.jruby.runtime.builtin.IRubyObject;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collections;
-import java.util.Map;
-
-public class ConverterProxy<T> extends RubyObject {
-
- protected static final String METHOD_NAME_INITIALIZE = "initialize";
-
- private T output;
-
- public static <U, T extends Converter<U> & OutputFormatWriter<U>> RubyClass register(Ruby rubyRuntime, final Class<T> converterClass) {
- RubyModule module = rubyRuntime.defineModule(getModuleName(converterClass));
- RubyClass clazz = module.defineClassUnder(
- converterClass.getSimpleName(),
- rubyRuntime.getObject(),
- new ConverterProxy.Allocator(converterClass));
- includeModule(clazz, "Asciidoctor", "Converter");
-
- clazz.defineAnnotatedMethod(ConverterProxy.class, "initialize");
- clazz.defineAnnotatedMethod(ConverterProxy.class, "convert");
-
- includeModule(clazz, "Asciidoctor", "Writer");
- clazz.defineAnnotatedMethod(ConverterProxy.class, "write");
-
- //clazz.defineAnnotatedMethods(ConverterProxy.class);
- return clazz;
- }
-
- public static class Allocator implements ObjectAllocator {
- private final Class<? extends Converter> converterClass;
-
- public Allocator(Class<? extends Converter> converterClass) {
- this.converterClass = converterClass;
- }
- @Override
- public IRubyObject allocate(Ruby runtime, RubyClass rubyClass) {
- return new ConverterProxy(runtime, rubyClass, converterClass);
- }
-
- public Class<? extends Converter> getConverterClass() {
- return converterClass;
- }
- }
-
- private final Class<? extends Converter> converterClass;
-
- private Converter<T> delegate;
-
- public ConverterProxy(Ruby runtime, RubyClass metaClass, Class<? extends Converter> converterClass) {
- super(runtime, metaClass);
- this.converterClass = converterClass;
- }
-
- @JRubyMethod(required = 1, optional = 1)
- public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
- try {
- String backend = (String) JavaEmbedUtils.rubyToJava(getRuntime(), args[0], String.class);
-
- Constructor<? extends Converter> constructor = converterClass.getConstructor(String.class, Map.class);
- this.delegate = constructor.newInstance(
- backend,
- args.length < 2 ? Collections.emptyMap() : new RubyHashMapDecorator((RubyHash) args[1])
- );
-
- // Initialize the Ruby part and pass in the config options
- RubyHash options = RubyHashUtil.convertMapToRubyHashWithSymbols(context.getRuntime(), this.delegate.getOptions());
- Helpers.invokeSuper(context, this, getMetaClass(), METHOD_NAME_INITIALIZE, new IRubyObject[]{args[0], options}, Block.NULL_BLOCK);
-
- String outfileSuffix = getOutfileSuffix();
- if (outfileSuffix != null) {
- this.callMethod(context, "outfilesuffix", getRuntime().newString(outfileSuffix));
- }
-
- return null;
- } catch (InstantiationException e) {
- // TODO: Do some proper logging in the catch clauses?
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- } catch (Throwable e) {
- throw new RuntimeException(e);
- }
- }
-
- private String getOutfileSuffix() {
- String outfileSuffix = this.delegate.getOutfileSuffix();
- if (outfileSuffix == null && delegate.getClass().getAnnotation(ConverterFor.class) != null) {
- ConverterFor converterAnnotation = delegate.getClass().getAnnotation(ConverterFor.class);
- if (converterAnnotation.suffix() != ConverterFor.UNDEFINED) {
- outfileSuffix = converterAnnotation.suffix();
- this.delegate.setOutfileSuffix(outfileSuffix);
- }
- }
- return outfileSuffix;
- }
-
- @JRubyMethod(required = 1, optional = 2)
- public IRubyObject convert(ThreadContext context, IRubyObject[] args) {
- ContentNode node = NodeConverter.createASTNode(args[0]);
-
- T ret = null;
- if (args.length == 1) {
- ret = delegate.convert(
- node,
- null,
- Collections.emptyMap());
- } else if (args.length == 2) {
- ret = delegate.convert(
- node,
- (String) JavaEmbedUtils.rubyToJava(getRuntime(), args[1], String.class),
- Collections.emptyMap());//RubyString.objAsString(context, args[1]).asJavaString());
- } else if (args.length == 3) {
- ret = (T) delegate.convert(
- node,
- (String) JavaEmbedUtils.rubyToJava(getRuntime(), args[1], String.class),
- (Map) JavaEmbedUtils.rubyToJava(getRuntime(), args[2], Map.class));
- }
- this.output = ret;
- return JavaEmbedUtils.javaToRuby(getRuntime(), ret);
- }
-
- @JRubyMethod
- public IRubyObject write(ThreadContext context, IRubyObject output, IRubyObject target) throws IOException {
- OutputStream out = null;
- if (target instanceof JavaProxy) {
- JavaProxy javaProxy = (JavaProxy) target;
- if (javaProxy.getObject() instanceof OutputStream) {
- out = (OutputStream) ((JavaProxy) target).getObject();
- } else {
- throw new IllegalArgumentException("Can't write to a " + javaProxy.getObject());
- }
- } else if (target instanceof RubyString) {
- File f = new File(((RubyString) target).asJavaString());
- out = new FileOutputStream(f);
- } else if (target instanceof RubyOutputStreamWrapper) {
- out = ((RubyOutputStreamWrapper)target).getOut();
- } else {
- throw new IllegalArgumentException("Can't write to a " + target);
- }
- if (out != null) {
- try {
- ((OutputFormatWriter<T>) delegate).write(this.output, out);
- } finally {
- out.close();
- }
- }
- return null;
- }
-
-
- private static void includeModule(RubyClass clazz, String moduleName, String... moduleNames) {
- RubyModule module = clazz.getRuntime().getModule(moduleName);
- if (moduleNames != null && moduleNames.length > 0) {
- for (String submoduleName: moduleNames) {
- module = module.defineOrGetModuleUnder(submoduleName);
- }
- }
- clazz.includeModule(module);
- }
-
- private static String getModuleName(Class<?> converterClass) {
- StringBuilder sb = new StringBuilder();
- for (String s: converterClass.getPackage().getName().split("\\.")) {
- sb
- .append(s.substring(0, 1).toUpperCase())
- .append(s.substring(1).toLowerCase());
- }
- return sb.toString();
- }
-
-
-}

DELETE
asciidoctorj-core/src/main/java/org/asciidoctor/extension/JRubyProcessor.java
-package org.asciidoctor.extension;
-
-import org.asciidoctor.Options;
-import org.asciidoctor.ast.*;
-import org.asciidoctor.log.LogRecord;
-import org.asciidoctor.jruby.ast.impl.*;
-import org.asciidoctor.jruby.internal.*;
-import org.jruby.*;
-import org.jruby.runtime.builtin.IRubyObject;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.asciidoctor.jruby.ast.impl.NodeConverter.NodeType.*;
-
-public class JRubyProcessor implements Processor {
-
- private JRubyAsciidoctor asciidoctor;
-
- public static final String CONTENT_MODEL_EMPTY =":empty";
-
- protected Map<String, Object> config;
-
- /**
- * The config map must not be reset once configFinalized is true.
- * With the Asciidoctor Ruby implementation this flag will be set to
- * true after the Ruby part of the extension is initialized.
- */
- private boolean configFinalized = false;
-
- public JRubyProcessor() {
- this(new HashMap<>());
- }
-
- public JRubyProcessor(Map<String, Object> config) {
- this.config = new HashMap<>(config);
- }
-
- @Override
- public Map<String, Object> getConfig() {
- return this.config;
- }
-
- @Override
- public final void setConfig(Map<String, Object> config) {
- if (configFinalized) {
- throw new IllegalStateException("It is only allowed to set the config in the constructor!");
- }
- this.config = config;
- }
-
- @Override
- public final void updateConfig(Map<String, Object> config) {
- this.config.putAll(config);
- }
-
- public final void setConfigFinalized() {
- this.configFinalized = true;
- }
-
- @Override
- public Table createTable(StructuralNode parent) {
- return createTable(parent, new HashMap<>());
- }
-
- @Override
- public Table createTable(StructuralNode parent, Map<String, Object> attributes) {
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- RubyHash rubyAttributes = RubyHash.newHash(rubyRuntime);
- rubyAttributes.putAll(attributes);
-
- IRubyObject[] parameters = {
- ((StructuralNodeImpl) parent).getRubyObject(),
- rubyAttributes};
- Table ret = (Table) NodeConverter.createASTNode(rubyRuntime, TABLE_CLASS, parameters);
- ret.setAttribute("rowcount", 0, false);
- return ret;
- }
-
- @Override
- public Row createTableRow(Table parent) {
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- RubyArray rubyRow = rubyRuntime.newArray();
- return new RowImpl(rubyRow);
- }
-
- @Override
- public Column createTableColumn(Table parent, int index, Map<String, Object> attributes) {
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- RubyHash rubyAttributes = RubyHash.newHash(rubyRuntime);
- rubyAttributes.putAll(attributes);
-
- IRubyObject[] parameters = {
- ((StructuralNodeImpl) parent).getRubyObject(),
- RubyFixnum.newFixnum(rubyRuntime, index),
- rubyAttributes}; // No cursor parameter yet
-
- return (Column) NodeConverter.createASTNode(rubyRuntime, TABLE_COLUMN_CLASS, parameters);
- }
-
- @Override
- public Cell createTableCell(Column column, Document innerDocument, Map<String, Object> attributes) {
- Cell cell = createTableCell(column, (String) null, attributes);
- cell.setStyle("asciidoc");
- cell.setInnerDocument(innerDocument);
- return cell;
- }
-
- @Override
- public Cell createTableCell(Column column, String text, Map<String, Object> attributes) {
- Ruby rubyRuntime = JRubyRuntimeContext.get(column);
-
- RubyHash rubyAttributes = RubyHash.newHash(rubyRuntime);
- rubyAttributes.putAll(attributes);
-
- IRubyObject[] parameters = {
- ((ColumnImpl) column).getRubyObject(),
- text != null ? rubyRuntime.newString(text) : rubyRuntime.getNil(),
- rubyAttributes}; // No cursor parameter yet
-
- return (Cell) NodeConverter.createASTNode(rubyRuntime, TABLE_CELL_CLASS, parameters);
- }
-
- @Override
- public Block createBlock(StructuralNode parent, String context, String content, Map<String, Object> attributes,
- Map<Object, Object> options) {
-
- options.put(Options.SOURCE, content);
- options.put(Options.ATTRIBUTES, attributes);
-
- return createBlock(parent, context, options);
- }
-
- @Override
- public Block createBlock(StructuralNode parent, String context, List<String> content, Map<String, Object> attributes,
- Map<Object, Object> options) {
-
- options.put(Options.SOURCE, content);
- options.put(Options.ATTRIBUTES, new HashMap<>(attributes));
- return createBlock(parent, context, options);
- }
-
- @Override
- public PhraseNode createPhraseNode(ContentNode parent, String context, List<String> text, Map<String, Object> attributes, Map<Object, Object> options) {
-
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- options.put(Options.ATTRIBUTES, attributes);
-
- RubyHash convertMapToRubyHashWithSymbols = RubyHashUtil.convertMapToRubyHashWithSymbolsIfNecessary(rubyRuntime,
- options);
-
- RubyArray rubyText = rubyRuntime.newArray();
- rubyText.addAll(text);
-
- IRubyObject[] parameters = {
- ((ContentNodeImpl) parent).getRubyObject(),
- RubyUtils.toSymbol(rubyRuntime, context),
- rubyText,
- convertMapToRubyHashWithSymbols};
- return (PhraseNode) NodeConverter.createASTNode(rubyRuntime, INLINE_CLASS, parameters);
- }
-
- @Override
- public PhraseNode createPhraseNode(ContentNode parent, String context, String text, Map<String, Object> attributes, Map<String, Object> options) {
-
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- options.put(Options.ATTRIBUTES, RubyHashUtil.convertMapToRubyHashWithStrings(rubyRuntime, attributes));
-
- RubyHash convertedOptions = RubyHashUtil.convertMapToRubyHashWithSymbols(rubyRuntime, options);
-
- IRubyObject[] parameters = {
- ((ContentNodeImpl) parent).getRubyObject(),
- RubyUtils.toSymbol(rubyRuntime, context),
- text == null ? rubyRuntime.getNil() : rubyRuntime.newString(text),
- convertedOptions};
- return (PhraseNode) NodeConverter.createASTNode(rubyRuntime, INLINE_CLASS, parameters);
- }
-
- @Override
- public Block createBlock(StructuralNode parent, String context,
- Map<Object, Object> options) {
-
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- RubyHash convertMapToRubyHashWithSymbols = RubyHashUtil.convertMapToRubyHashWithSymbolsIfNecessary(rubyRuntime,
- filterBlockOptions(parent, options, "subs", ContentModel.KEY));
-
- IRubyObject[] parameters = {
- ((StructuralNodeImpl) parent).getRubyObject(),
- RubyUtils.toSymbol(rubyRuntime, context),
- convertMapToRubyHashWithSymbols};
- return (Block) NodeConverter.createASTNode(rubyRuntime, BLOCK_CLASS, parameters);
- }
-
- private Map<Object, Object> filterBlockOptions(
- StructuralNode parent,
- Map<Object, Object> options,
- String... optionNames) {
- final Map<Object, Object> copy = new HashMap<>(options);
- final Ruby ruby = JRubyRuntimeContext.get(parent);
- for (String optionName : optionNames) {
- final Object optionValue = copy.get(optionName);
- if (optionValue != null) {
- if (optionValue instanceof String) {
- copy.put(optionName, getRubySymbol(ruby, (String) optionValue));
- } else if (optionValue instanceof List) {
- List valueList = (List) optionValue;
- List newValueList = new ArrayList(valueList.size());
- for (Object v : valueList) {
- if (v instanceof String) {
- newValueList.add(getRubySymbol(ruby, (String) v));
- } else {
- newValueList.add(v);
- }
- }
- copy.put(optionName, newValueList);
- }
- }
- }
- return copy;
- }
-
- private RubySymbol getRubySymbol(Ruby ruby, String s) {
- return ruby.newSymbol(s.startsWith(":") ? s.substring(1) : s);
- }
-
- @Override
- public Section createSection(StructuralNode parent, Integer level, boolean numbered, Map<Object, Object> options) {
-
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- RubyHash convertMapToRubyHashWithSymbols = RubyHashUtil.convertMapToRubyHashWithSymbolsIfNecessary(rubyRuntime,
- options);
-
- IRubyObject[] parameters = {
- ((StructuralNodeImpl) parent).getRubyObject(),
- level == null ? rubyRuntime.getNil() : rubyRuntime.newFixnum(level),
- rubyRuntime.newBoolean(numbered),
- convertMapToRubyHashWithSymbols};
- return (Section) NodeConverter.createASTNode(rubyRuntime, SECTION_CLASS, parameters);
- }
-
- /**
- * Creates an inner document for the given parent document.
- * Inner documents are used for tables cells with style {@code asciidoc}.
- *
- * @param parentDocument The parent document of the new document.
- * @return A new inner document.
- */
- @Override
- public Document createDocument(Document parentDocument) {
- Ruby runtime = JRubyRuntimeContext.get(parentDocument);
- RubyHash options = RubyHash.newHash(runtime);
- options.put(
- runtime.newSymbol("parent"),
- ((DocumentImpl) parentDocument).getRubyObject());
-
- return (Document) NodeConverter.createASTNode(runtime, DOCUMENT_CLASS, runtime.getNil(), options);
- }
-
- @Override
- public ListItem createListItem(final org.asciidoctor.ast.List parent, final String text) {
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- return (ListItem) NodeConverter.createASTNode(rubyRuntime, LIST_ITEM_CLASS, ListImpl.class.cast(parent).getRubyObject(), rubyRuntime.newString(text));
- }
-
- @Override
- public ListItem createListItem(final org.asciidoctor.ast.DescriptionList parent, final String text) {
- Ruby rubyRuntime = JRubyRuntimeContext.get(parent);
-
- return (ListItem) NodeConverter.createASTNode(rubyRuntime, LIST_ITEM_CLASS, DescriptionListImpl.class.cast(parent).getRubyObject(), rubyRuntime.newString(text));
- }
-
- /**
- * Parses the given raw asciidoctor content, parses it and appends it as children to the given parent block.
- * <p>The following example will add two paragraphs with the role {@code newcontent} to all top
- * level sections of a document:
- * <pre>
- * <verbatim>
- * Asciidoctor asciidoctor = ...
- * asciidoctor.javaExtensionRegistry().treeprocessor(new Treeprocessor() {
- * DocumentRuby process(DocumentRuby document) {
- * for (AbstractBlock block: document.getBlocks()) {
- * if (block instanceof Section) {
- * parseContent(block, Arrays.asList(new String[]{
- * "[newcontent]",
- * "This is new content"
- * "",
- * "[newcontent]",
- * "This is also new content"}));
- * }
- * }
- * }
- * });
- * </verbatim>
- * </pre>
- *
- * @param parent The block to which the parsed content should be added as children.
- * @param lines Raw asciidoctor content
- */
- @Override
- public void parseContent(StructuralNode parent, List<String> lines) {
- Ruby runtime = JRubyRuntimeContext.get(parent);
- Parser parser = new Parser(runtime, parent, ReaderImpl.createReader(runtime, lines));
-
- StructuralNode nextBlock = parser.nextBlock();
- while (nextBlock != null) {
- parent.append(nextBlock);
- nextBlock = parser.nextBlock();
- }
- }
-
- private class Parser extends RubyObjectWrapper {
-
- private final Reader reader;
- private final StructuralNode parent;
-
- public Parser(Ruby runtime, StructuralNode parent, Reader reader) {
- super(runtime.getModule("Asciidoctor").getClass("Parser"));
-
- this.reader = reader;
- this.parent = parent;
- }
-
- public StructuralNode nextBlock() {
- if (!reader.hasMoreLines()) {
- return null;
- }
- IRubyObject nextBlock = getRubyProperty("next_block", reader, ((StructuralNodeImpl) parent).getRubyObject());
- if (nextBlock.isNil()) {
- return null;
- } else {
- return (StructuralNode) NodeConverter.createASTNode(nextBlock);
- }
- }
- }
-
-
- @Override
- public Column createTableColumn(Table parent, int index) {
- return createTableColumn(parent, index, new HashMap<>());
- }
-
- @Override
- public Cell createTableCell(Column column, String text) {
- return createTableCell(column, text, new HashMap<>());
- }
-
- @Override
- public Cell createTableCell(Column column, Document innerDocument) {
- return createTableCell(column, innerDocument, new HashMap<>());
- }
-
- @Override
- public Block createBlock(StructuralNode parent, String context, String content) {
- return createBlock(parent, context, content, new HashMap<>(), new HashMap<>());
- }
-
- @Override
- public Block createBlock(StructuralNode parent, String context, String content, Map<String, Object> attributes) {
- return createBlock(parent, context, content, attributes, new HashMap<>());
- }
-
- @Override
- public Block createBlock(StructuralNode parent, String context, List<String> content) {
- return createBlock(parent, context, content, new HashMap<>(), new HashMap<>());
- }
-
- @Override
- public Block createBlock(StructuralNode parent, String context, List<String> content, Map<String, Object> attributes) {
- return createBlock(parent, context, content, attributes, new HashMap<>());
- }
-
- @Override
- public Section createSection(StructuralNode parent) {
- return createSection(parent, null, true, new HashMap<>());
- }
-
- @Override
- public Section createSection(StructuralNode parent, Map<Object, Object> options) {
- return createSection(parent, null, true, options);
- }
-
- @Override
- public Section createSection(StructuralNode parent, boolean numbered, Map<Object, Object> options) {
- return createSection(parent, null, numbered, options);
- }
-
- @Override
- public Section createSection(StructuralNode parent, int level, boolean numbered, Map<Object, Object> options) {
- return createSection(parent, Integer.valueOf(level), numbered, options);
- }
-
- @Override
- public PhraseNode createPhraseNode(ContentNode parent, String context, List<String> text) {
- return createPhraseNode(parent, context, text, new HashMap<>());
- }
-
- @Override
- public PhraseNode createPhraseNode(ContentNode parent, String context, List<String> text, Map<String, Object> attributes) {
- return createPhraseNode(parent, context, text, attributes, new HashMap<>());
- }
-
- @Override
- public PhraseNode createPhraseNode(ContentNode parent, String context, String text) {
- return createPhraseNode(parent, context, text, new HashMap<>());
- }
-
- @Override
- public PhraseNode createPhraseNode(ContentNode parent, String context, String text, Map<String, Object> attributes) {
- return createPhraseNode(parent, context, text, attributes, new HashMap<>());
- }
-
- public JRubyAsciidoctor getAsciidoctor() {
- return asciidoctor;
- }
-
- public void setAsciidoctor(JRubyAsciidoctor asciidoctor) {
- this.asciidoctor = asciidoctor;
- }
-
- @Override
- public <T> T unwrap(Class<T> clazz) {
- if (clazz.isAssignableFrom(JRubyProcessor.class)) {
- return clazz.cast(this);
- }
- if (clazz.isAssignableFrom(JRubyAsciidoctor.class)) {
- return clazz.cast(this.asciidoctor);
- }
- throw new IllegalArgumentException("Cannot unwrap to " + clazz);
- }
-
- @Override
- public void log(LogRecord logRecord) {
- unwrap(JRubyAsciidoctor.class).log(logRecord);
- }
-}

DELETE
asciidoctorj-core/src/main/java/org/asciidoctor/extension/PreprocessorReaderImpl.java
-package org.asciidoctor.extension;
-
-import org.asciidoctor.ast.Document;
-import org.asciidoctor.jruby.ast.impl.NodeConverter;
-import org.jruby.RubyHash;
-import org.jruby.runtime.builtin.IRubyObject;
-
-import java.util.Map;
-
-public class PreprocessorReaderImpl extends ReaderImpl implements PreprocessorReader {
-
- public PreprocessorReaderImpl(IRubyObject rubyNode) {
- super(rubyNode);
- }
-
- @Override
- public void push_include(String data, String file, String path, int lineNumber, Map<String, Object> attributes) {
-
- RubyHash attributeHash = RubyHash.newHash(getRuntime());
- attributeHash.putAll(attributes);
-
- getRubyProperty("push_include", data, file, path, lineNumber, attributes);
- }
-
- @Override
- @Deprecated
- public Document document() {
- return getDocument();
- }
-
- @Override
- public Document getDocument() {
- return (Document) NodeConverter.createASTNode(getRubyProperty("document"));
- }
-
-}

DELETE
asciidoctorj-core/src/main/java/org/asciidoctor/extension/ReaderImpl.java
-package org.asciidoctor.extension;
-
-import org.asciidoctor.jruby.internal.RubyObjectWrapper;
-import org.jruby.Ruby;
-import org.jruby.RubyArray;
-import org.jruby.RubyClass;
-import org.jruby.runtime.builtin.IRubyObject;
-
-import java.util.List;
-
-public class ReaderImpl extends RubyObjectWrapper implements Reader {
-
- public ReaderImpl(IRubyObject rubyNode) {
- super(rubyNode);
- }
-
- static ReaderImpl createReader(Ruby runtime, List<String> lines) {
- RubyArray rubyLines = runtime.newArray(lines.size());
- for (String line : lines) {
- rubyLines.add(runtime.newString(line));
- }
-
- RubyClass readerClass = runtime.getModule("Asciidoctor").getClass("Reader");
- return new ReaderImpl(readerClass.callMethod("new", rubyLines));
- }
-
- @Override
- @Deprecated
- public int getLineno() {
- return getLineNumber();
- }
-
- @Override
- public int getLineNumber() {
- return getInt("lineno");
- }
-
- public String getFile() {
- IRubyObject rObj = getRubyProperty("file");
- return rObj.toString();
- }
-
- public String getDir() {
- IRubyObject rObj = getRubyProperty("dir");
- return rObj.toString();
- }
-
- @Override
- public boolean hasMoreLines() {
- return getBoolean("has_more_lines?");
- }
-
- @Override
- public boolean isNextLineEmpty() {
- return getBoolean("next_line_empty?");
- }
-
- @Override
- public String read() {
- return getString("read");
- }
-
- @Override
- public List<String> readLines() {
- return getList("read_lines", String.class);
- }
-
- @Override
- public String readLine() {
- return getString("read_line");
- }
-
- @Override
- public List<String> lines() {
- return getList("lines", String.class);
- }
-
- @Override
- public void restoreLine(String line) {
- getRubyProperty("unshift_line", line);
- }
-
- @Override
- public void restoreLines(List<String> lines) {
- getRubyProperty("unshift_lines", lines);
- }
-
- @Override
- public String peekLine() {
- return getString("peek_line");
- }
-
- @Override
- public List<String> peekLines(int lineCount) {
- return getList("peek_lines", String.class, lineCount);
- }
-
- @Override
- public boolean advance() {
- return getBoolean("advance");
- }
-
- @Override
- public void terminate() {
- getRubyProperty("terminate");
- }
-
-}

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/AbstractProcessorProxy.java
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/AbstractProcessorProxy.java
@@ -3,6 +3,7 @@ package org.asciidoctor.jruby.extension.processorproxies;
import org.asciidoctor.ast.ContentModel;
import org.asciidoctor.extension.*;
import org.asciidoctor.jruby.ast.impl.ContentNodeImpl;
+import org.asciidoctor.jruby.extension.internal.JRubyProcessor;
import org.asciidoctor.jruby.internal.JRubyAsciidoctor;
import org.jruby.*;
import org.jruby.javasupport.JavaEmbedUtils;

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/BlockProcessorProxy.java
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/BlockProcessorProxy.java
@@ -2,8 +2,8 @@ package org.asciidoctor.jruby.extension.processorproxies;
import org.asciidoctor.ast.StructuralNode;
import org.asciidoctor.extension.BlockProcessor;
-import org.asciidoctor.extension.ReaderImpl;
import org.asciidoctor.jruby.ast.impl.NodeConverter;
+import org.asciidoctor.jruby.extension.internal.ReaderImpl;
import org.asciidoctor.jruby.internal.*;
import org.jruby.Ruby;
import org.jruby.RubyClass;

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/IncludeProcessorProxy.java
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/IncludeProcessorProxy.java
@@ -4,7 +4,7 @@ import org.asciidoctor.ast.Document;
import org.asciidoctor.jruby.ast.impl.NodeConverter;
import org.asciidoctor.extension.IncludeProcessor;
import org.asciidoctor.extension.PreprocessorReader;
-import org.asciidoctor.extension.PreprocessorReaderImpl;
+import org.asciidoctor.jruby.extension.internal.PreprocessorReaderImpl;
import org.asciidoctor.jruby.internal.*;
import org.jruby.Ruby;
import org.jruby.RubyClass;

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/PreprocessorProxy.java
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/extension/processorproxies/PreprocessorProxy.java
@@ -2,8 +2,8 @@ package org.asciidoctor.jruby.extension.processorproxies;
import org.asciidoctor.ast.Document;
import org.asciidoctor.extension.Preprocessor;
-import org.asciidoctor.extension.PreprocessorReaderImpl;
import org.asciidoctor.jruby.ast.impl.NodeConverter;
+import org.asciidoctor.jruby.extension.internal.PreprocessorReaderImpl;
import org.asciidoctor.jruby.internal.JRubyAsciidoctor;
import org.asciidoctor.jruby.internal.RubyHashMapDecorator;
import org.asciidoctor.jruby.internal.RubyHashUtil;

MODIFY
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/internal/ProcessorFactoryImpl.java
asciidoctorj-core/src/main/java/org/asciidoctor/jruby/internal/ProcessorFactoryImpl.java
package org.asciidoctor.jruby.internal;
-import org.asciidoctor.extension.JRubyProcessor;
import org.asciidoctor.extension.Processor;
+import org.asciidoctor.jruby.extension.internal.JRubyProcessor;
import org.asciidoctor.spi.ProcessorFactory;
public class ProcessorFactoryImpl implements ProcessorFactory {

Removed leftover files, adapter OSGi descriptors to new packaging structure