Login  Register

Block macro processor output

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Block macro processor output

asotobu
Hello, let me start to explain what I am trying to do. I want to transform an XML file into AsciiDoc format instead of adding as source code. Basically I would like to do next thing:

Given an xml like:

```xml
<bold>mytext</bold>
```

And next adoc file:

```adoc

= First Section

blabla

template::mytemplate.xml[]

```

render to an html which instead of having the xml embed as source code, had something like:

```html

<p class="paragraph">
  <strong>mytext</strong>
</p>

```

So my first idea was to create a BlockProcessor extension which basically do next:

```java
Map<String, Object> options = new HashMap<String, Object>() {{
            put("content_model", ":simple");
        }
        };
       
        return createBlock(parent, "paragraph", "*mytext*", attributes, options); <1>
```
<1> Note that the output is in AsciiDoc format

But the problem is that BlockMacroProcessor extension passes the paragraph directly to output, so instead of passing *mytext* I should send "mytext" in html. But this would be a problem because if the output is not an html, (for example a pdf) the extension would not work.

I have been thinking creating an IncludeProcessor extension:

```adoc
include::template://mytemplate.xml[]
```

So now I will be able to push data to reader and be able to send text in AsciiDoc format.

Do you think it would be useful to have an extension as a mix between include and block macro extension?

Alex.