mirror of
https://github.com/seigler/dash-docs
synced 2025-07-26 17:26:12 +00:00
Adds empty title test to Makefile and fixes titles in generated wallet pages
This commit is contained in:
parent
eff65364c4
commit
4476af6a9f
2 changed files with 45 additions and 6 deletions
20
Makefile
20
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".*</\1>' _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 '<title></title>' \
|
||||
| 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 <!-- no subhead-links here -->
|
||||
$S egrep -n -A1 '<h[2-6]' _site/en/developer-* \
|
||||
| egrep -v 'developer-documentation|<h[2-6]|^--|subhead-links' \
|
||||
| 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 <!-- no subhead-links here -->
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue