Pārlūkot izejas kodu

Finish Bash scraper

Thibaut Courouble 7 gadi atpakaļ
vecāks
revīzija
a71f48ea10

BIN
assets/images/docs-2.png


BIN
assets/images/docs-2@2x.png


+ 1 - 1
assets/javascripts/news.json

@@ -1,7 +1,7 @@
 [
   [
     "2018-07-29",
-    "New documentation: <a href=\"/pygame/\">Pygame</a>"
+    "New documentations: <a href=\"/bash/\">Bash</a> and <a href=\"/pygame/\">Pygame</a>"
   ], [
     "2018-07-08",
     "New documentations: <a href=\"/leaflet/\">Leaflet</a>, <a href=\"/terraform/\">Terraform</a> and <a href=\"/koa/\">Koa</a>"

+ 1 - 0
assets/stylesheets/global/_icons.scss

@@ -174,3 +174,4 @@
 ._icon-leaflet:before       { background-position: -3rem -3rem; @extend %doc-icon-2; }
 ._icon-terraform:before     { background-position: -4rem -3rem; @extend %doc-icon-2; }
 ._icon-pygame:before        { background-position: -5rem -3rem; @extend %doc-icon-2; }
+._icon-bash:before          { background-position: -6rem -3rem; @extend %doc-icon-2; }

+ 4 - 14
assets/stylesheets/pages/_bash.scss

@@ -1,22 +1,12 @@
 ._bash {
-  // The page title is always the first element on the page, but not always the same type of element
-  // The exception is the homepage, where the links element comes first
-  > *:first-child:not(._links) {
-    @extend h1;
-    @extend %lined-heading;
-  }
-
   dl > dt > code,
   dl > dt > kbd {
-    @extend %note, %note-blue;
-    display: block;
-    padding: 1px 7px 2px 7px;
-    margin: 28px 0 14px 0;
-    font-weight: bold;
-    font-family: $baseFont;
+    @extend %block-label, %label-blue;
   }
 
   th[align=left] {
-    border-left: 1px solid #d8d8d8;
+    border-left: 1px solid $boxBorder;
   }
+
+  code { @extend %label; }
 }

+ 11 - 0
lib/docs/filters/bash/clean_html.rb

@@ -11,6 +11,7 @@ module Docs
         # Remove chapter and section numbers from title
         title_node = at_css('h1, h2, h3, h4, h5, h6')
         title_node.content = title_node.content.gsub(/(\d+\.?)+/, '').strip
+        title_node.name = 'h1'
 
         # Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
         title_node.content = title_node.content[3..-1] if title_node.content.start_with?("D. ")
@@ -56,6 +57,16 @@ module Docs
           node.children = link unless link.nil?
         end
 
+        css('tt', 'code', 'table').remove_attr('class')
+
+        css('tt').each do |node|
+          node.name = 'code'
+        end
+
+        css('pre').each do |node|
+          node.content = node.content
+        end
+
         doc
       end
     end

BIN
public/icons/docs-2.pxm


BIN
public/icons/docs-2@2x.pxm


BIN
public/icons/docs/bash/16.png


BIN
public/icons/docs/bash/16@2x.png