Repository: cordova-docs Updated Branches: refs/heads/master f68b9fd3b -> 88aecf660
Moving configs to conf/. Renaming languages.yml to docs-versions.yml. Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/88aecf66 Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/88aecf66 Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/88aecf66 Branch: refs/heads/master Commit: 88aecf660f23b865da57ba902cce6191158df6fd Parents: f68b9fd Author: Dmitry Blotsky <[email protected]> Authored: Thu Feb 4 17:55:41 2016 -0800 Committer: Dmitry Blotsky <[email protected]> Committed: Wed Feb 10 19:52:13 2016 -0800 ---------------------------------------------------------------------- .gitignore | 12 ++++-- Makefile | 51 ++++++++++++------------- _config.yml | 82 ----------------------------------------- _dev.yml | 46 ----------------------- _nodocs.yml | 4 -- _prod.yml | 6 --- conf/_config.yml | 82 +++++++++++++++++++++++++++++++++++++++++ conf/_dev.yml | 46 +++++++++++++++++++++++ conf/_nodocs.yml | 4 ++ conf/_prod.yml | 6 +++ gulpfile.js | 38 ++++++++++--------- tools/bin/gen_languages.js | 77 -------------------------------------- tools/bin/gen_versions.js | 77 ++++++++++++++++++++++++++++++++++++++ www/_layouts/docs.html | 15 +++++--- 14 files changed, 280 insertions(+), 266 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index f687bf5..7850469 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,13 @@ build-* *.pyc -_defaults.yml -_version.yml -www/_data/languages.yml -node_modules + +conf/_defaults.yml +conf/_version.yml +conf/fetched_docs.json + +www/_data/docs-versions.yml www/static/css www/static/js/plugins.js + +node_modules Gemfile.lock http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/Makefile ---------------------------------------------------------------------- diff --git a/Makefile b/Makefile index a1eeffe..85703d9 100644 --- a/Makefile +++ b/Makefile @@ -30,9 +30,10 @@ VERSION_VAR_NAME = latest_docs_version BIN_DIR = tools/bin NODE_BIN_DIR = ./node_modules/.bin -SRC_DIR = www -DEV_DIR = build-dev -PROD_DIR = build-prod +SRC_DIR = www +DEV_DIR = build-dev +PROD_DIR = build-prod +CONFIG_DIR = conf DOCS_DIR = $(SRC_DIR)/docs DATA_DIR = $(SRC_DIR)/_data @@ -61,10 +62,10 @@ UGLIFY := $(subst /,\,$(UGLIFY)) endif # existing files -MAIN_CONFIG = _config.yml -DEV_CONFIG = _dev.yml -PROD_CONFIG = _prod.yml -DOCS_EXCLUDE_CONFIG = _nodocs.yml +MAIN_CONFIG = $(CONFIG_DIR)/_config.yml +DEV_CONFIG = $(CONFIG_DIR)/_dev.yml +PROD_CONFIG = $(CONFIG_DIR)/_prod.yml +DOCS_EXCLUDE_CONFIG = $(CONFIG_DIR)/_nodocs.yml PLUGINS_SRC = $(PLUGINS_SRC_DIR)/app.js VERSION_FILE = VERSION @@ -81,11 +82,11 @@ STYLES_SRC = $(shell find $(CSS_SRC_DIR) -name "*.less" -or -name "*.css") endif # generated files -VERSION_CONFIG = _version.yml -DEFAULTS_CONFIG = _defaults.yml -LANGUAGES_DATA = $(DATA_DIR)/languages.yml -PLUGINS_APP = $(PLUGINS_DEST_DIR)/plugins.js -MAIN_STYLE_FILE = $(CSS_DEST_DIR)/main.css +VERSION_CONFIG = $(CONFIG_DIR)/_version.yml +DEFAULTS_CONFIG = $(CONFIG_DIR)/_defaults.yml +DOCS_VERSION_DATA = $(DATA_DIR)/docs-versions.yml +PLUGINS_APP = $(PLUGINS_DEST_DIR)/plugins.js +MAIN_STYLE_FILE = $(CSS_DEST_DIR)/main.css STYLES = $(MAIN_STYLE_FILE) $(addsuffix .css,$(basename $(subst $(CSS_SRC_DIR),$(CSS_DEST_DIR),$(STYLES_SRC)))) @@ -115,7 +116,7 @@ help usage default: @echo " make prod: build site with prod config" @echo " make install: install dependencies" @echo "" - @echo " make data: generate data files (Generated ToCs, $(LANGUAGES_DATA))" + @echo " make data: generate data files (Generated ToCs, $(DOCS_VERSION_DATA))" @echo " make configs: generate Jekyll configs ($(DEFAULTS_CONFIG), $(VERSION_CONFIG))" @echo " make styles: generate CSS" @echo " make plugins: generate plugins app ($(PLUGINS_APP))" @@ -128,7 +129,7 @@ help usage default: @echo " NODOCS: (defined or undefined) - excludes docs from build" @echo "" -data: $(TOC_FILES) $(LANGUAGES_DATA) +data: $(TOC_FILES) $(DOCS_VERSION_DATA) configs: $(DEFAULTS_CONFIG) $(VERSION_CONFIG) styles: $(STYLES) plugins: $(PLUGINS_APP) @@ -146,7 +147,7 @@ build: JEKYLL_CONFIGS += $(DOCS_EXCLUDE_CONFIG) endif build: JEKYLL_FLAGS += --config $(subst $(SPACE),$(COMMA),$(strip $(JEKYLL_CONFIGS))) -build: $(JEKYLL_CONFIGS) $(TOC_FILES) $(LANGUAGES_DATA) $(STYLES) $(PLUGINS_APP) +build: $(JEKYLL_CONFIGS) data styles plugins $(JEKYLL) build $(JEKYLL_FLAGS) install: @@ -159,21 +160,21 @@ serve: # real targets # NOTE: # the ">>" operator appends to a file in both CMD and SH -$(PLUGINS_APP): $(PLUGINS_SRC) Makefile +$(PLUGINS_APP): $(PLUGINS_SRC) echo ---> $@ echo --->> $@ $(BROWSERIFY) -t reactify -t envify $< | $(UGLIFY) >> $@ -$(LANGUAGES_DATA): $(BIN_DIR)/gen_languages.js Makefile - $(NODE) $(BIN_DIR)/gen_languages.js $(DOCS_DIR) > $@ +$(DOCS_VERSION_DATA): $(BIN_DIR)/gen_versions.js + $(NODE) $(BIN_DIR)/gen_versions.js $(DOCS_DIR) > $@ -$(DEFAULTS_CONFIG): $(BIN_DIR)/gen_defaults.js $(VERSION_FILE) Makefile +$(DEFAULTS_CONFIG): $(BIN_DIR)/gen_defaults.js $(VERSION_FILE) $(NODE) $(BIN_DIR)/gen_defaults.js $(DOCS_DIR) "$(LATEST_DOCS_VERSION)" > $@ -$(VERSION_CONFIG): $(VERSION_FILE) Makefile +$(VERSION_CONFIG): $(VERSION_FILE) sed -e "s/^/$(VERSION_VAR_NAME): /" < $< > $@ -$(TOC_FILES): $(BIN_DIR)/toc.js Makefile +$(TOC_FILES): $(BIN_DIR)/toc.js $(NODE) $(BIN_DIR)/toc.js $(DOCS_DIR) $(DATA_DIR) $(MAIN_STYLE_FILE): $(SCSS_SRC) @@ -182,7 +183,7 @@ $(MAIN_STYLE_FILE): $(SCSS_SRC) # NODE: # $(@D) means "directory part of target" -$(CSS_DEST_DIR)/%.css: $(CSS_SRC_DIR)/%.less Makefile +$(CSS_DEST_DIR)/%.css: $(CSS_SRC_DIR)/%.less ifdef WINDOWS -$(MKDIRP) $(subst /,\,$(@D)) else @@ -192,7 +193,7 @@ endif echo --->> $@ $(LESSC) $< >> $@ -$(CSS_DEST_DIR)/%.css: $(CSS_SRC_DIR)/%.scss Makefile +$(CSS_DEST_DIR)/%.css: $(CSS_SRC_DIR)/%.scss ifdef WINDOWS -$(MKDIRP) $(subst /,\,$(@D)) else @@ -202,7 +203,7 @@ endif echo --->> $@ $(SASSC) $< >> $@ -$(CSS_DEST_DIR)/%.css: $(CSS_SRC_DIR)/%.css Makefile +$(CSS_DEST_DIR)/%.css: $(CSS_SRC_DIR)/%.css ifdef WINDOWS -$(MKDIRP) $(subst /,\,$(@D)) else @@ -219,7 +220,7 @@ clean: $(RM) $(VERSION_CONFIG) $(RM) $(DEFAULTS_CONFIG) $(RM) $(TOC_FILES) - $(RM) $(LANGUAGES_DATA) + $(RM) $(DOCS_VERSION_DATA) $(RM) $(PLUGINS_APP) $(RM) -r $(CSS_DEST_DIR) http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/_config.yml ---------------------------------------------------------------------- diff --git a/_config.yml b/_config.yml deleted file mode 100644 index 0e2c49f..0000000 --- a/_config.yml +++ /dev/null @@ -1,82 +0,0 @@ -# NOTE: -# some of the settings in this file get overwritten in later config -# files like _prod.yml, _dev.yml, and _defaults.yml - -# ======= -# Site settings -# ======= -title: Apache Cordova -title_suffix: "Apache Cordova" -url: "https://cordova.apache.org" # the base hostname & protocol -baseurl: "" # the subpath of the site, e.g. /blog; NOTE: no trailing slash -rss_path: /feed.xml -description: > - Apache Cordova is a set of device APIs that allow a web mobile app - developer to access native device function from JavaScript. - -excerpt_separator: <!--more--> -repo: - uri: https://github.com/apache/cordova-docs - branch: master - -# the version to which /latest/ points -# NOTE: -# this value gets overwritten in _version.yml, which is a generated file -latest_docs_version: dev - -# the docs version that is shown by default when clicking on docs links on the site -default_linked_docs_version: latest - -# NOTE: -# this value _might_ get overwritten on some pages; -# see _defaults.yml, which is a generated file -language: en - -# NOTE: -# this value gets overwritten in _defaults.yml, which is a generated file -defaults: - -# ======= -# Build settings -# ======= -source: www -destination: build-dev - -# don't erase these files in the output directory -keep_files: [".git", ".svn", "wiki-images", "images", "downloads"] - -lsi: false # don't produce an index for related posts -safe: false # disables plugins - -markdown: redcarpet - -redcarpet: - extensions: - - # this adds the ".prettyprint" class to <code> and <pre> tags - - prettify - - # this enables code blocks denoted by backticks, like in GFM - # NOTE: - # this is turned on by default by Jekyll, but is still - # specified explicitly here in case the defaults change - - fenced_code_blocks - - # this allows code blocks and HTML blocks to - # not have a leading or trailing newline - - lax_spacing - - # allows tables - - tables - - # surrounds highlighted text with <mark>s - - highlight - -kramdown: - input: GFM - hard_wrap: false - syntax_highlighter: rouge - -# exclude these directories from the build -exclude: - - static/css-src http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/_dev.yml ---------------------------------------------------------------------- diff --git a/_dev.yml b/_dev.yml deleted file mode 100644 index 5f46302..0000000 --- a/_dev.yml +++ /dev/null @@ -1,46 +0,0 @@ -baseurl: "" -default_linked_docs_version: dev -destination: build-dev -exclude: - - static/css-src - - static/plugins - - docs/de - - docs/es - - docs/fr - - docs/it - - docs/ja - - docs/ko - - docs/pl - - docs/ru - - docs/sl - - docs/zh - - docs/en/1.5.0 - - docs/en/1.6.0 - - docs/en/1.6.1 - - docs/en/1.7.0 - - docs/en/1.8.0 - - docs/en/1.8.1 - - docs/en/1.9.0 - - docs/en/2.0.0 - - docs/en/2.1.0 - - docs/en/2.2.0 - - docs/en/2.3.0 - - docs/en/2.4.0 - - docs/en/2.5.0 - - docs/en/2.6.0 - - docs/en/2.7.0 - - docs/en/2.8.0 - - docs/en/2.9.0 - - docs/en/3.0.0 - - docs/en/3.1.0 - - docs/en/3.2.0 - - docs/en/3.3.0 - - docs/en/3.4.0 - - docs/en/3.5.0 - - docs/en/3.6.0 - - docs/en/4.0.0 - - docs/en/5.0.0 - - docs/en/5.1.1 - - docs/en/5.4.0 - # - docs/en/6.0.0 - # - docs/en/dev http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/_nodocs.yml ---------------------------------------------------------------------- diff --git a/_nodocs.yml b/_nodocs.yml deleted file mode 100644 index 60e4bc7..0000000 --- a/_nodocs.yml +++ /dev/null @@ -1,4 +0,0 @@ -exclude: - - static/css-src - - static/plugins - - docs http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/_prod.yml ---------------------------------------------------------------------- diff --git a/_prod.yml b/_prod.yml deleted file mode 100644 index ac9c809..0000000 --- a/_prod.yml +++ /dev/null @@ -1,6 +0,0 @@ -baseurl: "" -default_linked_docs_version: latest -destination: build-prod -exclude: - - static/css-src - - static/plugins http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/conf/_config.yml ---------------------------------------------------------------------- diff --git a/conf/_config.yml b/conf/_config.yml new file mode 100644 index 0000000..0e2c49f --- /dev/null +++ b/conf/_config.yml @@ -0,0 +1,82 @@ +# NOTE: +# some of the settings in this file get overwritten in later config +# files like _prod.yml, _dev.yml, and _defaults.yml + +# ======= +# Site settings +# ======= +title: Apache Cordova +title_suffix: "Apache Cordova" +url: "https://cordova.apache.org" # the base hostname & protocol +baseurl: "" # the subpath of the site, e.g. /blog; NOTE: no trailing slash +rss_path: /feed.xml +description: > + Apache Cordova is a set of device APIs that allow a web mobile app + developer to access native device function from JavaScript. + +excerpt_separator: <!--more--> +repo: + uri: https://github.com/apache/cordova-docs + branch: master + +# the version to which /latest/ points +# NOTE: +# this value gets overwritten in _version.yml, which is a generated file +latest_docs_version: dev + +# the docs version that is shown by default when clicking on docs links on the site +default_linked_docs_version: latest + +# NOTE: +# this value _might_ get overwritten on some pages; +# see _defaults.yml, which is a generated file +language: en + +# NOTE: +# this value gets overwritten in _defaults.yml, which is a generated file +defaults: + +# ======= +# Build settings +# ======= +source: www +destination: build-dev + +# don't erase these files in the output directory +keep_files: [".git", ".svn", "wiki-images", "images", "downloads"] + +lsi: false # don't produce an index for related posts +safe: false # disables plugins + +markdown: redcarpet + +redcarpet: + extensions: + + # this adds the ".prettyprint" class to <code> and <pre> tags + - prettify + + # this enables code blocks denoted by backticks, like in GFM + # NOTE: + # this is turned on by default by Jekyll, but is still + # specified explicitly here in case the defaults change + - fenced_code_blocks + + # this allows code blocks and HTML blocks to + # not have a leading or trailing newline + - lax_spacing + + # allows tables + - tables + + # surrounds highlighted text with <mark>s + - highlight + +kramdown: + input: GFM + hard_wrap: false + syntax_highlighter: rouge + +# exclude these directories from the build +exclude: + - static/css-src http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/conf/_dev.yml ---------------------------------------------------------------------- diff --git a/conf/_dev.yml b/conf/_dev.yml new file mode 100644 index 0000000..5f46302 --- /dev/null +++ b/conf/_dev.yml @@ -0,0 +1,46 @@ +baseurl: "" +default_linked_docs_version: dev +destination: build-dev +exclude: + - static/css-src + - static/plugins + - docs/de + - docs/es + - docs/fr + - docs/it + - docs/ja + - docs/ko + - docs/pl + - docs/ru + - docs/sl + - docs/zh + - docs/en/1.5.0 + - docs/en/1.6.0 + - docs/en/1.6.1 + - docs/en/1.7.0 + - docs/en/1.8.0 + - docs/en/1.8.1 + - docs/en/1.9.0 + - docs/en/2.0.0 + - docs/en/2.1.0 + - docs/en/2.2.0 + - docs/en/2.3.0 + - docs/en/2.4.0 + - docs/en/2.5.0 + - docs/en/2.6.0 + - docs/en/2.7.0 + - docs/en/2.8.0 + - docs/en/2.9.0 + - docs/en/3.0.0 + - docs/en/3.1.0 + - docs/en/3.2.0 + - docs/en/3.3.0 + - docs/en/3.4.0 + - docs/en/3.5.0 + - docs/en/3.6.0 + - docs/en/4.0.0 + - docs/en/5.0.0 + - docs/en/5.1.1 + - docs/en/5.4.0 + # - docs/en/6.0.0 + # - docs/en/dev http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/conf/_nodocs.yml ---------------------------------------------------------------------- diff --git a/conf/_nodocs.yml b/conf/_nodocs.yml new file mode 100644 index 0000000..60e4bc7 --- /dev/null +++ b/conf/_nodocs.yml @@ -0,0 +1,4 @@ +exclude: + - static/css-src + - static/plugins + - docs http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/conf/_prod.yml ---------------------------------------------------------------------- diff --git a/conf/_prod.yml b/conf/_prod.yml new file mode 100644 index 0000000..ac9c809 --- /dev/null +++ b/conf/_prod.yml @@ -0,0 +1,6 @@ +baseurl: "" +default_linked_docs_version: latest +destination: build-prod +exclude: + - static/css-src + - static/plugins http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/gulpfile.js ---------------------------------------------------------------------- diff --git a/gulpfile.js b/gulpfile.js index 0537874..b31a5f4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -27,6 +27,7 @@ var crawler = require("simplecrawler"); // constants var ROOT_DIR = "."; +var CONFIG_DIR = "conf"; var SOURCE_DIR = path.join(ROOT_DIR, "www"); var DEV_DIR = path.join(ROOT_DIR, "build-dev"); var PROD_DIR = path.join(ROOT_DIR, "build-prod"); @@ -40,15 +41,15 @@ var PLUGINS_SRC_DIR = path.join(SOURCE_DIR, "static", "plugins"); var JS_DIR = path.join(SOURCE_DIR, "static", "js"); var BIN_DIR = path.join(ROOT_DIR, "tools", "bin"); -var CONFIG_FILE = "_config.yml"; -var DEFAULTS_CONFIG_FILE = "_defaults.yml"; -var VERSION_CONFIG_FILE = "_version.yml"; -var PROD_CONFIG_FILE = "_prod.yml"; -var DEV_CONFIG_FILE = "_dev.yml"; -var NODOCS_CONFIG_FILE = "_nodocs.yml"; +var CONFIG_FILE = path.join(CONFIG_DIR, "_config.yml"); +var DEFAULTS_CONFIG_FILE = path.join(CONFIG_DIR, "_defaults.yml"); +var VERSION_CONFIG_FILE = path.join(CONFIG_DIR, "_version.yml"); +var PROD_CONFIG_FILE = path.join(CONFIG_DIR, "_prod.yml"); +var DEV_CONFIG_FILE = path.join(CONFIG_DIR, "_dev.yml"); +var NODOCS_CONFIG_FILE = path.join(CONFIG_DIR, "_nodocs.yml"); var VERSION_FILE = "VERSION"; -var LANGUAGES_FILE = path.join(DATA_DIR, "languages.yml"); +var DOCS_VERSION_FILE = path.join(DATA_DIR, "docs-versions.yml"); var PLUGINS_FILE_NAME = "plugins.js"; var PLUGINS_FILE = path.join(JS_DIR, PLUGINS_FILE_NAME); var PLUGINS_SRC_FILE = path.join(PLUGINS_SRC_DIR, "app.js"); @@ -137,7 +138,7 @@ gulp.task("help", function () { gutil.log(""); gutil.log("Tasks:"); gutil.log(""); - gutil.log(" build same as configs + styles + plugins + jekyll"); + gutil.log(" build same as configs + data + styles + plugins + jekyll"); gutil.log(" jekyll build with jekyll"); gutil.log(" regen same as jekyll + reload"); gutil.log(" serve build the site and open it in a browser"); @@ -145,13 +146,15 @@ gulp.task("help", function () { gutil.log(""); gutil.log(" plugins build " + PLUGINS_FILE); gutil.log(""); - gutil.log(" configs create all the below files"); + gutil.log(" configs run all the below tasks"); gutil.log(" defaults create " + DEFAULTS_CONFIG_FILE); - gutil.log(" languages create " + LANGUAGES_FILE); gutil.log(" version create " + VERSION_CONFIG_FILE); + gutil.log(""); + gutil.log(" data run all the below tasks"); + gutil.log(" docs-versions create " + DOCS_VERSION_FILE); gutil.log(" toc create all generated ToC files in " + TOC_DIR); gutil.log(""); - gutil.log(" styles compile all the below files"); + gutil.log(" styles run all the below tasks"); gutil.log(" less compile all .less files"); gutil.log(" sass compile all .scss files"); gutil.log(" css copy over all .css files"); @@ -173,7 +176,8 @@ gulp.task("help", function () { gutil.log(""); }); -gulp.task("configs", ["toc", "languages", "defaults", "version"]); +gulp.task("data", ["toc", "docs-versions"]) +gulp.task("configs", ["defaults", "version"]); gulp.task("styles", ["less", "css", "sass"]); gulp.task("watch", ["serve"], function () { @@ -190,7 +194,7 @@ gulp.task("watch", ["serve"], function () { path.join(DOCS_DIR, "**", "*.html"), ], {interval: WATCH_INTERVAL}, - ["configs"] + ["configs", "data"] ); gulp.watch( [ @@ -229,7 +233,7 @@ gulp.task("serve", ["build"], function () { }); }); -gulp.task("build", ["configs", "styles", "plugins"], function (done) { +gulp.task("build", ["configs", "data", "styles", "plugins"], function (done) { jekyllBuild(done); }); @@ -245,8 +249,8 @@ gulp.task("reload", function () { browsersync.reload(); }); -gulp.task("languages", function () { - return execPiped("node", [bin("gen_languages.js"), DOCS_DIR], LANGUAGES_FILE) +gulp.task("docs-versions", function () { + return execPiped("node", [bin("gen_versions.js"), DOCS_DIR], DOCS_VERSION_FILE) .pipe(gulp.dest(ROOT_DIR)); }); @@ -386,7 +390,7 @@ gulp.task("clean", function () { remove(path.join(DATA_DIR, "toc", "*-generated.yml")); remove(CSS_OUT_DIR); remove(PLUGINS_FILE); - remove(LANGUAGES_FILE); + remove(DOCS_VERSION_FILE); remove(DEFAULTS_CONFIG_FILE); remove(VERSION_CONFIG_FILE); }); http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/tools/bin/gen_languages.js ---------------------------------------------------------------------- diff --git a/tools/bin/gen_languages.js b/tools/bin/gen_languages.js deleted file mode 100755 index 0f60ccd..0000000 --- a/tools/bin/gen_languages.js +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you 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. - -"use strict"; - -var fs = require("fs"); -var path = require("path"); -var yaml = require("js-yaml"); - -var util = require("./util"); - -// constants -var LANGUAGE_MAP = { - "de": "Deutsch", - "en": "English", - "es": "Español", - "fr": "Français", - "it": "Italiano", - "ja": "æ¥æ¬èª", - "ko": "íêµì´", - "pl": "Polski", - "ru": "Ð ÑÑÑкий", - "sl": "Slovene", - "zh": "æ±è¯", -}; - -function main () { - - var scriptName = process.argv[1]; - var rootDir = process.argv[2]; - var config = {}; - - if (!rootDir) { - console.error("Please specify a directory from which to generate."); - process.exit(1); - } - - // go through directory that contains all languages - util.listdirsSync(rootDir).forEach(function (langId) { - - var langPath = path.join(rootDir, langId); - var versionNames = util.listdirsSync(langPath); - - // get language ID - var langName; - if (langId in LANGUAGE_MAP) { - langName = LANGUAGE_MAP[langId]; - } else { - console.error("Language identifier '" + langId + "' doesn't have an associated name. Please fix that by changing " + scriptName + "."); - process.exit(1); - } - - // set the language name and the versions it has - config[langId] = { - 'name': LANGUAGE_MAP[langId], - 'versions': versionNames - }; - }); - - console.log(yaml.dump(config)); -} - -main(); http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/tools/bin/gen_versions.js ---------------------------------------------------------------------- diff --git a/tools/bin/gen_versions.js b/tools/bin/gen_versions.js new file mode 100644 index 0000000..0f60ccd --- /dev/null +++ b/tools/bin/gen_versions.js @@ -0,0 +1,77 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you 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. + +"use strict"; + +var fs = require("fs"); +var path = require("path"); +var yaml = require("js-yaml"); + +var util = require("./util"); + +// constants +var LANGUAGE_MAP = { + "de": "Deutsch", + "en": "English", + "es": "Español", + "fr": "Français", + "it": "Italiano", + "ja": "æ¥æ¬èª", + "ko": "íêµì´", + "pl": "Polski", + "ru": "Ð ÑÑÑкий", + "sl": "Slovene", + "zh": "æ±è¯", +}; + +function main () { + + var scriptName = process.argv[1]; + var rootDir = process.argv[2]; + var config = {}; + + if (!rootDir) { + console.error("Please specify a directory from which to generate."); + process.exit(1); + } + + // go through directory that contains all languages + util.listdirsSync(rootDir).forEach(function (langId) { + + var langPath = path.join(rootDir, langId); + var versionNames = util.listdirsSync(langPath); + + // get language ID + var langName; + if (langId in LANGUAGE_MAP) { + langName = LANGUAGE_MAP[langId]; + } else { + console.error("Language identifier '" + langId + "' doesn't have an associated name. Please fix that by changing " + scriptName + "."); + process.exit(1); + } + + // set the language name and the versions it has + config[langId] = { + 'name': LANGUAGE_MAP[langId], + 'versions': versionNames + }; + }); + + console.log(yaml.dump(config)); +} + +main(); http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/88aecf66/www/_layouts/docs.html ---------------------------------------------------------------------- diff --git a/www/_layouts/docs.html b/www/_layouts/docs.html index 25291b0..4af2ec8 100644 --- a/www/_layouts/docs.html +++ b/www/_layouts/docs.html @@ -50,20 +50,20 @@ analytics_id: UA-64283057-1 <div class="content-header"> - <a class="edit" href="{{ site.repo.uri }}/tree/{{ site.repo.branch }}/www/{{ page.path }}"> + <a class="edit" href="{% if page.edit_link %}{{ page.edit_link }}{% else %}{{ site.repo.uri }}/tree/{{ site.repo.branch }}/www/{{ page.path }}{% endif %}"> <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Edit </a> <!-- Language dropdown --> <div class="dropdown"> <button class="btn btn-default dropdown-toggle" type="button" id="languageDropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true"> - {{ site.data.languages.[page.language].name }} + {{ site.data.docs-versions.[page.language].name }} <span class="caret"></span> </button> <!-- List all languages --> <ul class="dropdown-menu" aria-labelledby="languageDropdown"> - {% for language_entry in site.data.languages %} + {% for language_entry in site.data.docs-versions %} {% assign language_id = language_entry[0] %} {% assign language = language_entry[1] %} @@ -71,11 +71,14 @@ analytics_id: UA-64283057-1 {% capture current_language_path %}/docs/{{ page.language }}/{{ page.version }}/{% endcapture %} {% capture target_language_path %}/docs/{{ language_id }}/{{ page.version }}/{% endcapture %} + {% comment %} <!-- Replace only the language part of the URI, thereby redirecting to the same page in the other language. - The page should exist because it's for the same version. + The page will exist because translations are clones + of each other. --> + {% endcomment %} {% assign target_language_url = page.url | replace:current_language_path,target_language_path %} {% capture missing_version_class %} @@ -113,7 +116,7 @@ analytics_id: UA-64283057-1 <ul class="dropdown-menu" aria-labelledby="versionDropdown"> <!-- List versions available in this language --> - {% for version in site.data.languages.[page.language].versions reversed %} + {% for version in site.data.docs-versions.[page.language].versions reversed %} <li> {% capture current_version_path %}/docs/{{ page.language }}/{{ page.version }}/{% endcapture %} {% capture target_version_path %}/docs/{{ page.language }}/{{ version }}/{% endcapture %} @@ -125,6 +128,7 @@ analytics_id: UA-64283057-1 {% endif %} {% endcapture %} + {% comment %} <!-- Replace only the version part of the URI, thereby redirecting to the same page in the other version. @@ -133,6 +137,7 @@ analytics_id: UA-64283057-1 this page might not exist in the target version because page layouts change from version to version --> + {% endcomment %} {% assign target_version_url = page.url | replace:current_version_path,target_version_path%} <a href="{{ site.baseurl }}{{ target_version_url }}"> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
