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

property substitution in doc files #17

Open
spyhunter99 opened this issue Sep 21, 2019 · 2 comments
Open

property substitution in doc files #17

spyhunter99 opened this issue Sep 21, 2019 · 2 comments

Comments

@spyhunter99
Copy link

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 spyhunter99 changed the title property subsitituion in doc files property substitution in doc files Sep 21, 2019
@trustin
Copy link
Owner

trustin commented Sep 26, 2019

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.

@manticore-projects
Copy link

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants