sphinx-maven-plugin icon indicating copy to clipboard operation
sphinx-maven-plugin copied to clipboard

property substitution in doc files

Open spyhunter99 opened this issue 6 years ago • 2 comments

with the normal maven site plugin, i can add a .vm extension to my markdown files and whatnot, which enables property substitution within the docs, such as ${project.version}. is this possible with this plugin?

spyhunter99 avatar Sep 21 '19 12:09 spyhunter99

Hi. That sounds like a feature we could implement as a plugin option. As a workaround, you could load the pom.xml in your conf.py and register some substitutions there.

trustin avatar Sep 26 '19 07:09 trustin

Sample conf.py

# -*- coding: utf-8 -*-
import sys, os

sys.path.append('/home/are/.local/lib/python3.9/site-packages')
import sphinx_redactor_theme, rtcat_sphinx_theme

#
# parsing maven pom.xml
from xml.etree import ElementTree as et

namespaces = {'xmlns' : 'http://maven.apache.org/POM/4.0.0'}

tree = et.parse('../../../pom.xml')
root = tree.getroot()

projectName = root.find("xmlns:name", namespaces=namespaces).text
versionName = root.find("xmlns:version", namespaces=namespaces).text
developerName = root.find("xmlns:developers/xmlns:developer[1]/xmlns:name", namespaces=namespaces).text

#deps = root.findall("xmlns:dependency[xmlns:artifactId='jsqlparser']", namespaces=namespaces)
#print(deps)

#for d in deps:
#   artifactId = d.find("xmlns:artifactId", namespaces=namespaces)
#   version1   = d.find("xmlns:version", namespaces=namespaces)
#   print(artifactId.text + '\t' + version1.text)

####################################

project = projectName
copyright = u'2020, ' + developerName
release = versionName

# General options
needs_sphinx = '1.0'
master_doc = 'index'
pygments_style = 'tango'
add_function_parentheses = True

extensions = ['recommonmark', 'sphinx.ext.autodoc', 'sphinxcontrib.plantuml']

templates_path = ['_templates']
exclude_trees = ['.build']
source_encoding = 'utf-8-sig'

# HTML options

#html_theme = 'sphinx_redactor_theme'
#html_theme_path = [sphinx_redactor_theme.get_html_theme_path()]

html_theme = "rtcat_sphinx_theme"
html_theme_path = [rtcat_sphinx_theme.get_html_theme_path()]

html_short_title = "my-project"
htmlhelp_basename = 'my-project-doc'
html_use_index = True
html_show_sourcelink = False
html_static_path = ['_static']
html_logo = '_static/manticore_logo.png'

# PlantUML options
plantuml = os.getenv('plantuml')

manticore-projects avatar Apr 21 '21 02:04 manticore-projects