mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 09:46:12 +00:00
Allow disabling plugins for faster preview
This commit is contained in:
parent
1863fad011
commit
45cdb02ab9
9 changed files with 98 additions and 4 deletions
|
@ -119,6 +119,14 @@ commands:
|
|||
## Or build the site and run all tests
|
||||
make all
|
||||
|
||||
#### Partial build for faster preview
|
||||
|
||||
In order to preview some changes faster, you can disable all plugins and
|
||||
languages but those you need by prefixing the `ENABLED_LANGS` and `ENABLED_PLUGINS`
|
||||
environment variables:
|
||||
|
||||
ENABLED_PLUGINS="events autocrossref" ENABLED_LANGS="en fr" make all
|
||||
|
||||
## Developer Documentation
|
||||
|
||||
Each part of the documentation can be found in the [_includes](https://github.com/bitcoin/bitcoin.org/tree/master/_includes)
|
||||
|
|
|
@ -48,8 +48,13 @@ module Jekyll
|
|||
|
||||
class AlertPageGenerator < Generator
|
||||
def generate(site)
|
||||
#generate each alert based on templates
|
||||
#Generate each alert based on templates
|
||||
site.config['STATUS'] = 0
|
||||
#Do nothing if plugin is disabled
|
||||
if !ENV['ENABLED_PLUGINS'].nil? and ENV['ENABLED_PLUGINS'].index('alerts').nil?
|
||||
print 'Alerts disabled' + "\n"
|
||||
return
|
||||
end
|
||||
Dir.foreach('_alerts') do |file|
|
||||
next if file == '.' or file == '..'
|
||||
lang = 'en'
|
||||
|
|
|
@ -86,4 +86,30 @@ require 'yaml'
|
|||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('autocrossref', Jekyll::AutoCrossRefBlock)
|
||||
module Jekyll
|
||||
|
||||
require 'yaml'
|
||||
|
||||
class AutoCrossRefBlockDisabled < Liquid::Block
|
||||
|
||||
def initialize(tag_name, text, tokens)
|
||||
super
|
||||
end
|
||||
|
||||
def render(context)
|
||||
output = super
|
||||
|
||||
output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
#Do nothing if plugin is disabled
|
||||
if !ENV['ENABLED_PLUGINS'].nil? and ENV['ENABLED_PLUGINS'].index('autocrossref').nil?
|
||||
print 'Autocrossref disabled' + "\n"
|
||||
Liquid::Template.register_tag('autocrossref', Jekyll::AutoCrossRefBlockDisabled)
|
||||
else
|
||||
Liquid::Template.register_tag('autocrossref', Jekyll::AutoCrossRefBlock)
|
||||
end
|
||||
|
|
|
@ -92,9 +92,21 @@ module Jekyll
|
|||
h
|
||||
end
|
||||
end
|
||||
|
||||
# Set site.corecontributors and site.sitecontributors arrays
|
||||
site.corecontributors = {}
|
||||
site.sitecontributors = {}
|
||||
|
||||
#Do nothing if plugin is disabled
|
||||
if !ENV['ENABLED_PLUGINS'].nil? and ENV['ENABLED_PLUGINS'].index('contributors').nil?
|
||||
print 'Contributors disabled' + "\n"
|
||||
return
|
||||
end
|
||||
|
||||
# Populate site.corecontributors and site.sitecontributors arrays
|
||||
site.corecontributors = contributors('bitcoin/bitcoin',site.config['aliases'])
|
||||
site.sitecontributors = contributors('bitcoin/bitcoin.org',site.config['aliases'])
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -130,9 +130,19 @@ module Jekyll
|
|||
h
|
||||
end
|
||||
end
|
||||
# Populate site.conferences array
|
||||
|
||||
# Set site.conferences and site.meetups arrays
|
||||
site.conferences = {}
|
||||
site.meetups = {}
|
||||
|
||||
#Do nothing if plugin is disabled
|
||||
if !ENV['ENABLED_PLUGINS'].nil? and ENV['ENABLED_PLUGINS'].index('events').nil?
|
||||
print 'Events disabled' + "\n"
|
||||
return
|
||||
end
|
||||
|
||||
# Populate site.conferences and site.meetups arrays
|
||||
site.conferences = conferences()
|
||||
# Populate site.meetups array
|
||||
site.meetups = meetups()
|
||||
end
|
||||
|
||||
|
|
|
@ -22,6 +22,13 @@ module Jekyll
|
|||
|
||||
class RedirectPageGenerator < Generator
|
||||
def generate(site)
|
||||
|
||||
#Do nothing if plugin is disabled
|
||||
if !ENV['ENABLED_PLUGINS'].nil? and ENV['ENABLED_PLUGINS'].index('redirects').nil?
|
||||
print 'Redirects disabled' + "\n"
|
||||
return
|
||||
end
|
||||
|
||||
#Load redirections
|
||||
redirects = YAML.load_file("_config.yml")['redirects']
|
||||
#Generate each redirection page
|
||||
|
|
|
@ -43,6 +43,13 @@ module Jekyll
|
|||
|
||||
class ReleasePageGenerator < Generator
|
||||
def generate(site)
|
||||
|
||||
#Do nothing if plugin is disabled
|
||||
if !ENV['ENABLED_PLUGINS'].nil? and ENV['ENABLED_PLUGINS'].index('releases').nil?
|
||||
print 'Releases disabled' + "\n"
|
||||
return
|
||||
end
|
||||
|
||||
#generate each release based on templates
|
||||
Dir.foreach('_releases') do |file|
|
||||
next if file == '.' or file == '..'
|
||||
|
|
|
@ -14,11 +14,23 @@ module Jekyll
|
|||
|
||||
class SitemapGenerator < Generator
|
||||
def generate(site)
|
||||
#Do nothing if plugin is disabled
|
||||
if !ENV['ENABLED_PLUGINS'].nil? and ENV['ENABLED_PLUGINS'].index('sitemap').nil?
|
||||
print 'Sitemap disabled' + "\n"
|
||||
return
|
||||
end
|
||||
#Load translations
|
||||
locs = {}
|
||||
enabled = ENV['ENABLED_LANGS'];
|
||||
enabled = enabled.split(' ') if !enabled.nil?
|
||||
Dir.foreach('_translations') do |file|
|
||||
next if file == '.' or file == '..'
|
||||
lang=file.split('.')[0]
|
||||
#Ignore lang if disabled
|
||||
if lang != 'en' and !enabled.nil? and !enabled.include?(lang)
|
||||
print 'Lang ' + lang + ' disabled' + "\n"
|
||||
next
|
||||
end
|
||||
locs[lang] = YAML.load_file('_translations/'+file)[lang]
|
||||
end
|
||||
#Create destination directory if does not exists
|
||||
|
|
|
@ -22,9 +22,16 @@ module Jekyll
|
|||
def generate(site)
|
||||
#load translations files
|
||||
locs = {}
|
||||
enabled = ENV['ENABLED_LANGS'];
|
||||
enabled = enabled.split(' ') if !enabled.nil?
|
||||
Dir.foreach('_translations') do |file|
|
||||
next if file == '.' or file == '..'
|
||||
lang = file.split('.')[0]
|
||||
#Ignore lang if disabled
|
||||
if lang != 'en' and !enabled.nil? and !enabled.include?(lang)
|
||||
print 'Lang ' + lang + ' disabled' + "\n"
|
||||
next
|
||||
end
|
||||
locs[lang] = YAML.load_file("_translations/"+file)[lang]
|
||||
end
|
||||
#Generate each translated page based on templates
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue