diff --git a/Makefile b/Makefile index 2119ec40..dff4c987 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ ## This file is licensed under the MIT License (MIT) available on ## http://opensource.org/licenses/MIT. -S=@ ## Silent: only print errors by default; +S=@ ## Silent: only print errors by default; ## run `make S='' [other args]` to print commands as they're run SITEDIR=_site @@ -67,6 +67,7 @@ post-build-tests-fast: check-for-build-errors ensure-each-svg-has-a-png check-fo check-for-missing-anchors check-for-broken-markdown-reference-links \ check-for-broken-kramdown-tables check-for-duplicate-header-ids \ check-for-headers-containing-auto-link check-for-missing-subhead-links \ + check-for-empty-title-tag \ check-for-subheading-anchors \ check-jshint \ check-for-javascript-in-svgs @@ -126,7 +127,7 @@ ensure-each-svg-has-a-png: ; do test -f $${file%.svg}.png || echo "$$file missing corresponding PNG" \ ; done | eval $(ERROR_ON_OUTPUT) - + ## Some Jekyll errors leave error messages in the text check-for-liquid-errors: $S grep -r 'Liquid syntax error:' $(SITEDIR)/ | eval $(ERROR_ON_OUTPUT) @@ -182,6 +183,21 @@ check-for-headers-containing-auto-link: ## 'class="auto-link"' produced by autocrossref $S grep '<\(h[2-6]\).*\?>[^>]\+class="auto-link".*' _site/en/developer-* | eval $(ERROR_ON_OUTPUT) +check-for-empty-title-tag: +## The autocrossref plugin can mess up subheadings (h2, etc), so ensure +## none of the generated subheadings contain the string +## 'class="auto-link"' produced by autocrossref + $S find ./_site -name '*.html' -type f \ + | xargs grep '' \ + | eval $(ERROR_ON_OUTPUT) + +check-for-missing-subhead-links: +## Make sure each subhead (h2-h6) either has the subhead links +## (edit,issue,etc) or something like + $S egrep -n -A1 ' diff --git a/_plugins/wallets.rb b/_plugins/wallets.rb index 3d8fa866..c7c58e09 100644 --- a/_plugins/wallets.rb +++ b/_plugins/wallets.rb @@ -6,7 +6,7 @@ require 'yaml' module Jekyll class WalletPage < Page - def initialize(site, base, dir, wallet, platform, os, lang) + def initialize(site, base, dir, wallet, platform, os, title, lang) @site = site @base = base @dir = dir @@ -19,11 +19,12 @@ module Jekyll self.data['os'] = os self.data['id'] = ['wallets', platform['name'], os['name'], wallet['id']].join('-') self.data['lang'] = lang + self.data['title'] = title end end class PlatformPage < Page - def initialize(site, base, dir, platform, os, lang) + def initialize(site, base, dir, platform, os, title, lang) @site = site @base = base @dir = dir @@ -35,6 +36,7 @@ module Jekyll self.data['os'] = os self.data['id'] = ['wallets', platform['name'], os['name']].join('-') self.data['lang'] = lang + self.data['title'] = title end end @@ -70,13 +72,23 @@ module Jekyll # Getting information about each found wallet locs.each do |lang,value| + title = locs[lang]['choose-your-wallet']['title'] + platformsCol.docs.each do |doc| file = doc.path data = YAML.load_file(file) platform = data['platform'] os = data['os'] dir = File.join(platform['name'], os['name']) - site.pages << PlatformPage.new(site, site.source, File.join(lang, walletsDir, dir), platform, os, lang) + + platformTitle = locs[lang]['choose-your-wallet']['walletcat' + platform['name']] + osTitle = locs[lang]['choose-your-wallet']['platform' + os['name']] + if osTitle.nil? + fullTitle = [platformTitle, title].join(' - ') + else + fullTitle = [platformTitle, osTitle, title].join(' - ') + end + site.pages << PlatformPage.new(site, site.source, File.join(lang, walletsDir, dir), platform, os, fullTitle, lang) end walletsCol.docs.each do |doc| @@ -92,7 +104,18 @@ module Jekyll # This allows generation only of valid wallet pages if platform['name'] dir = File.join(platform['name'], os['name'], wallet['id']) - site.pages << WalletPage.new(site, site.source, File.join(lang, walletsDir, dir), wallet, platform, os, lang) + + platformTitle = locs[lang]['choose-your-wallet']['walletcat' + platform['name']] + osTitle = locs[lang]['choose-your-wallet']['platform' + os['name']] + walletTitle = wallet['title'] + + if osTitle.nil? + fullTitle = [walletTitle, platformTitle, title].join(' - ') + else + fullTitle = [walletTitle, platformTitle, osTitle, title].join(' - ') + end + + site.pages << WalletPage.new(site, site.source, File.join(lang, walletsDir, dir), wallet, platform, os, fullTitle, lang) end end