Merge "Remove RST tags user_only and admin_only"

This commit is contained in:
Jenkins 2015-05-15 13:12:18 +00:00 committed by Gerrit Code Review
commit 2e4e416394
7 changed files with 14 additions and 102 deletions

View File

@ -21,7 +21,7 @@
# serve to show the default.
import os
import sys
# import sys
import openstackdocstheme
@ -31,13 +31,6 @@ import openstackdocstheme
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# Defines conditions for end user guide and admin user guide
# When a piece of content has an "admin" indicator, it will be
# output with the admin guide. Otherwise it's output for both
# the end user guide and the admin user guide.
# This is the path where you find the scope.py file that does conditional TOCs.
sys.path.append(os.path.abspath('../sphinx-ext/'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
@ -47,7 +40,7 @@ sys.path.append(os.path.abspath('../sphinx-ext/'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
# TODO(ajaeger): enable PDF building, for example add 'rst2pdf.pdfbuilder'
extensions = ['os_doc_tools.sphinx.hotref', 'scope']
extensions = []
# Add any paths that contain templates here, relative to this directory.
# templates_path = ['_templates']

View File

@ -1 +0,0 @@
../user-guide/sphinx-ext

View File

@ -21,7 +21,7 @@
# serve to show the default.
import os
import sys
# import sys
import openstackdocstheme
@ -31,13 +31,6 @@ import openstackdocstheme
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sys.path.insert(0, os.path.abspath('.'))
# Defines conditions for end user guide and admin user guide
# When a piece of content has an "admin" indicator, it will be
# output with the admin guide. Otherwise it's output for both
# the end user guide and the admin user guide.
# This is the path where you find the scope.py file that does conditional TOCs.
sys.path.append(os.path.abspath('../sphinx-ext/'))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
@ -47,7 +40,7 @@ sys.path.append(os.path.abspath('../sphinx-ext/'))
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
# TODO(ajaeger): enable PDF building, for example add 'rst2pdf.pdfbuilder'
extensions = ['os_doc_tools.sphinx.hotref', 'scope']
extensions = ['os_doc_tools.sphinx.hotref']
# Add any paths that contain templates here, relative to this directory.
# templates_path = ['_templates']

View File

@ -1,58 +0,0 @@
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import re
from sphinx import addnodes
docs_for_admin = []
def setup(app):
app.ignore = []
app.connect('builder-inited', builder_inited)
app.connect('env-get-outdated', env_get_outdated)
app.connect('doctree-read', doctree_read)
def builder_inited(app):
for doc in app.env.found_docs:
first_directive = None
path = os.path.join(app.env.srcdir, doc + app.env.config.source_suffix)
with open(path, 'r') as f:
first_directive = f.readline() + f.readline()
if first_directive:
m = re.match(r'^\.\. meta::\s+:scope: ([a-zA-Z0-9_-]+)',
first_directive)
if m and not app.tags.has(m.group(1)):
docs_for_admin.append(doc)
app.env.found_docs.difference_update(docs_for_admin)
def env_get_outdated(app, env, added, changed, removed):
added.difference_update(docs_for_admin)
changed.difference_update(docs_for_admin)
removed.update(docs_for_admin)
return []
def doctree_read(app, doctree):
for toctreenode in doctree.traverse(addnodes.toctree):
to_remove = []
for e in toctreenode['entries']:
ref = str(e[1])
if ref in docs_for_admin:
to_remove.append(e)
for e in to_remove:
toctreenode['entries'].remove(e)

View File

@ -1,5 +1,5 @@
#!/bin/sh -e
tools/build-rst.sh doc/user-guide --glossary --tag user_only --build build
tools/build-rst.sh doc/user-guide --glossary --build build
# No need to build the glossary again here.
tools/build-rst.sh doc/user-guide-admin --tag admin_only --build build
tools/build-rst.sh doc/user-guide-admin --build build

View File

@ -23,22 +23,12 @@ if [ -z "$DOCNAME" ] ; then
exit 1
fi
OPTS=""
# We need to build guides with all tags so that all strings get
# extracted.
if [ "$DOCNAME" = "user-guide" ] ; then
OPTS="-t user_only"
fi
if [ "$DOCNAME" = "user-guide-admin" ] ; then
OPTS="-t admin_only"
fi
# Build Glossary
tools/glossary2rst.py doc/common-rst/glossary.rst
# First remove the old pot file, otherwise the new file will contain
# old references
rm -f doc/$DOCNAME/source/locale/$DOCNAME.pot
sphinx-build $OPTS -b gettext doc/$DOCNAME/source/ doc/$DOCNAME/source/locale/
sphinx-build -b gettext doc/$DOCNAME/source/ doc/$DOCNAME/source/locale/
# Take care of deleting all temporary files so that git add
# doc/$DOCNAME/source/locale will only add the single pot file.

View File

@ -40,18 +40,13 @@ function copy_to_branch {
mkdir -p publish-docs
# Build End User Guide
tools/build-rst.sh doc/user-guide --glossary --tag user_only --build build \
--target user-guide
# Build Admin User Guide
# No need to build the glossary again here.
tools/build-rst.sh doc/user-guide-admin --tag admin_only --build build \
--target user-guide-admin
# Build Networking Guide
tools/build-rst.sh doc/networking-guide --build build \
--target networking-guide
GLOSSARY="--glossary"
for guide in user-guide user-guide-admin networking-guide; do
tools/build-rst.sh doc/$guide $GLOSSARY --build build \
--target $guide
# Build it only the first time
GLOSSARY=""
done
# Build the www pages so that openstack-doc-test creates a link to
# www/www-index.html.