Maven Doxia

Add images to example-book

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.1.1
  • Fix Version/s: None
  • Component/s: Book
  • Labels:
    None
  • Number of attachments :
    0

Description

Images are an important feature of a technical manual or book, yet try as I might, I cannot get them to work with a Doxia book. Could someone please update the example-book to include at least one image, so that the rest of the world may benefit from knowing how to properly add images to a Doxia book?

It would be beneficial if the example could show how to add an image from a local file as well as from a URL.

Activity

Hide
Lukas Theussl added a comment -

This is not possible yet out of the box, see DOXIA-355. As a workaround you could use the antrun-plugin to copy any resources before the book is built, for instance:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>book</id>
            <phase>pre-site</phase>
            <configuration>
              <tasks>
                <copy todir="${project.build.directory}/generated-site/pdf/">
                  <fileset dir="${basedir}/src/books/resources/"/>
                </copy>
                <copy todir="${project.build.directory}/generated-site/rtf/">
                  <fileset dir="${basedir}/src/books/resources/"/>
                </copy>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

(this will only work if you build the book during the site phase)

Assuming that you have an images/ folder in /src/books/resources/, you can then include an image in an apt file like that:

[../images/architecture.png]
Show
Lukas Theussl added a comment - This is not possible yet out of the box, see DOXIA-355. As a workaround you could use the antrun-plugin to copy any resources before the book is built, for instance:
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>book</id>
            <phase>pre-site</phase>
            <configuration>
              <tasks>
                <copy todir="${project.build.directory}/generated-site/pdf/">
                  <fileset dir="${basedir}/src/books/resources/"/>
                </copy>
                <copy todir="${project.build.directory}/generated-site/rtf/">
                  <fileset dir="${basedir}/src/books/resources/"/>
                </copy>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
(this will only work if you build the book during the site phase) Assuming that you have an images/ folder in /src/books/resources/, you can then include an image in an apt file like that:
[../images/architecture.png]

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: