Salome HOME
Copyright update 2022
[tools/yacsgen.git] / module_generator / doc_tmpl.py
1 # Copyright (C) 2009-2022  EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 try:
21   from string import Template
22 except:
23   from module_generator.compat import Template,set
24
25 # CMakeLists.txt in doc directory
26 # template parameters:
27 #   module : module name
28 #   files : doc source files (.rst)
29 docmakefile="""
30 SET(RSTFILES
31   ${files}
32   )
33
34 SET(SPHINXOPTS )
35 SET(SOURCEDIR $${CMAKE_CURRENT_SOURCE_DIR})
36 SET(PAPEROPT_a4 -D latex_paper_size=a4)
37 SET(ALLSPHINXOPTS -d doctrees $${PAPEROPT_a4} $${SPHINXOPTS} $${SOURCEDIR})
38
39 # install user's documentation
40 SALOME_CONFIGURE_FILE(conf.py conf.py)
41
42 ADD_CUSTOM_TARGET(htm 
43   COMMAND $${CMAKE_COMMAND} -E make_directory html 
44   COMMAND $${CMAKE_COMMAND} -E make_directory doctrees
45   COMMAND $${SPHINX_EXECUTABLE} -c $${CMAKE_BINARY_DIR}/doc -b html $${ALLSPHINXOPTS} html
46   DEPENDS $${RSTFILES}
47   WORKING_DIRECTORY $${CMAKE_CURRENT_BINARY_DIR}
48   )
49 INSTALL(CODE "EXECUTE_PROCESS(COMMAND \\\"$${CMAKE_COMMAND}\\\" --build $${PROJECT_BINARY_DIR} --target htm)")
50 INSTALL(DIRECTORY $${CMAKE_CURRENT_BINARY_DIR}/html/ 
51   DESTINATION $${SALOME_INSTALL_DOC}/gui/${module} 
52   USE_SOURCE_PERMISSIONS
53   PATTERN ".buildinfo" EXCLUDE
54   )
55   
56 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES html)
57 SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES doctrees)
58
59 #SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES YACS)
60
61 """
62 docmakefile=Template(docmakefile)
63
64 docconf="""# -*- coding: utf-8 -*-
65 #
66 # ${module} documentation build configuration file, created by
67 # sphinx-quickstart on Sun Sep 19 16:20:14 2010.
68 #
69 # This file is execfile()d with the current directory set to its containing dir.
70 #
71 # Note that not all possible configuration values are present in this
72 # autogenerated file.
73 #
74 # All configuration values have a default; values that are commented out
75 # serve to show the default.
76
77 import sys, os
78
79 # If extensions (or modules to document with autodoc) are in another directory,
80 # add these directories to sys.path here. If the directory is relative to the
81 # documentation root, use os.path.abspath to make it absolute, like shown here.
82 #sys.path.insert(0, os.path.abspath('.'))
83
84 # -- General configuration -----------------------------------------------------
85
86 # If your documentation needs a minimal Sphinx version, state it here.
87 #needs_sphinx = '1.0'
88
89 # Add any Sphinx extension module names here, as strings. They can be extensions
90 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
91 extensions = []
92
93 # Add any paths that contain templates here, relative to this directory.
94 templates_path = ['_templates']
95
96 # The suffix of source filenames.
97 source_suffix = '.rst'
98
99 # The encoding of source files.
100 #source_encoding = 'utf-8-sig'
101
102 # The master toctree document.
103 master_doc = 'index'
104
105 # General information about the project.
106 project = u'${module}'
107 copyright = u'2010-2022'
108
109 # The version info for the project you're documenting, acts as replacement for
110 # |version| and |release|, also used in various other places throughout the
111 # built documents.
112 #
113 # The short X.Y version.
114 version = '1'
115 # The full version, including alpha/beta/rc tags.
116 release = '1'
117
118 # The language for content autogenerated by Sphinx. Refer to documentation
119 # for a list of supported languages.
120 #language = None
121
122 # There are two options for replacing |today|: either, you set today to some
123 # non-false value, then it is used:
124 #today = ''
125 # Else, today_fmt is used as the format for a strftime call.
126 #today_fmt = '%B %d, %Y'
127
128 # List of patterns, relative to source directory, that match files and
129 # directories to ignore when looking for source files.
130 exclude_patterns = ['_build']
131
132 # The reST default role (used for this markup: `text`) to use for all documents.
133 #default_role = None
134
135 # If true, '()' will be appended to :func: etc. cross-reference text.
136 #add_function_parentheses = True
137
138 # If true, the current module name will be prepended to all description
139 # unit titles (such as .. function::).
140 #add_module_names = True
141
142 # If true, sectionauthor and moduleauthor directives will be shown in the
143 # output. They are ignored by default.
144 #show_authors = False
145
146 # The name of the Pygments (syntax highlighting) style to use.
147 pygments_style = 'sphinx'
148
149 # A list of ignored prefixes for module index sorting.
150 #modindex_common_prefix = []
151
152
153 # -- Options for HTML output ---------------------------------------------------
154
155 # The theme to use for HTML and HTML Help pages.  See the documentation for
156 # a list of builtin themes.
157 html_theme = 'default'
158
159 # Theme options are theme-specific and customize the look and feel of a theme
160 # further.  For a list of options available for each theme, see the
161 # documentation.
162 #html_theme_options = {}
163
164 # Add any paths that contain custom themes here, relative to this directory.
165 #html_theme_path = []
166
167 # The name for this set of Sphinx documents.  If None, it defaults to
168 # "<project> v<release> documentation".
169 #html_title = None
170
171 # A shorter title for the navigation bar.  Default is the same as html_title.
172 #html_short_title = None
173
174 # The name of an image file (relative to this directory) to place at the top
175 # of the sidebar.
176 #html_logo = None
177
178 # The name of an image file (within the static path) to use as favicon of the
179 # docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
180 # pixels large.
181 #html_favicon = None
182
183 # Add any paths that contain custom static files (such as style sheets) here,
184 # relative to this directory. They are copied after the builtin static files,
185 # so a file named "default.css" will overwrite the builtin "default.css".
186 html_static_path = ['_static']
187
188 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
189 # using the given strftime format.
190 #html_last_updated_fmt = '%b %d, %Y'
191
192 # If true, SmartyPants will be used to convert quotes and dashes to
193 # typographically correct entities.
194 #html_use_smartypants = True
195
196 # Custom sidebar templates, maps document names to template names.
197 #html_sidebars = {}
198
199 # Additional templates that should be rendered to pages, maps page names to
200 # template names.
201 #html_additional_pages = {}
202
203 # If false, no module index is generated.
204 #html_domain_indices = True
205
206 # If false, no index is generated.
207 #html_use_index = True
208
209 # If true, the index is split into individual pages for each letter.
210 #html_split_index = False
211
212 # If true, links to the reST sources are added to the pages.
213 #html_show_sourcelink = True
214
215 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
216 #html_show_sphinx = True
217
218 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
219 #html_show_copyright = True
220
221 # If true, an OpenSearch description file will be output, and all pages will
222 # contain a <link> tag referring to it.  The value of this option must be the
223 # base URL from which the finished HTML is served.
224 #html_use_opensearch = ''
225
226 # This is the file name suffix for HTML files (e.g. ".xhtml").
227 #html_file_suffix = None
228
229 # Output file base name for HTML help builder.
230 htmlhelp_basename = '${module}doc'
231
232
233 # -- Options for LaTeX output --------------------------------------------------
234
235 # The paper size ('letter' or 'a4').
236 #latex_paper_size = 'letter'
237
238 # The font size ('10pt', '11pt' or '12pt').
239 #latex_font_size = '10pt'
240
241 # Grouping the document tree into LaTeX files. List of tuples
242 # (source start file, target name, title, author, documentclass [howto/manual]).
243 latex_documents = [
244   ('index', '${module}.tex', u'${module} Documentation',
245    u'cc', 'manual'),
246 ]
247
248 # The name of an image file (relative to this directory) to place at the top of
249 # the title page.
250 #latex_logo = None
251
252 # For "manual" documents, if this is true, then toplevel headings are parts,
253 # not chapters.
254 #latex_use_parts = False
255
256 # If true, show page references after internal links.
257 #latex_show_pagerefs = False
258
259 # If true, show URL addresses after external links.
260 #latex_show_urls = False
261
262 # Additional stuff for the LaTeX preamble.
263 #latex_preamble = ''
264
265 # Documents to append as an appendix to all manuals.
266 #latex_appendices = []
267
268 # If false, no module index is generated.
269 #latex_domain_indices = True
270
271
272 # -- Options for manual page output --------------------------------------------
273
274 # One entry per manual page. List of tuples
275 # (source start file, name, description, authors, manual section).
276 man_pages = [
277     ('index', '${module}', u'${module} Documentation',
278      [u'cc'], 1)
279 ]
280 """
281
282 docconf=Template(docconf)
283
284 # SalomeApp.xml file for a documentation only module.
285 # template parameters:
286 #   module : module name
287 #   version : version number of the module
288 docsalomeapp="""
289 <document>
290   <section name="${module}">
291     <parameter name="name" value="${module}"/>
292     <parameter name="version" value="${version}"/>
293   </section>
294   <section name="resources">
295     <parameter name="${module}" value="$${${module}_ROOT_DIR}/share/salome/resources/${lmodule}"/>
296   </section>
297 </document>
298 """
299 docsalomeapp=Template(docsalomeapp)
300