Add Handlebars.js documentation

pull/871/merge
Jasper van Merle 7 years ago committed by Thibaut Courouble
parent 62e07e4e4d
commit 8b9c62d791

@ -310,6 +310,11 @@ credits = [
'GruntJS Team',
'MIT',
'https://github.com/gruntjs/grunt-docs/blob/master/package.json#L10'
], [
'Handlebars',
'2011-2017 Yehuda Katz',
'MIT',
'https://raw.githubusercontent.com/wycats/handlebars.js/master/LICENSE'
], [
'Haskell',
'The University of Glasgow',

@ -27,6 +27,7 @@
._flow,
._gnu,
._grunt,
._handlebars,
._haxe,
._immutable,
._influxdata,

@ -0,0 +1,44 @@
module Docs
class Handlebars
class CleanHtmlFilter < Filter
def call
# Remove the t-shirt shop advertisement
css('#callout').remove
# The title filter is used to add titles to pages without one, remove original headers
css('h1').remove
# Remove the link to the issue tracker
css('.issue-tracker').remove
css('pre').each do |node|
# Remove nested nodes inside pre tags
node.content = node.content
# Add syntax highlighting
node['data-language'] = 'html'
end
# Transform 'Learn More' links to headers in the "Getting Started" part of the homepage
# If this step is skipped, that section looks cluttered with 4 sub-sections without any dividers
css('#getting-started + .contents a.more-info').each do |node|
clone = node.clone
# Move it to the top of the sub-section
node.parent.prepend_child(clone)
# Turn it into a header
clone.name = 'h3'
# Remove the "Learn More: " part
clone.content = clone.content[12..-1]
end
# Remove class attributes from div elements to reduce file size
css('div').remove_attr('class')
doc
end
end
end
end

@ -0,0 +1,19 @@
module Docs
class Handlebars
class EntriesFilter < Docs::EntriesFilter
def get_name
subpath[0..-6].titleize
end
def get_type
name
end
def additional_entries
css('h2, h3').to_a.map do |node|
[node.content.strip, node['id'], root_page? ? 'Manual' : nil]
end
end
end
end
end

@ -0,0 +1,23 @@
module Docs
class Handlebars < UrlScraper
self.name = 'Handlebars.js'
self.slug = 'handlebars'
self.type = 'handlebars'
self.release = '4.0.11'
self.base_url = 'https://handlebarsjs.com/'
self.links = {
home: 'https://handlebarsjs.com/',
code: 'https://github.com/wycats/handlebars.js/'
}
html_filters.push 'handlebars/entries', 'handlebars/clean_html', 'title'
options[:container] = '#contents'
options[:root_title] = 'Handlebars.js'
options[:attribution] = <<-HTML
&copy; 2011-2017 by Yehuda Katz<br>
Licensed under the MIT License.
HTML
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

@ -0,0 +1 @@
https://github.com/yahoo/formatjs-site/tree/master/public/img
Loading…
Cancel
Save