Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow templates directory to be specified for Maven Site plugin #179

Closed
mojavelinux opened this issue Nov 28, 2015 · 11 comments
Closed

Allow templates directory to be specified for Maven Site plugin #179

mojavelinux opened this issue Nov 28, 2015 · 11 comments
Assignees
Milestone

Comments

@mojavelinux
Copy link
Member

Allow the templates directory to be specified in the configuration of the Maven Site plugin.

ORIGINAL DESCRIPTION: Select a standard directory where Asciidoctor templates are stored and enable the templates option when calling the convert method if this directory exists and contains files. This avoids the need to have to define the templates directory explicitly and allows templates to be used with the Maven Site plugin.

@mojavelinux
Copy link
Member Author

I propose the following two locations:

  • src/docs/asciidoc/_templates
  • src/site/asciidoc/_templates

I'm open to other ideas.

@mojavelinux mojavelinux added this to the 1.5.3 milestone Nov 28, 2015
@LightGuard
Copy link
Member

Is there a standard config directory for maven projects?

On Friday, November 27, 2015, Dan Allen notifications@github.com wrote:

I propose the following two locations:

  • src/docs/asciidoc/_templates
  • src/site/asciidoc/_templates

I'm open to other ideas.


Reply to this email directly or view it on GitHub
#179 (comment)
.

Sent from Gmail Mobile

@AlexanderZobkov
Copy link

I would propose to store Asciidoc templates in the following directories:

  • ${basedir}/src/main/asciidoc/templates
  • ${basedir}/src/site/asciidoc/templates

IMHO the "underscore" symbol looks extraneously for maven world, typical maven projects and typical directories layouts used by developers.
Regarding "src/docs", this is not in alligment with default directory for "sourceDirectory" configuration option:

  • defaults to ${basedir}/src/main/asciidoc

@LightGuard
Copy link
Member

src/main/asciidoc makes more sense for templates or extensions.

On Saturday, November 28, 2015, Alexander notifications@github.com wrote:

I would propose to store Asciidoc templates in the following directories:

  • ${basedir}/src/main/asciidoc/templates
  • ${basedir}/src/site/asciidoc/templates

IMHO the "underscore" symbol looks extraneously for maven world, typical
maven projects and typical directories layouts used by developers.
Regarding "src/docs", this is not in alligment with default directory for
"sourceDirectory" configuration option:

  • defaults to ${basedir}/src/main/asciidoc


Reply to this email directly or view it on GitHub
#179 (comment)
.

Sent from Gmail Mobile

@mojavelinux
Copy link
Member Author

defaults to ${basedir}/src/main/asciidoc

You are correct, that is our current default. I would like to establish a new convention (like the Gradle plugin has done) of src/docs/asciidoc, but that's a separate discussion.

IMHO the "underscore" symbol looks extraneously for maven world

True. I had suggested it because the plugin will ignore directories that start with an underscore, but the templates directory shouldn't have any AsciiDoc files in it, so I guess the underscore isn't necessary anyway.

@mdlinville
Copy link

I don't know which is more correct, src/main/site or src/site. I am moving my project to use src/site, because everything besides the site and docs is in a Maven submodule anyway. The Asciidoctor site does not seem to work now when the docs are in src/main/site/asciidoc but it does seem to work when the docs are in src/site/asciidoc. So maybe that should be taken into account.

@mojavelinux
Copy link
Member Author

@mstanleyjones That's correct, the convention for Maven Sites is src/site. I can't remember if there's a way to change that, but given it's such a strong convention, it's probably safe to follow it.

@mojavelinux
Copy link
Member Author

Let's just use:

  • ${basedir}/src/site/asciidoc/templates

I suppose we could do something more fancy like:

  • ${basedir}/src/main/resources/META-INF/asciidoc/templates

to align with the Maven Site skins, but that just feels excessive.

On a side note, the Maven Site plugin has a configuration block (as do all plugins). There has to be a way to look this up from the Parser class. Does anyone know of a resource that explains how to use DI in the plexus container?

mojavelinux added a commit to mojavelinux/asciidoctor-maven-plugin that referenced this issue Dec 14, 2015
…or#168 & asciidoctor#160 enable configuratino for site parser

- rewrite Maven Site parser to make more organized and extensible
- pass AsciiDoc configuration in Maven Site plugin to Asciidoctor API
- enhance Maven Site integration test
  - add custom template
  - add include
  - add source highlighting
  - make validation code compatible with Java 6
- enable integration tests on Travis
- remove unused legacy site module
mojavelinux added a commit to mojavelinux/asciidoctor-maven-plugin that referenced this issue Dec 14, 2015
…or#168 & asciidoctor#160 enable configuration for site parser

- rewrite Maven Site parser to make more organized and extensible
- pass AsciiDoc configuration in Maven Site plugin to Asciidoctor API
- enhance Maven Site integration test
  - add custom template
  - add include
  - add source highlighting
  - make validation code compatible with Java 6
- enable integration tests on Travis
- remove unused legacy site module
mojavelinux added a commit to mojavelinux/asciidoctor-maven-plugin that referenced this issue Dec 14, 2015
…or#168 & asciidoctor#160 enable configuration for site parser

- rewrite AsciidoctorParser (used by Maven Site Plugin) to make it more organized and extensible
- pass AsciiDoc configuration defined in Maven Site plugin to the Asciidoctor API
- enhance Maven Site integration test
  - add custom template
  - add include
  - add source highlighting
  - make validation code compatible with Java 6
- enable integration tests on Travis CI
- remove unused legacy site module
- fix license headers
- minor cleanups
mojavelinux added a commit to mojavelinux/asciidoctor-maven-plugin that referenced this issue Dec 14, 2015
…or#168 & asciidoctor#160 enable configuration for site parser

- rewrite AsciidoctorParser (used by Maven Site Plugin) to make it more organized and extensible
- pass AsciiDoc configuration defined in Maven Site plugin to the Asciidoctor API
- enhance Maven Site integration test
  - add custom template
  - add include
  - add source highlighting
  - make validation code compatible with Java 6
- enable integration tests on Travis CI
- remove unused legacy site module
- fix license headers
- minor cleanups
@mojavelinux
Copy link
Member Author

Since I figured out how to read the site plugin's configuration and pass that information to Asciidoctor, I've decided to abandon the original idea (for now) and require the path to be specified using the templateDir option.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.3</version> <!-- 3.4 works here too -->
    <configuration>
        <asciidoc>
            <templateDir>src/site/asciidoc/templates</templateDir>
        </asciidoc>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctor-maven-plugin</artifactId>
            <version>1.5.3</version>
        </dependency>
    </dependencies>
</plugin>

If the path specified in the templateDir option is not absolute, it will be resolved relative to the project basedir.

@mojavelinux
Copy link
Member Author

I think what I might do is just defer this issue to 1.5.4 since it is still a good idea...it just isn't a blocker anymore.

@mojavelinux mojavelinux modified the milestones: 1.5.4, 1.5.3 Dec 14, 2015
@mojavelinux mojavelinux changed the title Auto-detect templates and enable templates option Auto-detect templates in Maven Site and enable templates option Dec 14, 2015
@mojavelinux mojavelinux modified the milestones: 1.5.3, 1.5.4 Dec 14, 2015
@mojavelinux mojavelinux self-assigned this Dec 14, 2015
@mojavelinux mojavelinux changed the title Auto-detect templates in Maven Site and enable templates option Allow templates to be specified in Maven Site plugin Dec 14, 2015
@mojavelinux mojavelinux changed the title Allow templates to be specified in Maven Site plugin Allow templates directory to be specified for the Maven Site plugin Dec 14, 2015
@mojavelinux mojavelinux changed the title Allow templates directory to be specified for the Maven Site plugin Allow templates directory to be specified for Maven Site plugin Dec 14, 2015
@mojavelinux
Copy link
Member Author

The more I think about it, the more it just feels like too much magic. I think it's worth being explicit, now that we can do it.

mojavelinux added a commit to mojavelinux/asciidoctor-maven-plugin that referenced this issue Dec 14, 2015
…or#168 & asciidoctor#160 enable configuration for site parser

- rewrite AsciidoctorParser (used by Maven Site Plugin) to make it more organized and extensible
- specify baseDir by default when invoking Asciidoctor API
- pass AsciiDoc configuration defined in Maven Site plugin to the Asciidoctor API
  - API options (e.g., templateDir)
  - Ruby options (e.g., requires)
  - AsciiDoc attributes (e.g., icons=font)
- enhance Maven Site integration test
  - add custom template
  - add include
  - add source highlighting
  - make validation code compatible with Java 6
- enable integration tests on Travis CI
- remove unused legacy site module
- fix license headers
- minor cleanups
mojavelinux added a commit to mojavelinux/asciidoctor-maven-plugin that referenced this issue Dec 14, 2015
…or#168 & asciidoctor#160 enable configuration for site parser

- rewrite AsciidoctorParser (used by Maven Site Plugin) to make it more organized and extensible
- specify baseDir by default when invoking Asciidoctor API
- pass AsciiDoc configuration defined in Maven Site plugin to the Asciidoctor API
  - API options (e.g., templateDir)
  - Ruby options (e.g., requires)
  - AsciiDoc attributes (e.g., icons=font)
- enhance Maven Site integration test
  - add custom template
  - add include
  - add source highlighting
  - make validation code compatible with Java 6
- enable integration tests on Travis CI and Appveyor
- remove unused legacy site module
- fix license headers
- minor cleanups
mojavelinux added a commit to mojavelinux/asciidoctor-maven-plugin that referenced this issue Dec 14, 2015
…or#168 & asciidoctor#160 enable configuration for site parser

- rewrite AsciidoctorParser (used by Maven Site Plugin) to make it more organized and extensible
- specify baseDir by default when invoking Asciidoctor API
- pass AsciiDoc configuration defined in Maven Site plugin to the Asciidoctor API
  - API options (e.g., templateDir)
  - Ruby options (e.g., requires)
  - AsciiDoc attributes (e.g., icons=font)
- enhance Maven Site integration test
  - add custom template
  - add include
  - add source highlighting
  - make validation code compatible with Java 6
- enable integration tests on Travis CI and Appveyor
- remove unused legacy site module
- fix license headers
- minor cleanups
mojavelinux added a commit that referenced this issue Dec 15, 2015
resolves #170, #180, #179, #168 & #160 enable configuration for site parser
abelsromero pushed a commit to abelsromero/asciidoctor-maven-plugin that referenced this issue Jan 8, 2016
…or#168 & asciidoctor#160 enable configuration for site parser

- rewrite AsciidoctorParser (used by Maven Site Plugin) to make it more organized and extensible
- specify baseDir by default when invoking Asciidoctor API
- pass AsciiDoc configuration defined in Maven Site plugin to the Asciidoctor API
  - API options (e.g., templateDir)
  - Ruby options (e.g., requires)
  - AsciiDoc attributes (e.g., icons=font)
- enhance Maven Site integration test
  - add custom template
  - add include
  - add source highlighting
  - make validation code compatible with Java 6
- enable integration tests on Travis CI and Appveyor
- remove unused legacy site module
- fix license headers
- minor cleanups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants