SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
conf.py
Go to the documentation of this file.
1 # SourceXtractor++ documentation build configuration file, created by
2 # sphinx-quickstart on Thu Jan 31 13:34:56 2019.
3 #
4 # This file is execfile()d with the current directory set to its
5 # containing dir.
6 #
7 # Note that not all possible configuration values are present in this
8 # autogenerated file.
9 #
10 # All configuration values have a default; values that are commented out
11 # serve to show the default.
12 
13 # If extensions (or modules to document with autodoc) are in another directory,
14 # add these directories to sys.path here. If the directory is relative to the
15 # documentation root, use os.path.abspath to make it absolute, like shown here.
16 #
17 import os
18 import sys
19 sys.path.insert(0, os.path.abspath('../../SEImplementation/python/sourcextractor'))
20 
21 import sphinx_rtd_theme
22 
23 
24 # -- General configuration ------------------------------------------------
25 
26 # If your documentation needs a minimal Sphinx version, state it here.
27 #
28 # needs_sphinx = '1.0'
29 
30 # Add any Sphinx extension module names here, as strings. They can be
31 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32 # ones.
33 extensions = [
34 # 'sphinx.ext.intersphinx',
35 # 'sphinx.ext.todo',
36  'sphinx.ext.mathjax',
37 # 'sphinx.ext.ifconfig',
38  'sphinx.ext.autodoc',
39  'sphinx.ext.napoleon',
40  'sphinx.ext.autosummary',
41  'sphinx.ext.doctest',
42  'sphinx.ext.inheritance_diagram',
43  'sphinxcontrib.bibtex',
44  'sphinx.ext.githubpages'
45 ]
46 
47 # Add any paths that contain templates here, relative to this directory.
48 templates_path = ['_templates']
49 
50 # The suffix(es) of source filenames.
51 # You can specify multiple suffix as a list of string:
52 #
53 # source_suffix = ['.rst', '.md']
54 source_suffix = '.rst'
55 
56 # The encoding of source files.
57 #
58 # source_encoding = 'utf-8-sig'
59 
60 # The master toctree document.
61 master_doc = 'index'
62 
63 # General information about the project.
64 project = 'SourceXtractor++'
65 filename = 'sourcextractor'
66 copyright = '2019,2020,2021,2022 GenevaU/LMU/CNRS/SorbonneU'
67 author = 'SourceXtractor++ team'
68 
69 # The version info for the project you're documenting, acts as replacement for
70 # |version| and |release|, also used in various other places throughout the
71 # built documents.
72 #
73 # The short X.Y version.
74 version = '1.0.0'
75 # The full version, including alpha/beta/rc tags.
76 release = '1.0.0'
77 
78 # The language for content autogenerated by Sphinx. Refer to documentation
79 # for a list of supported languages.
80 #
81 # This is also used if you do content translation via gettext catalogs.
82 # Usually you set "language" from the command line for these cases.
83 language = None
84 
85 # There are two options for replacing |today|: either, you set today to some
86 # non-false value, then it is used:
87 #
88 #today = 'Wed July 31 2019'
89 #
90 # Else, today_fmt is used as the format for a strftime call.
91 #
92 today_fmt = '%B %d, %Y'
93 
94 # List of patterns, relative to source directory, that match files and
95 # directories to ignore when looking for source files.
96 # This patterns also effect to html_static_path and html_extra_path
97 exclude_patterns = ['global.rst','keys.rst','roles.rst']
98 
99 # The reST default role (used for this markup: `text`) to use for all
100 # documents.
101 #
102 # default_role = None
103 
104 # If true, '()' will be appended to :func: etc. cross-reference text.
105 #
106 # add_function_parentheses = True
107 
108 # If true, the current module name will be prepended to all description
109 # unit titles (such as .. function::).
110 #
111 # add_module_names = True
112 
113 # If true, sectionauthor and moduleauthor directives will be shown in the
114 # output. They are ignored by default.
115 #
116 # show_authors = False
117 
118 # The name of the Pygments (syntax highlighting) style to use.
119 pygments_style = 'sphinx'
120 
121 # A list of ignored prefixes for module index sorting.
122 # modindex_common_prefix = []
123 
124 # If true, keep warnings as "system message" paragraphs in the built documents.
125 # keep_warnings = False
126 
127 # If true, `todo` and `todoList` produce output, else they produce nothing.
128 todo_include_todos = True
129 
130 numfig = True
131 
132 # -- Autodoc options ------------------------------------------------------
133 # If true, the current module name will be prepended to all description
134 # unit titles (such as .. function::).
135 add_module_names = False
136 
137 autodoc_mock_imports = ['.measurement_images', '_SourceXtractorPy']
138 
139 # -- Options for HTML output ----------------------------------------------
140 
141 # The theme to use for HTML and HTML Help pages. See the documentation for
142 # a list of builtin themes.
143 #
144 html_theme = 'sphinx_rtd_theme'
145 
146 # Theme options are theme-specific and customize the look and feel of a theme
147 # further. For a list of options available for each theme, see the
148 # documentation.
149 #
150 # html_theme_options = {}
151 
152 # Add any paths that contain custom themes here, relative to this directory.
153 html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
154 
155 # The name for this set of Sphinx documents.
156 # "<project> v<release> documentation" by default.
157 #
158 # html_title = 'SourceXtractor++ v1.0.0'
159 
160 # A shorter title for the navigation bar. Default is the same as html_title.
161 #
162 # html_short_title = None
163 
164 # The name of an image file (relative to this directory) to place at the top
165 # of the sidebar.
166 #
167 # html_logo = None
168 
169 # The name of an image file (relative to this directory) to use as a favicon of
170 # the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
171 # pixels large.
172 #
173 # html_favicon = None
174 
175 # Add any paths that contain custom static files (such as style sheets) here,
176 # relative to this directory. They are copied after the builtin static files,
177 # so a file named "default.css" will overwrite the builtin "default.css".
178 html_static_path = ['../theme']
179 
180 # Trick for having ReadTheDocs read custom theme changes
181 def setup(app):
182  app.add_css_file("css/custom.css")
183 
184 # Add any extra paths that contain custom files (such as robots.txt or
185 # .htaccess) here, relative to this directory. These files are copied
186 # directly to the root of the documentation.
187 #
188 # html_extra_path = []
189 
190 # Custom sidebar templates, must be a dictionary that maps document names
191 # to template names.
192 #
193 # This is required for the alabaster theme
194 # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
195 html_sidebars = {
196  '**': [
197  'relations.html', # needs 'show_related': True theme option to display
198  'searchbox.html',
199  ]
200 }
201 
202 # If not None, a 'Last updated on:' timestamp is inserted at every page
203 # bottom, using the given strftime format.
204 # The empty string is equivalent to '%b %d, %Y'.
205 #
206 # html_last_updated_fmt = None
207 
208 # If true, SmartyPants will be used to convert quotes and dashes to
209 # typographically correct entities.
210 #
211 # html_use_smartypants = True
212 
213 # Custom sidebar templates, maps document names to template names.
214 #
215 # html_sidebars = {}
216 
217 # Additional templates that should be rendered to pages, maps page names to
218 # template names.
219 #
220 # html_additional_pages = {}
221 
222 # If false, no module index is generated.
223 #
224 # html_domain_indices = True
225 
226 # If false, no index is generated.
227 #
228 # html_use_index = True
229 
230 # If true, the index is split into individual pages for each letter.
231 #
232 # html_split_index = False
233 
234 # If true, links to the reST sources are added to the pages.
235 #
236 html_show_sourcelink = False
237 
238 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
239 #
240 html_show_sphinx = False
241 
242 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
243 #
244 # html_show_copyright = True
245 
246 # If true, an OpenSearch description file will be output, and all pages will
247 # contain a <link> tag referring to it. The value of this option must be the
248 # base URL from which the finished HTML is served.
249 #
250 # html_use_opensearch = ''
251 
252 # This is the file name suffix for HTML files (e.g. ".xhtml").
253 # html_file_suffix = None
254 
255 # Language to be used for generating the HTML full-text search index.
256 # Sphinx supports the following languages:
257 # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
258 # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh'
259 #
260 # html_search_language = 'en'
261 
262 # A dictionary with options for the search language support, empty by default.
263 # 'ja' uses this config value.
264 # 'zh' user can custom change `jieba` dictionary path.
265 #
266 # html_search_options = {'type': 'default'}
267 
268 # The name of a javascript file (relative to the configuration directory) that
269 # implements a search results scorer. If empty, the default will be used.
270 #
271 # html_search_scorer = 'scorer.js'
272 
273 # Output file base name for HTML help builder.
274 htmlhelp_basename = filename + 'doc'
275 
276 # -- Options for LaTeX output ---------------------------------------------
277 
278 latex_elements = {
279  # The paper size ('letterpaper' or 'a4paper').
280  #
281 'papersize': 'a4paper',
282 
283  # The font size ('10pt', '11pt' or '12pt').
284  #
285  # 'pointsize': '10pt',
286 
287  # Additional stuff for the LaTeX preamble.
288  #
289 'preamble': '\\usepackage{amssymb}',
290 
291  # Latex figure (float) alignment
292  #
293  # 'figure_align': 'htbp',
294 }
295 
296 # Grouping the document tree into LaTeX files. List of tuples
297 # (source start file, target name, title,
298 # author, documentclass [howto, manual, or own class]).
299 latex_documents = [
300  (master_doc, filename + '.tex', project + ' Documentation',
301  author, 'manual'),
302 ]
303 
304 # The name of an image file (relative to this directory) to place at the top of
305 # the title page.
306 #
307 # latex_logo = None
308 
309 # For "manual" documents, if this is true, then toplevel headings are parts,
310 # not chapters.
311 #
312 # latex_use_parts = False
313 
314 # If true, show page references after internal links.
315 #
316 # latex_show_pagerefs = False
317 
318 # If true, show URL addresses after external links.
319 #
320 # latex_show_urls = 'footnote'
321 
322 # Documents to append as an appendix to all manuals.
323 #
324 # latex_appendices = []
325 
326 # It false, will not define \strong, \code, itleref, \crossref ... but only
327 # \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
328 # packages.
329 #
330 # latex_keep_old_macro_names = True
331 
332 # If false, no module index is generated.
333 #
334 # latex_domain_indices = True
335 
336 
337 # -- Options for manual page output ---------------------------------------
338 
339 # One entry per manual page. List of tuples
340 # (source start file, name, description, authors, manual section).
341 man_pages = [
342  (master_doc, filename, project + ' Documentation',
343  author, 1)
344 ]
345 
346 # If true, show URL addresses after external links.
347 #
348 # man_show_urls = False
349 
350 
351 # -- Options for Texinfo output -------------------------------------------
352 
353 # Grouping the document tree into Texinfo files. List of tuples
354 # (source start file, target name, title, author,
355 # dir menu entry, description, category)
356 texinfo_documents = [
357  (master_doc, filename, project + ' Documentation',
358  author, project, 'One line description of project.',
359  'Miscellaneous'),
360 ]
361 
362 # Documents to append as an appendix to all manuals.
363 #
364 # texinfo_appendices = []
365 
366 # If false, no module index is generated.
367 #
368 # texinfo_domain_indices = True
369 
370 # How to display URL addresses: 'footnote', 'no', or 'inline'.
371 #
372 # texinfo_show_urls = 'footnote'
373 
374 # If true, do not generate a @detailmenu in the "Top" node's menu.
375 #
376 # texinfo_no_detailmenu = False
377 
378 
379 # -- Options for Epub output ----------------------------------------------
380 
381 # Bibliographic Dublin Core info.
382 epub_title = project
383 epub_author = author
384 epub_publisher = author
385 epub_copyright = copyright
386 
387 # The basename for the epub file. It defaults to the project name.
388 # epub_basename = project
389 
390 # The HTML theme for the epub output. Since the default themes are not
391 # optimized for small screen space, using the same theme for HTML and epub
392 # output is usually not wise. This defaults to 'epub', a theme designed to save
393 # visual space.
394 #
395 # epub_theme = 'epub'
396 
397 # The language of the text. It defaults to the language option
398 # or 'en' if the language is not set.
399 #
400 # epub_language = ''
401 
402 # The scheme of the identifier. Typical schemes are ISBN or URL.
403 # epub_scheme = ''
404 
405 # The unique identifier of the text. This can be a ISBN number
406 # or the project homepage.
407 #
408 # epub_identifier = ''
409 
410 # A unique identification for the text.
411 #
412 # epub_uid = ''
413 
414 # A tuple containing the cover image and cover page html template filenames.
415 #
416 # epub_cover = ()
417 
418 # A sequence of (type, uri, title) tuples for the guide element of content.opf.
419 #
420 # epub_guide = ()
421 
422 # HTML files that should be inserted before the pages created by sphinx.
423 # The format is a list of tuples containing the path and title.
424 #
425 # epub_pre_files = []
426 
427 # HTML files that should be inserted after the pages created by sphinx.
428 # The format is a list of tuples containing the path and title.
429 #
430 # epub_post_files = []
431 
432 # A list of files that should not be packed into the epub file.
433 epub_exclude_files = ['search.html']
434 
435 # The depth of the table of contents in toc.ncx.
436 #
437 # epub_tocdepth = 3
438 
439 # Allow duplicate toc entries.
440 #
441 # epub_tocdup = True
442 
443 # Choose between 'default' and 'includehidden'.
444 #
445 # epub_tocscope = 'default'
446 
447 # Fix unsupported image types using the Pillow.
448 #
449 # epub_fix_images = False
450 
451 # Scale large images.
452 #
453 # epub_max_image_width = 0
454 
455 # How to display URL addresses: 'footnote', 'no', or 'inline'.
456 #
457 # epub_show_urls = 'inline'
458 
459 # If false, no index is generated.
460 #
461 # epub_use_index = True
462 
463 
464 # Example configuration for intersphinx: refer to the Python standard library.
465 intersphinx_mapping = {'https://docs.python.org/': None}
466 
467 # -- Options for pybtex ----------------------------------------------
468 bibtex_bibfiles = ["references.bib"]
469 
470 from packaging import version as vers
471 from pybtex import __version__ as pybtex_version
472 from pybtex.style.formatting.unsrt import Style as UnsrtStyle, date, pages, toplevel
473 from pybtex.style.template import * # ... and anything else needed
474 from pybtex.plugin import register_plugin
475 import inspect
476 
477 new_version = vers.parse(pybtex_version) >= vers.parse("0.22")
478 
479 if new_version:
480  def _format_data(node, data):
481  try:
482  f = node.format_data
483  except AttributeError:
484  return node
485  else:
486  return f(data)
487 
488 
489  def _format_list(list_, data):
490  return (_format_data(part, data) for part in list_)
491 
492  @node
493  def href2(children, data):
494  parts = _format_list(children, data)
495  if "http" in list(parts)[0]:
496  parts = _format_list(children, data)
497  return richtext.HRef(*parts)
498  else:
499  return richtext.Tag('strong', *parts)
500 
501 class ADSArxivStyle(UnsrtStyle):
502 
503  if new_version:
504  def format_names(self, role, as_sentence=True):
505  formatted_names = names(role, sep=', ', sep2 = ' and ', last_sep=', and ')
506  if as_sentence:
507  return sentence[ formatted_names ]
508  else:
509  return formatted_names
510 
511  def get_article_template(self, e):
512  volume_and_pages = first_of[
513  # volume and pages, with optional issue number
514  optional[
515  join[
516  field('volume'),
517  optional[ '(', field('number'),')' ],
518  ':', pages
519  ],
520  ],
521  # pages only
522  words[ 'pages', pages ],
523  ]
524  myurl = first_of[
525  optional_field('adsurl'),
526  optional[ join[ 'http://arxiv.org/abs/', field('eprint') ]],
527  optional_field('url'),
528  optional[ join ['http://dx.doi.org/', field('doi') ]]
529  ]
530  template = toplevel[
531  sentence[ self.format_names('author', as_sentence=False), field('year') ],
532  href2[ myurl, self.format_title(e, 'title') ],
533  sentence(capfirst=False) [
534  tag('emph')[ field('journal') ],
535  optional[ volume_and_pages ]],
536  sentence(capfirst=False) [ optional_field('note') ],
537  ]
538  return template
539 
541  myurl = first_of[
542  optional_field('adsurl'),
543  optional[ join ['http://arxiv.org/abs/', field('eprint') ]],
544  optional_field('url'),
545  optional[ join ['http://dx.doi.org/', field('doi') ]]
546  ]
547  template = toplevel[
548  sentence[ self.format_names('author', as_sentence=False), field('year') ],
549  href2[ myurl, self.format_title(e, 'title') ],
550  words[
551  'In',
552  sentence(capfirst=False)[
553  optional[ self.format_editor(e, as_sentence=False) ],
554  self.format_btitle(e, 'booktitle', as_sentence=False),
555  self.format_volume_and_series(e, as_sentence=False),
556  optional[ pages ],
557  ],
558  self.format_address_organization_publisher_date(e),
559  ],
560  sentence(capfirst=False)[ optional_field('note') ],
561  ]
562  return template
563 
564  def get_misc_template(self, e):
565  myurl = first_of[
566  optional_field('adsurl'),
567  optional[ join ['http://arxiv.org/abs/', field('eprint') ]],
568  optional_field('url'),
569  optional[ join ['http://dx.doi.org/', field('doi') ]]
570  ]
571  template = toplevel[
572  optional[ sentence[ self.format_names('author', as_sentence=False), optional [ field('year') ]]],
573  optional[ href2[ myurl, self.format_title(e, 'title') ]],
574  sentence[ optional[ field('howpublished') ]],
575  sentence[ optional_field('note') ],
576  ]
577  return template
578  else:
579 
580  def format_article(self, e):
581  volume_and_pages = first_of [
582  # volume and pages, with optional issue number
583  optional [
584  join [
585  field('volume'),
586  optional['(', field('number'),')'],
587  ':', pages
588  ],
589  ],
590  # pages only
591  words ['pages', pages],
592  ]
593  myurl = first_of [
594  optional_field('adsurl'),
595  optional [join ['http://arxiv.org/abs/'], field('eprint')],
596  optional_field('url'),
597  optional [join ['http://dx.doi.org/', field('doi')]]
598  ]
599  template = toplevel [
600  self.format_names('author'),
601  href [myurl, self.format_title(e, 'title')],
602  sentence(capfirst=False) [
603  tag('emph') [field('journal')],
604  optional[ volume_and_pages ],
605  field('year')],
606  sentence(capfirst=False) [ optional_field('note') ],
607  ]
608  return template.format_data(e)
609 
610  def format_inproceedings(self, e):
611  myurl = first_of [
612  optional_field('adsurl'),
613  optional [join ['http://arxiv.org/abs/', field('eprint')]],
614  optional_field('url'),
615  optional [join ['http://dx.doi.org/', field('doi')]]
616  ]
617  template = toplevel [
618  sentence [self.format_names('author')],
619  href [myurl, self.format_title(e, 'title')] \
620  if len(myurl.format_data(e)) > 0 \
621  else tag('strong') [self.format_title(e, 'title')],
622  words [
623  'In',
624  sentence(capfirst=False) [
625  optional[ self.format_editor(e, as_sentence=False) ],
626  self.format_btitle(e, 'booktitle', as_sentence=False),
627  self.format_volume_and_series(e, as_sentence=False),
628  optional[ pages ],
629  ],
630  self.format_address_organization_publisher_date(e),
631  ],
632  sentence(capfirst=False) [ optional_field('note') ],
633  ]
634  return template.format_data(e)
635 
636 register_plugin('pybtex.style.formatting', 'adsarxiv', ADSArxivStyle)
637 
def _format_data
Definition: conf.py:480
def format_article
Definition: conf.py:580
def format_inproceedings
Definition: conf.py:610
def href2
Definition: conf.py:493
def get_misc_template
Definition: conf.py:564
def setup
Definition: conf.py:181
def _format_list
Definition: conf.py:489
def get_article_template
Definition: conf.py:511
def format_names
Definition: conf.py:504
def get_inproceedings_template
Definition: conf.py:540