mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 01:36:13 +00:00
Adds wallet page generator
This commit is contained in:
parent
d02f388309
commit
6e7b5eb96e
2 changed files with 53 additions and 2 deletions
|
@ -577,8 +577,7 @@ collections:
|
|||
permalink: /en/release/:path
|
||||
## _wallets
|
||||
wallets:
|
||||
output: true
|
||||
permalink: /en/wallets/:path/
|
||||
output: false
|
||||
## _platforms
|
||||
platforms:
|
||||
output: true
|
||||
|
|
52
_plugins/wallets.rb
Normal file
52
_plugins/wallets.rb
Normal file
|
@ -0,0 +1,52 @@
|
|||
# This file is licensed under the MIT License (MIT) available on
|
||||
# http://opensource.org/licenses/MIT.
|
||||
|
||||
require 'yaml'
|
||||
|
||||
module Jekyll
|
||||
|
||||
class WalletPage < Page
|
||||
def initialize(site, base, dir, wallet, platform, os)
|
||||
@site = site
|
||||
@base = base
|
||||
@dir = dir
|
||||
@name = 'index.html'
|
||||
|
||||
self.process(@name)
|
||||
self.read_yaml(File.join(base, '_layouts'), 'wallet-container.html')
|
||||
self.data['wallet'] = wallet
|
||||
self.data['platform'] = platform
|
||||
self.data['os'] = os
|
||||
self.data['id'] = ['wallets', platform['name'], os['name'], wallet['id']].join('-')
|
||||
end
|
||||
end
|
||||
|
||||
class WalletsPageGenerator < Generator
|
||||
safe true
|
||||
|
||||
def generate(site)
|
||||
walletsCol = site.collections['wallets'];
|
||||
walletsDir = 'wallets'
|
||||
|
||||
walletsCol.docs.each do |doc|
|
||||
file = doc.path
|
||||
wallet = YAML.load_file(file)
|
||||
walletPlatforms = wallet['platform']
|
||||
|
||||
puts('---------------------')
|
||||
puts(wallet['id'])
|
||||
|
||||
walletPlatforms.each do |platform|
|
||||
platform['os'].each do |os|
|
||||
if platform['name']
|
||||
dir = File.join(platform['name'], os['name'], wallet['id'])
|
||||
site.pages << WalletPage.new(site, site.source, File.join('en', walletsDir, dir), wallet, platform, os)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue