Ver código fonte

D documentation was added.

antlord 8 anos atrás
pai
commit
bc8d9432c3

+ 1 - 0
assets/stylesheets/application-dark.css.scss

@@ -44,6 +44,7 @@
         'pages/coffeescript',
         'pages/cordova',
         'pages/crystal',
+        'pages/d',
         'pages/d3',
         'pages/dojo',
         'pages/drupal',

+ 1 - 0
assets/stylesheets/application.css.scss

@@ -44,6 +44,7 @@
         'pages/coffeescript',
         'pages/cordova',
         'pages/crystal',
+        'pages/d',
         'pages/d3',
         'pages/dojo',
         'pages/drupal',

+ 44 - 0
assets/stylesheets/pages/_d.scss

@@ -0,0 +1,44 @@
+._d {
+  > .description, > .documentation-section { padding-left: 1rem; }
+  > .description > h2, header > h3, > h2 { @extend %block-heading; }
+  .description > h1 { font-size: 1rem; }
+  .method-description > h2, h3, h4, h5, h6 { font-size: 1em; }
+
+  .d_decl {
+    font-weight: $boldFontWeight;
+    @extend %block-label, %label-blue;
+
+    + .d_decl { margin-top: -.5em; }
+  }
+
+  > .meta {
+    @extend %note, %note-blue;
+
+    > dd { margin: 0; }
+    > dd + dt { margin-top: .5em; }
+  }
+
+  a.method-click-advice {
+    float: right;
+    font-size: .75rem;
+    color: $linkColor;
+    cursor: pointer;
+    @extend %user-select-none;
+
+    &:hover { text-decoration: underline; }
+  }
+
+  .method-description { position: relative; }
+
+  .method-source-code {
+    display: none;
+    position: absolute;
+    z-index: 1;
+    top: 0;
+    right: 0;
+    background: rgba($contentBackground, .95);
+    box-shadow: 0 1em 1em 1em $contentBackground;
+
+    > pre { margin: 0; }
+  }
+}

+ 12 - 0
lib/docs/filters/d/clean_html.rb

@@ -0,0 +1,12 @@
+module Docs
+  class D
+    class CleanHtmlFilter < Filter
+      def call
+        css('.d_decl > div > span.def-anchor').each do |node|
+          node.parent.parent['id'] = node['id']
+        end
+        doc
+      end
+    end
+  end
+end

+ 27 - 0
lib/docs/filters/d/entries.rb

@@ -0,0 +1,27 @@
+module Docs
+  class D
+    class EntriesFilter < Docs::EntriesFilter
+      def get_name
+        slug.to_s.gsub('_', '.').gsub('/', '.').squish!
+      end
+
+      def get_type
+        slug.to_s.sub(/_(.*)/, '')
+      end
+
+      def additional_entries
+        names = []
+        css('.book > tr > td > a').each do |x|
+          span_block = x.at_css('span')
+          if span_block != nil
+            elem_name = span_block.text
+            name = "#{get_name}.#{elem_name}"
+            type = name.sub(/\..*/,'')
+            names << [name, "#{slug}#{x['href']}", type]
+          end
+        end
+        names
+      end
+    end
+  end
+end

+ 18 - 0
lib/docs/scrapers/d.rb

@@ -0,0 +1,18 @@
+module Docs
+  class D < UrlScraper
+    self.release = '2.075.1'
+    self.type = 'd'
+    self.base_url = 'http://dlang.org/phobos/'
+
+    html_filters.push 'd/entries', 'd/clean_html'
+
+    options[:container] = '#content'
+    options[:title] = false
+    options[:root_title] = 'D Language'
+    options[:skip_patterns] = [/#.*/]
+
+    options[:attribution] = <<-HTML
+      Copyright &copy; 1999-2017 by the D Language Foundation
+    HTML
+  end
+end

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


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