tests: add blank line after symbol name
[gtk-doc.git] / gtkdoc / mkhtml.py
blob80ddadfecd36c25173af27ddeefb477f57629b17
1 # -*- python; coding: utf-8 -*-
3 # gtk-doc - GTK DocBook documentation generator.
4 # Copyright (C) 1998 Owen Taylor
5 # 2001-2005 Damon Chaplin
6 # 2009-2017 Stefan Sauer
7 # 2017 Jussi Pakkanen
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 import os
25 import sys
26 import subprocess
27 import shutil
28 from glob import glob
30 from . import config
33 def run_xsltproc(options, args):
34 command = [config.xsltproc]
35 # we could do "$path_option $PWD " to avoid needing rewriting entities that
36 # are copied from the header into docs under xml
37 if os.environ.get("GTKDOC_PROFILE", '') == '':
38 for path in options.path:
39 command += ['--path', path]
40 return subprocess.call(command + args)
41 else:
42 command += ['--profile']
43 for path in options.path:
44 command += ['--path', path]
45 return subprocess.call(command + args, stderr=open('profile.txt', 'w'))
48 def run(options):
49 module = options.args[0]
50 document = options.args[1]
51 if options.verbose:
52 quiet = '0'
53 else:
54 quiet = '1'
55 remaining_args = options.args[2:]
57 if options.uninstalled:
58 # this does not work from buiddir!=srcdir
59 gtkdocdir = os.path.split(sys.argv[0])[0]
60 if not os.path.exists(gtkdocdir + '/gtk-doc.xsl'):
61 # try to src dir (set from makefiles) too
62 if os.path.exists(os.environ.get("ABS_TOP_SRCDIR", '') + '/gtk-doc.xsl'):
63 gtkdocdir = os.environ['ABS_TOP_SRCDIR']
64 styledir = gtkdocdir + '/style'
65 else:
66 gtkdocdir = os.path.join(config.datadir, 'gtk-doc/data')
67 styledir = gtkdocdir
69 res = run_xsltproc(options, [
70 '--nonet',
71 '--xinclude',
72 '--stringparam',
73 'gtkdoc.bookname',
74 module,
75 '--stringparam',
76 'gtkdoc.version',
77 config.version,
78 '--stringparam',
79 'chunk.quietly',
80 quiet,
81 '--stringparam',
82 'chunker.output.quiet',
83 quiet] + remaining_args + [gtkdocdir + '/gtk-doc.xsl', document])
85 # profiling
86 if os.environ.get("GTKDOC_PROFILE", '') != '':
87 subprocess.check_call('cat profile.txt | gprof2dot.py -e 0.01 -n 0.01 | dot -Tpng -o profile.png', shell=True)
89 # copy navigation images and stylesheets to html directory ...
90 for f in glob(styledir + '/*.png') + glob(styledir + '/*.css'):
91 shutil.copy(f, '.')
93 open('../html.stamp', 'w').write('timestamp')
94 return res