# makedoc.py
# Summary: Create the documentation of ClammingPy, using ClammingPy library.
# Usage: python makedoc.py
#
# This file is part of ClammingPy tool.
# (C) 2023-2024 Brigitte Bigi, Laboratoire Parole et Langage,
# Aix-en-Provence, France.
#
# Use of this software is governed by the GNU Public License, version 3.
#
# ClammingPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ClammingPy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ClammingPy. If not, see <http://www.gnu.org/licenses/>.
#
# This banner notice must not be removed.
#
# ---------------------------------------------------------------------------
import os
from argparse import ArgumentParser
import clamming
import tests
from clamming import ClamsPack
from clamming import HTMLDocExport
WEXA = '../Whakerexa-0.3/wexa_statics'
PROGRAM = os.path.abspath(__file__)
# -------------------------------------------------
# Extract args from command-line
parser = ArgumentParser(usage="%s -w [path-to-whakerexa]" % os.path.basename(PROGRAM),
description="... a script to create ClammingPy documentation.")
parser.add_argument("-w",
metavar="file",
required=False,
default="",
help='Whakerexa relative path (default: {:s})'.format(WEXA))
args = parser.parse_args()
# -------------------------------------------------
# List of modules to be documented.
packages = list()
# Automatically create the documentation of all known classes of 'clamming'.
packages.append(ClamsPack(clamming))
# The attribute __all__ is missing in 'tests' package, then no documentation
# is to be generated for it!
packages.append(ClamsPack(tests))
# Options for HTML exportation
html_export = HTMLDocExport()
html_export.software = 'ClammingPy ' + clamming.__version__
html_export.url = 'https://clamming.sf.net'
html_export.copyright = clamming.__copyright__
html_export.title = 'ClammingPy doc'
# ... statics is the relative path to a folder with custom CSS, JS, etc.
html_export.statics = './statics'
# ... the theme corresponds to a statics/<theme>.css file or "light" or "dark"
html_export.theme = 'light'
# ... the favicon and icon are files in the statics folder
html_export.favicon = 'clamming32x32.ico'
html_export.icon = 'clamming.png'
# ... path to 'wexa_statics' folder, relatively to "docs"
html_export.wexa_statics = WEXA
if args.w:
html_export.wexa_statics = args.w
# -------------------------------------------------
# Export documentation into HTML files.
# One .html file = one documented class.
ClamsPack.html_export_packages(packages, "docs", html_export)
# -------------------------------------------------
# Export documentation into a Markdown file.
# One .md file = one documented module.
ClamsPack.markdown_export_packages(packages, "docs", html_export)