Commit Graph

59 Commits

Author SHA1 Message Date
Hervé Beraud ff156664e6 Adding pre-commit
Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.

Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.

pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker);
- Checks that non-binary executables have a proper
  shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings (check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
  calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)

For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks

Change-Id: I9b979afcd45e6a51252ccccb686b01beeb9157f8
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
2020-09-15 14:46:10 +02:00
Andreas Jaeger 957cee03f9 Show version in PDFs
To fix version display in PDFs, move config changes to config-inited
event.

First config-inited is called, then
builder-inited is called after the builder is setup. The builder might
use values from the config to set internal values.

This happens with the latex builder that takes version and release and
puts them into internal values.

So far, openstackdocstheme used builder-inited and setting version and
release from the theme happened to late. Move all config settings to a
config-inited phase so that it is early - and thus the latex builder can
create PDFs with version numbers.

Change-Id: Icdd308ba13de56bab13e97e3afc6338a7181dcbf
2020-05-20 14:03:08 +02:00
Andreas Jaeger e974da0a35 Add link to PDF file
Create new config options to optionally link to a generate PDF file that
is published at the same location as the html files.

Note that the preview will not be able to download the file since
the file is in a different location. The publishing job moves the PDF
file in the top-level directory.

Change-Id: I3ff74030195b6a85ff4e4e3b62f367aa78f85b0a
2020-05-18 14:58:31 +02:00
Andreas Jaeger 84a9dd90d5 Use xelatex as latex_engine
There's no easy way to check whether the user is overwritten
latex_engine, so revert I3a9d96c4896a0d5ccc85b74562d35852a837f29f
partially and continue to always set latex_engine.

Not setting latex_engine to xelatex breaks a number of OpenStack
repositories that dependend on the default of xelatex in
openstackdocstheme.

Change-Id: I06f1d577d108fd8f16b5aad3e00725f55817ddba
2020-05-15 08:46:24 +02:00
Stephen Finucane 7ad72dc84a Add package prefixes for all config options
It's bad practice to not prefix config options with a unique identifier
corresponding to the package. Start doing just this using the
'openstackdocs_' prefix.

Change-Id: Ic86998ceaa921f7093ba86f979ea648a1d621d59
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-05-13 14:32:20 +00:00
Stephen Finucane 2b258f0380 Merge, rather than overwrite, LaTeX settings
This leads to more predictable behavior.

Change-Id: I3a9d96c4896a0d5ccc85b74562d35852a837f29f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Closes-Bug: #1843527
2020-04-24 13:46:03 +01:00
Stephen Finucane 1246a46deb Add 'openstackdocs_auto_name' config option
As we recently did with auto-versioning, make the setting of the package
name configurable.

Change-Id: Ia9f6dab3fe86b2fc7d6b54f81230b3b9723e5e03
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-04-24 13:46:00 +01:00
Stephen Finucane 2b2e4e50b6 Add 'openstackdocs_auto_version' config option, path checking
Rather than relying on magic values to determine whether we should
attempt to auto-version documentation, start checking the paths for
commonly unversioned source doc paths and add an explicit knob to turn
this on or off.

Change-Id: Iecc3fa6f20f1aa92fcffe2b8adb0cd0da1aa17e4
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Closes-Bug: #1843976
2020-04-24 12:04:21 +01:00
Andreas Jaeger 4ecccf9c0c Do not set html_last_updated_fmt
Since version 1.20 of openstackdocstheme, html_last_updated_fmt does not
need to be set anymore, remove it's setting.

Change-Id: I913b76cc6b3128a420a6fc69e2dc88627d47bbfe
2020-02-22 17:35:46 +01:00
Andreas Jaeger 1fe4f02915 [ussuri][goal] Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Remove cruft from setup.cfg.

Change-Id: Ic719c1f15120b68de97f0e20702b03baeb02f5e9
2020-02-05 19:42:12 +01:00
Stephen Finucane e988c786b1 Add reno for recent CSS cleanups
Change-Id: I6cece00bfbbb9b024a5bd93dcc7f0be291c25ac9
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-05-30 13:01:42 +01:00
Zuul ee131a28b5 Merge "Allow to override build date with SOURCE_DATE_EPOCH" 2019-05-03 18:30:15 +00:00
Bernhard M. Wiedemann 7f0b945741 Allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

Without this patch, building python-debtcollector from a tarball
that does not contain a .git dir varied for every build.

Change-Id: Iaf8bc1c559f5b149a48c9dd05beb0961365fda7e
Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2019-04-29 14:35:13 +00:00
Andreas Jaeger 2d76fd9cff Update for OpenDev change
Use the new OpenDev URLs everywhere, follow move of repositories.

Change-Id: I3dd8c6deff91c4cc3b8958977e73f371bdeb82a0
2019-04-21 14:27:39 +00:00
Frank Kloeker 899a36e341 Add options for sphinx-build -W in docstheme-build-translated.sh
The user can choose

- if warnings should be ignored (SKIP_SPHINX_WARNINGS=1)
- if warnings on translation build should be on (SPHINX_WARNINGS_TRANS=1)

added an example to the previously releasenotes

Change-Id: I1486139fdbdef5dd4e00a38c9cb751a5ed7881c6
2019-01-03 15:04:58 +01:00
Zuul 73b936fc51 Merge "use git modification timestamps as last-updated time for each page" 2018-12-04 20:34:33 +00:00
Doug Hellmann 1b6ee04def use git modification timestamps as last-updated time for each page
Look at the git history to determine the last time a page was modified
and use that date as the last-updated date instead of the default
value of the current time.

Change-Id: I80db00eb2016859e1095c6a1db952f17df3e00d6
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-12-04 10:29:26 -05:00
Andreas Jaeger 0948c2dc65 Import tools for building translated documents
Import from i18n repo the scripts get-lang-display-name.py and
build-docs.sh, update comments so that they are generic.

Add the two files to setup.cfg so that they get distributed with the
package and can be executed from tox for building of translated
documents.

Change-Id: I80fcb1ed857da8452b310e6707cce3940577a35a
2018-11-24 18:41:11 +01:00
Andreas Jaeger 47908ab958 Readd get_openstack_logo_path
Change I594136a0ea66d61f60dafc6a853137470efc7d42 broke the API of this
package with renaming get_openstack_logo_path which broke a couple
of users, readd it.

Change-Id: Ia2f6760e0f6f53d94a8d3358d5c4e2fe0a2d7bf3
2018-10-21 11:54:40 +02:00
Dean Troyer 4ed01cd69c Make a bare-bones starlingxdocs theme
We can use this as a starting point for further changes.  These files
are copies of those from openstacdocs with most of the openstac-specific
bits removed.  This way we can track additional changes made as we progress.

Change-Id: I41c2a7d63ba7796aa3cf3cc001e077d5de28a14d
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-10-16 11:23:23 -05:00
Dean Troyer b0166265a8 Add starlingxdocs theme support
At the PTG the Docs team and dhellmann decided that openstackdocstheme
was the proper place to keep the modifications required to build
a theme for StarlingX and other OpenStack Foundation-related projects.

This is a minimal set of changes to support a second theme with a couple
of visual changes thrown in to make obvious that the correct theme
is being used. The remainder of the visual work will follow.
Both PNG and SVG versions of the logo are included.

Add an additional jobs to build the docs and PDF with the new theme.

Modify the wording in README.rst and the docs index page regarding
the distinction between openstackdocstheme the module and openstackdocs
and starlingxdocs the themes and their intended uses.

There are a number of hard-coded OpenStack-isms that will eventually
need to be addressed.

Change-Id: I594136a0ea66d61f60dafc6a853137470efc7d42
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
2018-10-05 06:32:51 +00:00
chenxing c7f1ed0028 Fix the incorrect storyboard url
Using "repository_name" instead of "bug_project" to combine with the
"urlBase" string, if set use_storyboard to "True". storyboard URLs are
in this format:
"https://storyboard.openstack.org/#!/project/"+"openstack/whereto"
not:
"https://storyboard.openstack.org/#!/project/"+"whereto"

Change-Id: Ib553d95f22c7848a5bd537b8929a2d6e6625451b
2018-09-13 08:51:44 +08:00
Zuul 344b423e01 Merge "Handle StoryBoard project groups" 2018-08-24 03:21:02 +00:00
Andreas Jaeger 038a8f712d Handle StoryBoard project groups
StoryBoard now display the project group in the URL and not anymore a
number. Allow setting the storyboard project group to the name now.
This implies setting a new variable to differentiate between Launchpad
and StoryBoard.

Change-Id: Ie6f8c48fffe04256ad07f22e95935f6f7257ea17
2018-08-23 21:10:03 +02:00
Andreas Jaeger e72301e141 Do not show badge for master only repos
If a repo has no stable branches, we do not need to show the badge,
disable it automatically.

Also, disable it for releasenotes, api-guide and api-ref. These
documents are always published from master and are versionless.

This avoids changing most of the repositories to disable the badge.

Change-Id: I063af45e40bd41e27334638e2cf65ca0c9119e63
2018-08-23 20:36:57 +02:00
Stephen Finucane 3c8b2a6988 Configure additional properties
Configure the 'html_last_updated_fmt', 'latex_engine' and
'latex_elements' attributes automatically. Documentation is updated to
reflect the fact that these no longer need to be configured by hand.

Change-Id: I429b981135e35845bf5ed70020abfef3deccbf90
2018-03-13 16:51:41 +00:00
Stephen Finucane d03cea1f34 Configure project name, version, release
This is currently done by pbr and we want to stop doing that. Start
overriding this via the 'builder-inited' event instead.

Change-Id: Ia2bdd815aac91bc191a4b965c4d07ea5aafa2f84
2018-03-13 16:49:25 +00:00
Stephen Finucane 62c8f36d93 Revert "Fix the incorrect git source url"
This reverts commit f0744a1675.

Manual configuration should be necessary only in the rarest of cases.
Revert this in preparation for a more automated case.

Change-Id: I18902de42d95d9427165e6f8ffa6cab303ea62ca
Related-Bug: #1732630
2018-01-09 16:47:33 +00:00
chenxing f0744a1675 Fix the incorrect git source url
Documentation not located in 'doc/source' directory needs the
giturl value to make the source url correct.

Change-Id: I772a66de4680ba73ed79f8ea5481d6900f71fa82
Closes-Bug: #1732630
2018-01-08 15:07:13 +08:00
Andreas Jaeger 4149f7ce9b Remove setting of version/release from releasenotes
Release notes are version independent, so remove version/release
values. We've found that projects now require the service package
to be installed in order to build release notes, and this is entirely
due to the current convention of pulling in the version information.

Release notes should not need installation in order to build, so this
unnecessary version setting needs to be removed.

This is needed for new release notes publishing, see
I56909152975f731a9d2c21b2825b972195e48ee8 and the discussion starting
at
http://lists.openstack.org/pipermail/openstack-dev/2017-November/124480.html
.

Change-Id: I41c5f76b60c2d958c714af8b59f273315a227817
2017-11-16 21:23:41 +01:00
Ruby Loo e99cf6d96c No red with double backticks markup
The double backticks (``) markup caused text to be displayed in
red with a pinkish background colour. The text is now displayed
in black and bold, the same size as the surrounding text.

Change-Id: Id73e828b69445aa9bf4c48bea84dd95fef16bc2b
Fixes-Bug: 1718256
2017-09-19 13:48:06 -04:00
Sean Dague a5ceb6f15d Bring back local search
This makes the search.html page that's generated by sphinx function as
the local search, and not the global google based swift_search. The
sphinx integrated search will mean that only documents linked to the
current tree will be returned, which also ensures that searching for
content in stable/pike doesn't jump you to mitaka answers. It also
brings back highlighting of search results which is a style rule that
was lost in the building of the openstackdocstheme.

We probably also want sidebar integration of this search field,
however this will at least mean hitting the search.html page will do
what people previously expected.

Change-Id: I747ad28658e12441ccad7081d15788f5d738dc5e
2017-08-12 09:55:09 -05:00
Jenkins cf39f798f1 Merge "Cleanup conf.py" 2017-07-06 13:43:15 +00:00
Jenkins 26f32fd0c1 Merge "Do not display title string of page local TOC" 2017-07-04 16:32:16 +00:00
Stephen Finucane d727e522b9 Strip tags from navigation prev, next titles
Per the Sphinx documentations:

  next - The next document for the navigation. This variable is either
  false or has two attributes link and title. The title contains HTML
  markup.

  prev - Like next, but for the previous page.

If using the title value inside an element attribute, we need to ensure
the HTML tags mentioned above are stripped. Failure to do so results in
corrupted output.

Change-Id: I5fde1e6fc4d7966fcd3e767c79535202f3b41a71
Closes-Bug: #1702328
2017-07-04 17:03:20 +01:00
Andreas Jaeger ab2b99c978 Cleanup conf.py
Adapt for current theme options, remove obsolete code.

Change-Id: I900fa3914463147acaf40e81f54f2f80abcac048
2017-07-04 13:47:08 +02:00
Akihiro Motoki d9bc11a979 Do not display title string of page local TOC
Some pages have no sub titles (the second level of titles or more).
In this case, the title string "Contents" of page local TOC is
completely meaningless and confusing to readers.

It is nice if this title string is shown only when needed.
This can be done by checking 'display_toc' variable in the template.

[1] https://docs.openstack.org/ocata/networking-guide/intro.html

Change-Id: I4803dd7712438eb2cd5fb6084e904bd8c0c98740
2017-07-01 21:29:12 +09:00
Anne Gentle 1b63fd10c5 Adds docs for release versions dropdown menu
Change-Id: I8b080fa4bd8d6bd44b24ff2d050286a7ffe27c97
2017-06-30 16:05:05 +00:00
Andreas Jaeger a713646d06 Require bug_project setting
If bug_project is not set, do not show the "Report a bug" link.

Change-Id: Ifd715d1d46d1b1796d79679c9e954d21e9d09455
2017-06-29 22:13:40 +02:00
Andreas Jaeger 9a6159a529 Minimal support for storyboard
Allows setting of bug_project to a storyboard project number
to redirect to project page on storyboard.openstack.org for
report a bug feature.

Also, add some minor cleanups to doc/source/conf.py.

Change-Id: Ia14d30bf0dda89c48dec0a7cc3b8dccc26dc8d86
2017-06-28 20:44:11 +02:00
Doug Hellmann f7a7a739ba switch release notes build to use openstackdocs instead of oslosphinx
Change-Id: I33274779c2ad8e11b9eae89f7918eea0ab937b3b
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2017-06-26 13:45:07 +00:00
Alexandra Settle 58823b338c Includes checklist when filing a bug for osmanuals
See the mailing list for more information:
http://lists.openstack.org/pipermail/openstack-docs/2017-January/009484.html

Change-Id: I88222caca2b653dffe5b42587a918737ce358fba
2017-01-19 16:45:44 -06:00
Andreas Jaeger f9b3e8bf5b Enable release notes translation
Releasenote translation publishing is being prepared. 'locale_dirs'
needs to be defined in conf.py to generate translated version of the
release notes.

Note that this repository might not get translated release notes - or
no translations at all - but we add the entry here nevertheless to
prepare for it.

Change-Id: I8eac4be92199c7ba98badc1dac68be3e71140d40
2016-10-06 20:40:29 +02:00
Karen Bradshaw 47149987c1 API References dropdown menu
- Adds a theme variable, sidebar_dropdown, to set
  a dropdown menu for the API references.
  To test, uncomment the parameter html_theme_options in
  doc/source/conf.py OR build the API Ref demo docs.
- Adds an API Ref docs demo integrating os-api-ref
  and openstackdocstheme. Tested with webserver:
  python -m SimpleHTTPServer <port_num>.

Change-Id: I346695cd407ecf4efc0a5e00f2c0ccc1ea099ec5
2016-08-22 10:27:45 -05:00
Major Hayden 59072440ab Allow automatic toc to be disabled
In some cases, a user may want to disable the automatic table of
contents generation in the body of the page. This patch adds
a ``display_toc`` option into the theme options list that will
disable the automatic TOC in the documentation body.

Closes-Bug: 1613761

Change-Id: I508b46c5ba6a022ee4ad2687cb4e44ed449ca4fe
2016-08-16 10:10:37 -05:00
Jenkins 70f6ed6a41 Merge "Update Release Notes" 2016-07-19 14:52:14 +00:00
Andreas Jaeger 84152e2bf7 Update Release Notes
Move RELEASENOTES content to a historic document as part of the
release-notes directory.

Also, rename Unreleased to Changes - the file includes both last release
and current unreleased changes.

Change-Id: Ia83609f53e4f7204a57b9fea6c356e9bdf7e5340
2016-07-19 08:05:28 +02:00
Anne Gentle 16c47a00a8 Adds release notes items for next release
Next release will be 1.4.0, add missing release note entries.

Change-Id: I527e3bce3efe162779dd2943b7740d656d4466d3
2016-07-19 07:48:08 +02:00
Jesse Pretorius 13bd97688a Allow the bug title to be customisable
Some projects using openstackdocstheme may wish to customise
the default bug title to be better suited to their needs.

This patch implements the ability to do so.

To define it, add the variable to html_context in the Sphinx
conf.py.

For example:
  html_context = {"bug_title": 'Documentation bug', ...}

Change-Id: Id62debd50fe0499ace809dde626cd8a357dbf933
2016-07-06 15:52:31 +01:00
Graham Hayes 75e8fc6e80 Release note for new sidebar feature
Change-Id: Ie2501e0b07b13e524d2525d174e8b37c589ea5e6
2016-06-03 15:35:40 +00:00