From 410e418aea16cc1c07249a9a64d3defcb8990866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 13 Dec 2015 00:01:04 +0100 Subject: [PATCH] Add a Makefile to generate classes doc in various formats All the generated documentation is put in doc/_build. --- .gitignore | 5 ++--- doc/Doxyfile | 2 +- doc/Makefile | 47 ++++++++++++++++++++++++++++++++++++++++++ doc/make_doc.sh | 16 -------------- doc/tools/doc_merge.py | 3 +++ doc/tools/makedocs.py | 2 +- doc/tools/makedoku.py | 5 ++++- doc/tools/makehtml.py | 5 ++++- doc/tools/makemd.py | 3 ++- 9 files changed, 64 insertions(+), 24 deletions(-) create mode 100644 doc/Makefile delete mode 100644 doc/make_doc.sh diff --git a/.gitignore b/.gitignore index fc8f413717..a6d5a2d412 100644 --- a/.gitignore +++ b/.gitignore @@ -24,9 +24,8 @@ tools/editor/editor_icons.cpp make.bat log.txt -# Documentation generated by doxygen or scripts -doc/doxygen/ -doc/html/ +# Documentation generated by doxygen or from classes.xml +doc/_build/ # Javascript specific *.bc diff --git a/doc/Doxyfile b/doc/Doxyfile index bc0d6d3925..c1904f17c9 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -58,7 +58,7 @@ PROJECT_LOGO = ../logo.png # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ./doxygen/ +OUTPUT_DIRECTORY = ./_build/doxygen/ # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000000..286a5162af --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,47 @@ +BASEDIR = $(CURDIR) +CLASSES = $(BASEDIR)/base/classes.xml +OUTPUTDIR = $(BASEDIR)/_build +TOOLSDIR = $(BASEDIR)/tools + +.ONESHELL: + +clean: + rm -rf $(OUTPUTDIR) + +doku: + rm -rf $(OUTPUTDIR)/doku + mkdir -p $(OUTPUTDIR)/doku + pushd $(OUTPUTDIR)/doku + python2 $(TOOLSDIR)/makedoku.py $(CLASSES) + popd + +doxygen: + rm -rf $(OUTPUTDIR)/doxygen + mkdir -p $(OUTPUTDIR)/doxygen + doxygen Doxyfile + +html: + rm -rf $(OUTPUTDIR)/html + mkdir -p $(OUTPUTDIR)/html + pushd $(OUTPUTDIR)/html + python2 $(TOOLSDIR)/makehtml.py -multipage $(CLASSES) + popd + +markdown: + rm -rf $(OUTPUTDIR)/markdown + mkdir -p $(OUTPUTDIR)/markdown + pushd $(OUTPUTDIR)/markdown + python2 $(TOOLSDIR)/makemd.py $(CLASSES) + popd + +rst: + rm -rf $(OUTPUTDIR)/rst + mkdir -p $(OUTPUTDIR)/rst + pushd $(OUTPUTDIR)/rst + echo "TODO" + popd + +textile: + rm -rf $(OUTPUTDIR)/textile + mkdir -p $(OUTPUTDIR)/textile + python3 $(TOOLSDIR)/makedocs.py --input $(CLASSES) --output $(OUTPUTDIR)/textile diff --git a/doc/make_doc.sh b/doc/make_doc.sh deleted file mode 100644 index 5d0c1a9c2f..0000000000 --- a/doc/make_doc.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/bash -here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -godotHome=$(dirname "$here") -docTarget=${here}/html/class_list - -throw() { - echo "$@" >&2 - exit 1 -} - -[ -d "$docTarget" ] || mkdir -p "$docTarget" || throw "Could not create doc target $docTarget" - -cd "$docTarget" -python ${here}/makehtml.py -multipage ${here}/base/classes.xml -cd "$here" - diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py index 872f38ed87..6cc7019324 100644 --- a/doc/tools/doc_merge.py +++ b/doc/tools/doc_merge.py @@ -1,3 +1,6 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + import sys import xml.etree.ElementTree as ET diff --git a/doc/tools/makedocs.py b/doc/tools/makedocs.py index be57891abc..db9f04b091 100644 --- a/doc/tools/makedocs.py +++ b/doc/tools/makedocs.py @@ -24,7 +24,7 @@ # TODO: # * Refactor code. # * Adapt this script for generating content in other markup formats like -# DokuWiki, Markdown, etc. +# reStructuredText, Markdown, DokuWiki, etc. # # Also check other TODO entries in this script for more information on what is # left to do. diff --git a/doc/tools/makedoku.py b/doc/tools/makedoku.py index e8207715fe..1ab16841b1 100644 --- a/doc/tools/makedoku.py +++ b/doc/tools/makedoku.py @@ -1,3 +1,6 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + import sys import xml.etree.ElementTree as ET @@ -8,7 +11,7 @@ for arg in sys.argv[1:]: input_list.append(arg) if len(input_list) < 1: - print("usage: makedoku.py ") + print("usage: makedoku.py ") sys.exit(0) diff --git a/doc/tools/makehtml.py b/doc/tools/makehtml.py index 9b9c62f33b..34db47e424 100644 --- a/doc/tools/makehtml.py +++ b/doc/tools/makehtml.py @@ -1,3 +1,6 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- + import sys import xml.etree.ElementTree as ET from xml.sax.saxutils import escape, unescape @@ -29,7 +32,7 @@ for arg in sys.argv[1:]: input_list.append(arg) if len(input_list) < 1: - print("usage: makehtml.py ") + print("usage: makehtml.py ") sys.exit(0) diff --git a/doc/tools/makemd.py b/doc/tools/makemd.py index f85d145d5e..e012287b0e 100644 --- a/doc/tools/makemd.py +++ b/doc/tools/makemd.py @@ -1,5 +1,6 @@ #!/usr/bin/python # -*- coding: utf-8 -*- + import sys import xml.etree.ElementTree as ET @@ -9,7 +10,7 @@ for arg in sys.argv[1:]: input_list.append(arg) if len(input_list) < 1: - print 'usage: makedoku.py ' + print 'usage: makemd.py ' sys.exit(0)