From dec4db24b4dfc1f761a961c2b898b36b6bc2589d Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Fri, 8 May 2015 20:07:08 +0200 Subject: [PATCH] Sort entries in index.html Sort the entries in index.html generated by openstack-doc-test for previewing changes. Change-Id: Ia47351f7f0b067ce8dd97798eeb0063aaccbdf23 --- RELEASE_NOTES.rst | 5 +++++ os_doc_tools/doctest.py | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst index 42ca6e47..d9f3d3e1 100644 --- a/RELEASE_NOTES.rst +++ b/RELEASE_NOTES.rst @@ -1,6 +1,11 @@ Release notes ============= +0.28 +---- + +* ``openstack-doc-test``: Sort entries in index.html file. + 0.27 ---- diff --git a/os_doc_tools/doctest.py b/os_doc_tools/doctest.py index ec135f7d..85e158f0 100755 --- a/os_doc_tools/doctest.py +++ b/os_doc_tools/doctest.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf8 -*- # 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 @@ -1241,6 +1240,7 @@ def generate_index_file(): '\n' '

Results of checkbuild

\n') + links = {} for root, dirs, files in os.walk(publish_path): dirs[:] = [d for d in dirs if d not in ['common', 'webapp', 'content', @@ -1252,29 +1252,29 @@ def generate_index_file(): if os.path.isfile(os.path.join(root, 'content/index.html')): path = os.path.relpath(root, publish_path) - index_file.write('%s\n' % - (path, path)) - index_file.write('
\n') + links[path] = ('%s\n' % + (path, path)) elif os.path.isfile(os.path.join(root, 'index.html')): path = os.path.relpath(root, publish_path) - index_file.write('%s\n' % - (path, path)) - index_file.write('
\n') + links[path] = ('%s\n' % + (path, path)) if os.path.isfile(os.path.join(root, 'api-ref.html')): path = os.path.relpath(root, publish_path) - index_file.write('%s\n' % - (path, path)) - index_file.write('
\n') + links[path] = ('%s\n' % + (path, path)) # List PDF files for api-site that have from "bk-api-ref*.pdf" # as well since they have no corresponding html file. for f in files: if f.startswith('bk-api-ref') and f.endswith('.pdf'): path = os.path.relpath(root, publish_path) - index_file.write('%s\n' % - (path, f, f)) - index_file.write('
\n') + links[f] = ('%s\n' % + (path, f, f)) + + for entry in sorted(links): + index_file.write(links[entry]) + index_file.write('
\n') if os.path.isfile(os.path.join(get_publish_path(), 'www-index.html')): index_file.write('
\n')