org.asciidoctor.extension.BlockProcessor Java Examples
The following examples show how to use
org.asciidoctor.extension.BlockProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockProcessorProxy.java From asciidoctorj with Apache License 2.0 | 5 votes |
public static RubyClass register(final JRubyAsciidoctor asciidoctor, final Class<? extends BlockProcessor> blockProcessor) { RubyClass rubyClass = ProcessorProxyUtil.defineProcessorClass(asciidoctor.getRubyRuntime(), "BlockProcessor", new JRubyAsciidoctorObjectAllocator(asciidoctor) { @Override public IRubyObject allocate(Ruby runtime, RubyClass klazz) { return new BlockProcessorProxy(asciidoctor, klazz, blockProcessor); } }); applyAnnotations(blockProcessor, rubyClass); ProcessorProxyUtil.defineAnnotatedMethods(rubyClass, BlockProcessorProxy.class); return rubyClass; }
Example #2
Source File: BlockProcessorProxy.java From asciidoctorj with Apache License 2.0 | 5 votes |
public static RubyClass register(final JRubyAsciidoctor asciidoctor, final BlockProcessor blockProcessor) { RubyClass rubyClass = ProcessorProxyUtil.defineProcessorClass(asciidoctor.getRubyRuntime(), "BlockProcessor", new JRubyAsciidoctorObjectAllocator(asciidoctor) { @Override public IRubyObject allocate(Ruby runtime, RubyClass klazz) { return new BlockProcessorProxy(asciidoctor, klazz, blockProcessor); } }); applyAnnotations(blockProcessor.getClass(), rubyClass); ProcessorProxyUtil.defineAnnotatedMethods(rubyClass, BlockProcessorProxy.class); return rubyClass; }
Example #3
Source File: ExtensionGroupImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public ExtensionGroup block(final String blockName, final String blockProcessor) { try { Class<? extends BlockProcessor> blockProcessorClass = (Class<? extends BlockProcessor>) Class.forName(blockProcessor); return block(blockName, blockProcessorClass); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
Example #4
Source File: ExtensionGroupImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public ExtensionGroup block(final String blockProcessor) { try { Class<? extends BlockProcessor> blockProcessorClass = (Class<? extends BlockProcessor>) Class.forName(blockProcessor); return block(blockProcessorClass); } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
Example #5
Source File: ExtensionGroupImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public ExtensionGroup block(final String blockName, final Class<? extends BlockProcessor> blockProcessor) { final RubyClass rubyClass = BlockProcessorProxy.register(asciidoctor, blockProcessor); registrators.add(new Registrator() { @Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "block", new IRubyObject[]{rubyClass, rubyRuntime.newSymbol(blockName)}); } }); return this; }
Example #6
Source File: ExtensionGroupImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public ExtensionGroup block(final Class<? extends BlockProcessor> blockProcessor) { final RubyClass rubyClass = BlockProcessorProxy.register(asciidoctor, blockProcessor); registrators.add(new Registrator() { @Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "block", new IRubyObject[]{rubyClass, rubyRuntime.newSymbol(BlockProcessorProxy.getName(blockProcessor))}); } }); return this; }
Example #7
Source File: ExtensionGroupImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public ExtensionGroup block(final BlockProcessor blockProcessor) { final RubyClass rubyClass = BlockProcessorProxy.register(asciidoctor, blockProcessor); registrators.add(new Registrator() { @Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "block", new IRubyObject[]{rubyClass, rubyRuntime.newSymbol(blockProcessor.getName())}); } }); return this; }
Example #8
Source File: ExtensionGroupImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public ExtensionGroup block(final String blockName, final BlockProcessor blockProcessor) { final RubyClass rubyClass = BlockProcessorProxy.register(asciidoctor, blockProcessor); registrators.add(new Registrator() { @Override public void register(IRubyObject registry) { registry.callMethod(rubyRuntime.getCurrentContext(), "block", new IRubyObject[]{rubyClass, rubyRuntime.newSymbol(blockName)}); } }); return this; }
Example #9
Source File: JavaExtensionRegistryImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public JavaExtensionRegistry block(String blockName, String blockProcessor) { try { Class<? extends BlockProcessor> blockProcessorClass = (Class<? extends BlockProcessor>) Class.forName(blockProcessor); block(blockName, blockProcessorClass); return this; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
Example #10
Source File: JavaExtensionRegistryImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public JavaExtensionRegistry block(String blockProcessor) { try { Class<? extends BlockProcessor> blockProcessorClass = (Class<? extends BlockProcessor>) Class.forName(blockProcessor); block(blockProcessorClass); return this; } catch (ClassNotFoundException e) { throw new RuntimeException(e); } }
Example #11
Source File: JavaExtensionRegistryImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public JavaExtensionRegistry block(String blockName, Class<? extends BlockProcessor> blockProcessor) { RubyClass rubyClass = BlockProcessorProxy.register(asciidoctor, blockProcessor); getAsciidoctorModule().callMethod("block_processor", rubyClass, rubyRuntime.newString(blockName)); return this; }
Example #12
Source File: JavaExtensionRegistryImpl.java From asciidoctorj with Apache License 2.0 | 5 votes |
@Override public JavaExtensionRegistry block(String blockName, BlockProcessor blockProcessor) { RubyClass rubyClass = BlockProcessorProxy.register(asciidoctor, blockProcessor); getAsciidoctorModule().callMethod("block_processor", rubyClass, rubyRuntime.newString(blockName)); return this; }
Example #13
Source File: AsciidoctorJExtensionRegistry.java From asciidoctor-maven-plugin with Apache License 2.0 | 4 votes |
@Override @SuppressWarnings("unchecked") public void register(String extensionClassName, String blockName) throws MojoExecutionException { Class<? extends Processor> clazz; try { clazz = (Class<Processor>) Class.forName(extensionClassName); } catch (ClassCastException cce) { // Use RuntimeException to avoid catching, we only want the message in the Mojo throw new RuntimeException("'" + extensionClassName + "' is not a valid AsciidoctorJ processor class"); } catch (ClassNotFoundException e) { throw new RuntimeException("'" + extensionClassName + "' not found in classpath"); } // TODO: Replace with direct method calls again as soon as this project compiles against AsciidoctorJ 1.6.0 if (DocinfoProcessor.class.isAssignableFrom(clazz)) { register(javaExtensionRegistry, "docinfoProcessor", clazz); } else if (Preprocessor.class.isAssignableFrom(clazz)) { register(javaExtensionRegistry, "preprocessor", clazz); } else if (Postprocessor.class.isAssignableFrom(clazz)) { register(javaExtensionRegistry, "postprocessor", clazz); } else if (Treeprocessor.class.isAssignableFrom(clazz)) { register(javaExtensionRegistry, "treeprocessor", clazz); } else if (BlockProcessor.class.isAssignableFrom(clazz)) { if (blockName == null) { register(javaExtensionRegistry, "block", clazz); } else { register(javaExtensionRegistry, "block", blockName, clazz); } } else if (IncludeProcessor.class.isAssignableFrom(clazz)) { register(javaExtensionRegistry, "includeProcessor", clazz); } else if (BlockMacroProcessor.class.isAssignableFrom(clazz)) { if (blockName == null) { register(javaExtensionRegistry, "blockMacro", clazz); } else { register(javaExtensionRegistry, "blockMacro", blockName, clazz); } } else if (InlineMacroProcessor.class.isAssignableFrom(clazz)) { if (blockName == null) { register(javaExtensionRegistry, "inlineMacro", clazz); } else { register(javaExtensionRegistry, "inlineMacro", blockName, clazz); } } }
Example #14
Source File: BlockProcessorProxy.java From asciidoctorj with Apache License 2.0 | 4 votes |
public BlockProcessorProxy(JRubyAsciidoctor asciidoctor, RubyClass metaClass, Class<? extends BlockProcessor> blockProcessorClass) { super(asciidoctor, metaClass, blockProcessorClass); }
Example #15
Source File: JavaExtensionRegistryImpl.java From asciidoctorj with Apache License 2.0 | 4 votes |
@Override public JavaExtensionRegistry block(BlockProcessor blockProcessor) { RubyClass rubyClass = BlockProcessorProxy.register(asciidoctor, blockProcessor); getAsciidoctorModule().callMethod("block_processor", rubyClass); return this; }
Example #16
Source File: JavaExtensionRegistryImpl.java From asciidoctorj with Apache License 2.0 | 4 votes |
@Override public JavaExtensionRegistry block(Class<? extends BlockProcessor> blockProcessor) { String name = getName(blockProcessor); block(name, blockProcessor); return this; }
Example #17
Source File: BlockProcessorProxy.java From asciidoctorj with Apache License 2.0 | 4 votes |
public BlockProcessorProxy(JRubyAsciidoctor asciidoctor, RubyClass metaClass, BlockProcessor blockProcessor) { super(asciidoctor, metaClass, blockProcessor); }