Unified · Split
| @@ -55,6 +55,7 @@ · 54 unmodified lines | ||
| 55 | 55 | 'pages/github', |
| 56 | 56 | 'pages/go', |
| 57 | 57 | 'pages/haskell', |
| 58 | + 'pages/jekyll', | |
| 58 | 59 | 'pages/jquery', |
| 59 | 60 | 'pages/julia', |
| 60 | 61 | 'pages/knockout', |
| @@ -0,0 +1,35 @@ | ||
| 1 | +._jekyll { | |
| 2 | + h2, h3 { @extend %block-heading; } | |
| 3 | + | |
| 4 | + .note { | |
| 5 | + @extend %note; | |
| 6 | + | |
| 7 | + h5 { | |
| 8 | + margin-top: 0.25em; | |
| 9 | + } | |
| 10 | + | |
| 11 | + position: relative; | |
| 12 | + &::after { | |
| 13 | + content: attr(data-type); | |
| 14 | + opacity: 0.5; | |
| 15 | + text-transform: uppercase; | |
| 16 | + position: absolute; | |
| 17 | + top: 0.25em; | |
| 18 | + right: 0.5em; | |
| 19 | + font-size: 0.8em; | |
| 20 | + pointer-events: none; | |
| 21 | + } | |
| 22 | + | |
| 23 | + // Other note types currently unstyled: | |
| 24 | + // plain | |
| 25 | + // tip | |
| 26 | + // feature | |
| 27 | + &.note-info { @extend %note-blue; } | |
| 28 | + &.note-warning { @extend %note-red; } | |
| 29 | + &.note-unreleased { @extend %note-orange; } | |
| 30 | + } | |
| 31 | + | |
| 32 | + pre { | |
| 33 | + font-size: inherit; | |
| 34 | + } | |
| 35 | +} | |
| @@ -0,0 +1,55 @@ | ||
| 1 | +module Docs | |
| 2 | + class Jekyll | |
| 3 | + class CleanHtmlFilter < Filter | |
| 4 | + def call | |
| 5 | + css('.improve, .section-nav').each(&:remove) | |
| 6 | + | |
| 7 | + css('div.highlighter-rouge').each do |node| | |
| 8 | + pre = node.at_css('pre') | |
| 9 | + | |
| 10 | + # copy over the highlighting metadata | |
| 11 | + match = /language-(\w+)/.match(node['class']) | |
| 12 | + # HACK: Prism shell highlighting highlights `|`, | |
| 13 | + # which makes the tree on this page look terrible | |
| 14 | + if match && !(slug == /structure/ && match[1] == 'sh') | |
| 15 | + lang = match[1] | |
| 16 | + if lang == 'sh' | |
| 17 | + lang = 'bash' | |
| 18 | + elsif lang == 'liquid' | |
| 19 | + lang = 'django' # Close enough. | |
| 20 | + end | |
| 21 | + pre['class'] = nil | |
| 22 | + pre['data-language'] = lang | |
| 23 | + end | |
| 24 | + | |
| 25 | + # Remove the server-rendered syntax highlighting | |
| 26 | + code = pre.at_css('code') | |
| 27 | + code.content = code.text | |
| 28 | + | |
| 29 | + # Remove the div.highlighter-rouge and div.highlight wrapping the <pre> | |
| 30 | + node.add_next_sibling pre | |
| 31 | + node.remove | |
| 32 | + end | |
| 33 | + | |
| 34 | + css('code').each do |node| | |
| 35 | + node['class'] = '' | |
| 36 | + end | |
| 37 | + | |
| 38 | + css('.note').each do |node| | |
| 39 | + node_type = /note ?(\w+)?/.match(node['class'])[1] || 'tip' | |
| 40 | + | |
| 41 | + # <div class="note">...<br>...</div> -> <div class="note">...</div> | |
| 42 | + (node > 'br').each(&:remove) | |
| 43 | + # <div class="note">...<p>...<br><br>...</p>...</div> -> | |
| 44 | + # <div class="note">...<p>...<br>...</p>...</div> | |
| 45 | + node.css('br + br').each(&:remove) | |
| 46 | + | |
| 47 | + node['class'] = "note note-#{node_type}" | |
| 48 | + node['data-type'] = node_type | |
| 49 | + end | |
| 50 | + | |
| 51 | + doc | |
| 52 | + end | |
| 53 | + end | |
| 54 | + end | |
| 55 | +end | |
| @@ -0,0 +1,29 @@ | ||
| 1 | +module Docs | |
| 2 | + class Jekyll | |
| 3 | + class EntriesFilter < Docs::EntriesFilter | |
| 4 | + | |
| 5 | + def get_name | |
| 6 | + at_css('h1').content | |
| 7 | + end | |
| 8 | + | |
| 9 | + def get_type | |
| 10 | + if /continuous-integration/.match(slug) | |
| 11 | + 'Deployment' | |
| 12 | + else | |
| 13 | + nav_link = doc.document # document | |
| 14 | + .at_css('aside li.current') # item in navbar | |
| 15 | + | |
| 16 | + if nav_link | |
| 17 | + nav_link | |
| 18 | + .parent # <ul> in navbar | |
| 19 | + .previous_element # header before <ul> | |
| 20 | + .content # category | |
| 21 | + else | |
| 22 | + 'Miscellaneous' | |
| 23 | + end | |
| 24 | + end | |
| 25 | + end | |
| 26 | + | |
| 27 | + end | |
| 28 | + end | |
| 29 | +end | |
| @@ -0,0 +1,34 @@ | ||
| 1 | +module Docs | |
| 2 | + class Jekyll < UrlScraper | |
| 3 | + self.type = 'jekyll' | |
| 4 | + self.release = '3.6.2' | |
| 5 | + self.base_url = 'https://jekyllrb.com/docs/' | |
| 6 | + self.root_path = 'home/' | |
| 7 | + self.links = { | |
| 8 | + home: 'https://jekyllrb.com/', | |
| 9 | + code: 'https://github.com/jekyll/jekyll' | |
| 10 | + } | |
| 11 | + | |
| 12 | + html_filters.push 'jekyll/clean_html', 'jekyll/entries' | |
| 13 | + | |
| 14 | + options[:trailing_slash] = true | |
| 15 | + options[:container] = 'article' | |
| 16 | + options[:skip] = [ | |
| 17 | + '', | |
| 18 | + '/' | |
| 19 | + ] | |
| 20 | + options[:skip_patterns] = [ | |
| 21 | + /conduct/, | |
| 22 | + /history/, | |
| 23 | + /maintaining/, | |
| 24 | + /contributing/ | |
| 25 | + ] | |
| 26 | + options[:attribution] = <<-HTML | |
| 27 | + © 2008–2017 Tom Preston-Werner and Jekyll contributors<br /> | |
| 28 | + Licensed under | |
| 29 | + <a href="https://github.com/jekyll/jekyll/blob/master/LICENSE"> | |
| 30 | + the MIT license | |
| 31 | + </a> | |
| 32 | + HTML | |
| 33 | + end | |
| 34 | +end | |
Binary file not shown.
Binary file not shown.
| @@ -0,0 +1 @@ | ||
| 1 | +https://avatars3.githubusercontent.com/u/3083652 | |