Skip to main content

A simple `mkdocs` plugin which parsers a `pom.xml` file and exposes it's values as template environment variables

Project description

mkdocs-pom-parser-plugin

A simple mkdocs plugin which parsers a pom.xml file and exposes it's values as template environment variables. This is handy when the project which is being documented is using maven.

NOTE: Does not support multiple pom.xml files, but if you are interested - feel free to contribute.

Installation

pip install mkdocs-pom-parser-plugin

Usage

Add the plugin into your mkdocs.yml

plugins:
  - pom-parser-plugin:
      path: ../pom.xml (default, assumes this is a maven project )

By default, the plugin will export all of the commonly used tags as template environment variables:

pom.xml template variable
project.modelVersion POM_MODEL_VERSION
project.groupId POM_GROUP_ID
project.artifactId POM_ARTIFACT_ID
project.packaging POM_PACKAGING
project.version POM_VERSION
project.name POM_NAME
project.description POM_DESCRIPTION
project.url POM_URL

In your .md files you can reference these variables to generate a dependency installation section in your documentation:

    <dependency>
        <groupId>{{ POM_GROUP_ID }}</groupId>
        <artifactId>{{ POM_ARTIFACT_ID }}</artifactId>
        <version>{{ POM_VERSION }}</version>
    </dependency>

If you need a field which is missing from the list above - you can add it via the configuration:

plugins:
  - pom-parser-plugin:
      path: ../pom.xml
      additional:
        # template key: valid xpath filter
        # will become usable via {{ POM_SCM_CONNECTION }} in the template.
        SCM_CONNECTION: ./scm/connection

Development

  1. Run ./build.sh or
  2. docker-compose up and check localhost:8000

Install locally

1.pip install -e . && mkdocs build --config-file tests/resources/mkdocs.yml (still editable)

or

  1. pip install ./.tox/dist/mkdocs*.tar.gz && mkdocs build --config-file tests/resources/mkdocs.yml

Release

  1. ./create-release.sh to create a tag.
  2. Github Actions will do the rest.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-pom-parser-plugin-1.0.3.tar.gz (9.2 kB view details)

Uploaded Source

File details

Details for the file mkdocs-pom-parser-plugin-1.0.3.tar.gz.

File metadata

  • Download URL: mkdocs-pom-parser-plugin-1.0.3.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for mkdocs-pom-parser-plugin-1.0.3.tar.gz
Algorithm Hash digest
SHA256 b9e353c5c8b67c337df77ba511a0a0fccfc857a72a8d61fb69e80a12966b714b
MD5 90d71e6fc3429fd17d3708d3bec5f34e
BLAKE2b-256 efd8911bda507eafaae226365c49d604a231d093ae07b99477b4f8fd2025556f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page