Merge "Use absolute paths in template on publishdocs"
This commit is contained in:
commit
85285d595e
@ -299,22 +299,27 @@ loop contexts).
|
||||
extract the correct subset of the data.
|
||||
|
||||
``TOPDIR``
|
||||
The relative path to the top of the build output. This is useful for
|
||||
The path to the top of the build output (relative path by default and
|
||||
absolute URL with ``--publish`` option). This is useful for
|
||||
building paths between output pages in a way that allows those pages
|
||||
to move around later.
|
||||
|
||||
``SCRIPTDIR``
|
||||
The relative path to the location of the JavaScript directory in the
|
||||
build output. This is useful for building links to JavaScript files.
|
||||
The path to the location of the JavaScript directory in the
|
||||
build output (relative path by default and absolute URL with
|
||||
``--publish`` option).
|
||||
This is useful for building links to JavaScript files.
|
||||
|
||||
``CSSDIR``
|
||||
The relative path to the location of the directory containing the
|
||||
CSS files in the build output. This is useful for building links to
|
||||
The path to the location of the directory containing the
|
||||
CSS files in the build output (relative path by default and absolute URL
|
||||
with ``--publish`` option). This is useful for building links to
|
||||
CSS files.
|
||||
|
||||
``IMAGEDIR``
|
||||
The relative path to the location of the directory containing image
|
||||
files in the build output. This is useful for building links to
|
||||
The path to the location of the directory containing image
|
||||
files in the build output (relative path by default and absolute URL
|
||||
with ``--publish`` option). This is useful for building links to
|
||||
images.
|
||||
|
||||
``SERIES``
|
||||
|
@ -36,7 +36,7 @@ if [ "$PUBLISH" = "build" ] ; then
|
||||
fi
|
||||
if [ "$PUBLISH" = "publish" ] ; then
|
||||
python3 tools/www-generator.py --source-directory www/ \
|
||||
--output-directory publish-docs
|
||||
--output-directory publish-docs --publish
|
||||
rsync -a www/static/ publish-docs/
|
||||
# Don't publish these files
|
||||
rm publish-docs/www-index.html
|
||||
|
@ -155,6 +155,11 @@ def parse_command_line_arguments():
|
||||
action='append',
|
||||
help='project to check (defaults to all)',
|
||||
)
|
||||
parser.add_argument('--publish',
|
||||
default=False,
|
||||
action='store_true',
|
||||
help='use absolute paths for publish environment',
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@ -475,18 +480,25 @@ def _get_official_repos():
|
||||
|
||||
|
||||
def render_template(environment, project_data, regular_repos, infra_repos,
|
||||
template_files, template_file, output_directory, extra={}):
|
||||
template_files, template_file, output_directory,
|
||||
is_publish, extra={}):
|
||||
logger = logging.getLogger()
|
||||
logger.info("generating %s", template_file)
|
||||
|
||||
# Determine the relative path to a few common directories so
|
||||
# we don't need to set them in the templates.
|
||||
topdir = os.path.relpath(
|
||||
'.', os.path.dirname(template_file),
|
||||
).rstrip('/') + '/'
|
||||
scriptdir = os.path.join(topdir, 'common', 'js').rstrip('/') + '/'
|
||||
cssdir = os.path.join(topdir, 'common', 'css').rstrip('/') + '/'
|
||||
imagedir = os.path.join(topdir, 'common', 'images').rstrip('/') + '/'
|
||||
if is_publish:
|
||||
topdir = 'https://docs.openstack.org/'
|
||||
scriptdir = topdir + 'common/js/'
|
||||
cssdir = topdir + 'common/css/'
|
||||
imagedir = topdir + 'common/images/'
|
||||
else:
|
||||
topdir = os.path.relpath(
|
||||
'.', os.path.dirname(template_file),
|
||||
).rstrip('/') + '/'
|
||||
scriptdir = os.path.join(topdir, 'common', 'js').rstrip('/') + '/'
|
||||
cssdir = os.path.join(topdir, 'common', 'css').rstrip('/') + '/'
|
||||
imagedir = os.path.join(topdir, 'common', 'images').rstrip('/') + '/'
|
||||
|
||||
series_match = SERIES_PAT.match(template_file)
|
||||
if series_match:
|
||||
@ -610,6 +622,7 @@ def main():
|
||||
template_files,
|
||||
template_file,
|
||||
args.output_directory,
|
||||
args.publish
|
||||
)
|
||||
output_pages.append(template_file)
|
||||
|
||||
@ -623,6 +636,7 @@ def main():
|
||||
template_files,
|
||||
page_list_template,
|
||||
args.output_directory,
|
||||
args.publish,
|
||||
extra={
|
||||
'file_list': output_pages,
|
||||
},
|
||||
|
@ -1,12 +1,9 @@
|
||||
{# -*- mode: html -*- #}
|
||||
|
||||
<!-- Custom CSS -->
|
||||
{# reason to not use the CSSDIR its because introduces a relative path #}
|
||||
{# not an absolute, so when its included on docthemes, its tried to include the css #}
|
||||
{# from a wrong path instead of the right one #}
|
||||
|
||||
<link href="https://docs.openstack.org/common/css/deprecated-badge.css" rel="stylesheet">
|
||||
<script src="https://docs.openstack.org/common/js/deprecated-badge.js"></script>
|
||||
<link href="{{ CSSDIR }}deprecated-badge.css" rel="stylesheet">
|
||||
<script src="{{ SCRIPTDIR }}deprecated-badge.js"></script>
|
||||
|
||||
<div id="deprecated-badge" class="deprecated-badge fixed
|
||||
{% if SERIES == RELEASED_SERIES %}
|
||||
|
@ -1,12 +1,9 @@
|
||||
{# -*- mode: html -*- #}
|
||||
|
||||
<!-- Custom CSS -->
|
||||
{# reason to not use the CSSDIR its because introduces a relative path #}
|
||||
{# not an absolute, so when its included on docthemes, its tried to include the css #}
|
||||
{# from a wrong path instead of the right one #}
|
||||
|
||||
<link href="https://docs.openstack.org/common/css/deprecated-badge.css" rel="stylesheet">
|
||||
<script src="https://docs.openstack.org/common/js/deprecated-badge.js"></script>
|
||||
<link href="{{ CSSDIR }}deprecated-badge.css" rel="stylesheet">
|
||||
<script src="{{ SCRIPTDIR }}deprecated-badge.js"></script>
|
||||
|
||||
<div id="deprecated-badge" class="deprecated-badge fixed
|
||||
{% if SERIES == RELEASED_SERIES %}
|
||||
@ -41,4 +38,4 @@
|
||||
{% endif %}
|
||||
<a href="#top" class="deprecated-badge-right"><i class="fa fa-chevron-up" aria-hidden="true"></i> Back to Top</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user