Include text from one apt to another apt

79 Views Asked by At

Imagine I have three apt files:

main.apt

Info, details, etc..

    some text

Configuration

    some text

child1.apt

Info, details, etc..

    some text

Configuration

    [Same text as MAIN.APT configuration]

child2.apt

Info, details, etc..

    some text

Configuration

    [Same text as MAIN.APT configuration]

I want to follow DRY(don't repeat yourself) principle and to reuse text from main.apt and to add it to child1.apt and to child2.apt. This would really help writing documentation.

I have tried using snippets (Firstly generated site documentation with id's and then added references to those id's):

~~START SNIPPET: id
~~END SNIPPET: id
%{snippet|id=id|url=http://svn.example.com/path/to/main.html}

And generated site using

     mvn site:stage

, but this is not working, because it inserts block of html text, which is not being formatted as html. I also tried verbatim parameter in snippets, it does not help.

Maybe someone has a solution for this problem and/or faced the same problem? Please tell me your story, suggestions. Solution would save my day :)

1

There are 1 best solutions below

0
On

Use Velocity. Rename child1.apt and child2.apt to child1.apt.vm and child2.apt.vm respectively. Then replace

[Same text as MAIN.APT configuration]

with

#parse("main.apt")

In site.xml include child pages like any other:

<item name="child 1" href="child1.html"/>