Unified · Split
| @@ -135,9 +135,9 @@ credits = [ · 134 unmodified lines | ||
| 135 | 135 | 'https://raw.github.com/knockout/knockout/master/LICENSE' |
| 136 | 136 | ], [ |
| 137 | 137 | 'Less', |
| 138 | − '2009-2014 Alexis Sellier & The Core Less Team', | |
| 139 | − 'Apache v2', | |
| 140 | − 'https://raw.github.com/less/less.js/master/LICENSE' | |
| 138 | + '2009-2014 The Core Less Team', | |
| 139 | + 'CC BY', | |
| 140 | + 'http://creativecommons.org/licenses/by/3.0/' | |
| 141 | 141 | ], [ |
| 142 | 142 | 'Lo-Dash', |
| 143 | 143 | '2009-2013 The Dojo Foundation', |
| @@ -1,12 +1,8 @@ | ||
| 1 | 1 | ._less { |
| 2 | 2 | padding-left: 1rem; |
| 3 | 3 | |
| 4 | − > h1, > h2, > h3 { margin-left: -1rem; } | |
| 5 | − > h2, > h3 { @extend %block-heading; } | |
| 6 | − > h4 { margin-top: 2em; } | |
| 7 | − | |
| 8 | − > .function { | |
| 9 | − margin-left: -1rem; | |
| 10 | − @extend %block-label, %label-blue; | |
| 11 | − } | |
| 4 | + > h1, > h2, h3, h4 { margin-left: -1rem; } | |
| 5 | + > h2 { @extend %block-heading; } | |
| 6 | + h3, h4 { @extend %block-label, %label-blue; } | |
| 7 | + code { @extend %label; } | |
| 12 | 8 | } |
| @@ -2,37 +2,26 @@ module Docs · 1 unmodified line | ||
| 2 | 2 | class Less |
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | − # Remove everything but language and function reference | |
| 6 | − doc.children = css('#docs', '#reference').children | |
| 5 | + css('.source-link').remove | |
| 7 | 6 | |
| 8 | − # Change headings | |
| 9 | − css('h1', 'h2', 'h3').each do |node| | |
| 10 | − node.name = "h#{node.name.last.to_i + 1}" | |
| 11 | − node['id'] ||= node.content.strip.parameterize | |
| 7 | + css('#functions-overview').each do |node| | |
| 8 | + node.ancestors('.docs-section').remove | |
| 12 | 9 | end |
| 13 | 10 | |
| 14 | − # Remove .content div | |
| 15 | − css('.content').each do |node| | |
| 16 | − node.before(node.elements) | |
| 17 | − node.remove | |
| 11 | + css('.docs-section', 'blockquote').each do |node| | |
| 12 | + node.before(node.children).remove | |
| 18 | 13 | end |
| 19 | 14 | |
| 20 | − # Remove function index | |
| 21 | − css('#function-reference').each do |node| | |
| 22 | − while node.next.content.strip != 'String functions' | |
| 23 | − node.next.remove | |
| 24 | − end | |
| 15 | + css('.page-header').each do |node| | |
| 16 | + node.before(node.first_element_child).remove | |
| 25 | 17 | end |
| 26 | 18 | |
| 27 | − # Remove duplicates | |
| 28 | − [css('[id="unit"]').last, css('[id="color"]').last].each do |node| | |
| 29 | − node.next.remove while %w(h2 h3 h4).exclude?(node.next.name) | |
| 30 | − node.remove | |
| 19 | + css('h1, h2, h3, h4').each do |node| | |
| 20 | + node.name = node.name.sub(/\d/) { |i| i.to_i + 1 } | |
| 31 | 21 | end |
| 32 | 22 | |
| 33 | − # Differentiate function headings | |
| 34 | − css('#function-reference ~ h4').each do |node| | |
| 35 | − node['class'] = 'function' | |
| 23 | + css('pre').each do |node| | |
| 24 | + node.content = node.content | |
| 36 | 25 | end |
| 37 | 26 | |
| 38 | 27 | doc |
| @@ -1,48 +1,61 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Less |
| 3 | 3 | class EntriesFilter < Docs::EntriesFilter |
| 4 | − SKIP_NAMES = ['Parametric Mixins', 'Mixins With Multiple Parameters', | |
| 5 | − 'Return Values', 'Unlocking Mixins', 'Media Queries as Variables'] | |
| 6 | − | |
| 7 | − REPLACE_NAMES = { | |
| 8 | − 'The @arguments variable' => '@arguments', | |
| 9 | − 'Advanced arguments and the @rest variable' => '@rest', | |
| 10 | − 'The Keyword !important' => '!important', | |
| 11 | − 'Pattern-matching and Guard expressions' => 'Pattern-matching', | |
| 12 | − 'Advanced Usage of &' => '&', | |
| 13 | − 'Importing' => '@import', | |
| 14 | − 'JavaScript evaluation' => 'JavaScript', | |
| 15 | − '% format' => '%' | |
| 16 | − } | |
| 17 | − | |
| 18 | − def include_default_entry? | |
| 19 | − false | |
| 4 | + def name | |
| 5 | + at_css('h1').content | |
| 6 | + end | |
| 7 | + | |
| 8 | + def type | |
| 9 | + root_page? ? 'Language' : nil | |
| 20 | 10 | end |
| 21 | 11 | |
| 22 | 12 | def additional_entries |
| 13 | + root_page? ? language_entries : function_entries | |
| 14 | + end | |
| 15 | + | |
| 16 | + def language_entries | |
| 23 | 17 | entries = [] |
| 24 | − type = '' | |
| 25 | − | |
| 26 | − css('> [id]').each do |node| | |
| 27 | − if node.name == 'h2' | |
| 28 | − type = node.content.strip | |
| 29 | − type.sub! 'The Language', 'Language' | |
| 30 | − type.sub! 'functions', 'Functions' | |
| 31 | − next | |
| 32 | − end | |
| 33 | 18 | |
| 34 | − # Skip function categories (e.g. "Color definition") | |
| 35 | − next if node.name == 'h3' && type != 'Language' | |
| 19 | + css('h1').each do |node| | |
| 20 | + name = node.content | |
| 21 | + entries << [name, node['id']] unless name == 'Overview' | |
| 22 | + end | |
| 23 | + | |
| 24 | + css('h2[id^="import-options-"]').each do |node| | |
| 25 | + entries << ["@import #{node.content}", node['id']] | |
| 26 | + end | |
| 36 | 27 | |
| 37 | − name = node.content.strip | |
| 28 | + entries.concat [ | |
| 29 | + ['@var', 'variables-feature'], | |
| 30 | + ['@{} interpolation', 'variables-feature-variable-interpolation'], | |
| 31 | + ['url()', 'variables-feature-urls'], | |
| 32 | + ['@property', 'variables-feature-properties'], | |
| 33 | + ['@@var', 'variables-feature-variable-names'], | |
| 34 | + [':extend()', 'extend-feature'], | |
| 35 | + [':extend(all)', 'extend-feature-extend-quotallquot'], | |
| 36 | + ['@arguments', 'mixins-parametric-feature-the-codeargumentscode-variable'], | |
| 37 | + ['@rest', 'mixins-parametric-feature-advanced-arguments-and-the-coderestcode-variable'], | |
| 38 | + ['@import', 'import-directives-feature'], | |
| 39 | + ['when', 'mixin-guards-feature'], | |
| 40 | + ['.loop()', 'loops-feature'], | |
| 41 | + ['+:', 'merge-feature'] ] | |
| 38 | 42 | |
| 39 | − next if SKIP_NAMES.include?(name) | |
| 43 | + entries | |
| 44 | + end | |
| 40 | 45 | |
| 41 | − name = REPLACE_NAMES[name] if REPLACE_NAMES[name] | |
| 42 | − name.gsub!(/ [A-Z]/) { |str| str.downcase! } | |
| 46 | + def function_entries | |
| 47 | + entries = [] | |
| 48 | + type = nil | |
| 43 | 49 | |
| 44 | − entries << ['~', node['id'], type] if name == 'e' | |
| 45 | − entries << [name, node['id'], type] | |
| 50 | + css('.docs-section').each do |section| | |
| 51 | + if title = section.at_css('h1') | |
| 52 | + type = title.content | |
| 53 | + type.sub! %r{(\w+) Functions}, 'Functions: \1' | |
| 54 | + end | |
| 55 | + | |
| 56 | + section.css('h3').each do |node| | |
| 57 | + entries << [node.content, node['id'], type] | |
| 58 | + end | |
| 46 | 59 | end |
| 47 | 60 | |
| 48 | 61 | entries |
| @@ -1,18 +1,21 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Less < UrlScraper |
| 3 | 3 | self.type = 'less' |
| 4 | − self.version = '1.6.0' | |
| 4 | + self.version = '1.6.3' | |
| 5 | 5 | self.base_url = 'http://lesscss.org' |
| 6 | + self.root_path = '/features' | |
| 7 | + self.initial_paths = %w(/functions) | |
| 6 | 8 | |
| 7 | − html_filters.push 'less/clean_html', 'less/entries', 'title' | |
| 9 | + html_filters.push 'less/entries', 'less/clean_html', 'title' | |
| 8 | 10 | |
| 9 | − options[:title] = 'LESS' | |
| 10 | − options[:container] = 'section' | |
| 11 | − options[:skip_links] = true | |
| 11 | + options[:title] = 'Less' | |
| 12 | + options[:container] = 'div[role=main]' | |
| 13 | + options[:follow_links] = false | |
| 14 | + options[:trailing_slash] = false | |
| 12 | 15 | |
| 13 | 16 | options[:attribution] = <<-HTML |
| 14 | − © 2009–2014 Alexis Sellier & The Core Less Team<br> | |
| 15 | − Licensed under the Apache License v2.0. | |
| 17 | + © 2009–2014 The Core Less Team<br> | |
| 18 | + Licensed under the Creative Commons Attribution License 3.0. | |
| 16 | 19 | HTML |
| 17 | 20 | end |
| 18 | 21 | end |