cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblot...@apache.org
Subject [2/2] docs commit: Fixing tools to match new toc scheme.
Date Thu, 06 Aug 2015 00:52:34 GMT
Fixing tools to match new toc scheme.


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/e835f097
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/e835f097
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/e835f097

Branch: refs/heads/cordova-website
Commit: e835f0977f5239429278409144574deee2e3f81c
Parents: f259fb2
Author: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Authored: Wed Aug 5 17:52:20 2015 -0700
Committer: Dmitry Blotsky <dmitry.blotsky@gmail.com>
Committed: Wed Aug 5 17:52:20 2015 -0700

----------------------------------------------------------------------
 tools/bin/all_toc.py      | 13 +++++++------
 tools/bin/gen_defaults.py |  8 +++++++-
 tools/bin/util.py         | 12 ++++++++++++
 3 files changed, 26 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/e835f097/tools/bin/all_toc.py
----------------------------------------------------------------------
diff --git a/tools/bin/all_toc.py b/tools/bin/all_toc.py
index 953be4e..6aefc28 100644
--- a/tools/bin/all_toc.py
+++ b/tools/bin/all_toc.py
@@ -14,12 +14,12 @@ def main():
     arg_parser.add_argument('data')
     args = arg_parser.parse_args()
 
-    docs = args.docs
-    data = args.data
+    docs_dir = args.docs
+    data_dir = args.data
 
     # go through all languages
-    for lang_name in listdirs(docs):
-        lang_path = os.path.join(docs, lang_name)
+    for lang_name in listdirs(docs_dir):
+        lang_path = os.path.join(docs_dir, lang_name)
 
         # go through all versions
         for version_name in listdirs(lang_path):
@@ -28,8 +28,9 @@ def main():
             prefix     = '/docs/{lang}/{vers}/'.format(lang=lang_name, vers=version_name)
             source_dir = version_path
 
-            dest_path = os.path.join(data, lang_name, version_name, 'toc-auto.yml')
-            dest_dir  = os.path.dirname(dest_path)
+            dest_name    = generated_tocfile_name(lang_name, version_name)
+            dest_path    = os.path.join(data_dir, 'toc', dest_name)
+            dest_dir     = os.path.dirname(dest_path)
 
             # make the output directory if it doesn't exist
             if not os.path.exists(dest_dir):

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/e835f097/tools/bin/gen_defaults.py
----------------------------------------------------------------------
diff --git a/tools/bin/gen_defaults.py b/tools/bin/gen_defaults.py
index 1565cd4..99c30a3 100644
--- a/tools/bin/gen_defaults.py
+++ b/tools/bin/gen_defaults.py
@@ -27,12 +27,18 @@ def main():
 
         # configure each version scope
         for version_name in listdirs(lang_path):
+
+            manual = manual_tocfile_name(lang_name, version_name)
+            generated = generated_tocfile_name(lang_name, version_name)
+
             config['defaults'].append({
                 'scope': {
                     'path': 'docs/' + lang_name + '/' + version_name
                 },
                 'values': {
-                    'version': version_name,
+                    'version':       version_name,
+                    'manual_toc':    manual.replace('.yml', ''),
+                    'generated_toc': generated.replace('.yml', ''),
                 }
             })
 

http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/e835f097/tools/bin/util.py
----------------------------------------------------------------------
diff --git a/tools/bin/util.py b/tools/bin/util.py
index da9c95d..207c985 100644
--- a/tools/bin/util.py
+++ b/tools/bin/util.py
@@ -30,3 +30,15 @@ def mkdirp(path):
             pass
         else:
             raise
+
+def tocfile_name(language, version, suffix):
+    version_slug = version.replace('.', '-')
+    if suffix:
+        suffix = '-' + suffix
+    return '{l}-{v}{s}.yml'.format(l=language, v=version_slug, s=suffix)
+
+def manual_tocfile_name(language, version):
+    return tocfile_name(language, version, 'manual')
+
+def generated_tocfile_name(language, version):
+    return tocfile_name(language, version, 'generated')


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message