mirror of https://github.com/freeCodeCamp/devdocs
parent
f53e74f9b8
commit
09eea66d57
@ -0,0 +1,81 @@
|
||||
._nim {
|
||||
@extend %simple;
|
||||
|
||||
@if $style == 'dark' {
|
||||
span.DecNumber { color: #AE81FF; }
|
||||
span.BinNumber { color: #AE81FF; }
|
||||
span.HexNumber { color: #AE81FF; }
|
||||
span.OctNumber { color: #AE81FF; }
|
||||
span.FloatNumber { color: #AE81FF; }
|
||||
span.Identifier { color: #F8F8F2; }
|
||||
span.Keyword { font-weight: 600; color: #F92672; }
|
||||
span.StringLit { color: #E6DB74; }
|
||||
span.LongStringLit { color: #E6DB74; }
|
||||
span.CharLit { color: #E6DB74; }
|
||||
span.EscapeSequence { color: white; }
|
||||
span.Operator { color: white; }
|
||||
span.Punctuation {color: white; }
|
||||
span.Comment, span.LongComment {
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
color: #75715E; }
|
||||
|
||||
span.RegularExpression { color: darkviolet; }
|
||||
span.TagStart { color: #F92672; }
|
||||
span.TagEnd { color: #F92672; }
|
||||
span.Key { color: #AE81FF; }
|
||||
span.Value { color: #AE81FF; }
|
||||
span.RawData { color: #a4255b; }
|
||||
span.Assembler { color: #AE81FF; }
|
||||
span.Preprocessor { color: #AE81FF; }
|
||||
span.Directive { color: #AE81FF; }
|
||||
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other { color: white; }
|
||||
|
||||
/* Pop type, const, proc, and iterator defs in nim def blocks */
|
||||
dt pre > span.Identifier, dt pre > span.Operator { color: #529B2F; font-weight: 700; }
|
||||
} @else {
|
||||
span.DecNumber { color: #252dbe; }
|
||||
span.BinNumber { color: #252dbe; }
|
||||
span.HexNumber { color: #252dbe; }
|
||||
span.OctNumber { color: #252dbe; }
|
||||
span.FloatNumber { color: #252dbe; }
|
||||
span.Identifier { color: #3b3b3b; }
|
||||
span.Keyword { font-weight: 600; color: #5e8f60; }
|
||||
span.StringLit { color: #a4255b; }
|
||||
span.LongStringLit { color: #a4255b; }
|
||||
span.CharLit { color: #a4255b; }
|
||||
span.EscapeSequence { color: black; }
|
||||
span.Operator { color: black; }
|
||||
span.Punctuation {color: black; }
|
||||
span.Comment, span.LongComment {
|
||||
font-style: italic;
|
||||
font-weight: 400;
|
||||
color: #484a86; }
|
||||
|
||||
span.RegularExpression { color: darkviolet; }
|
||||
span.TagStart { color: darkviolet; }
|
||||
span.TagEnd { color: darkviolet; }
|
||||
span.Key { color: #252dbe; }
|
||||
span.Value { color: #252dbe; }
|
||||
span.RawData { color: #a4255b; }
|
||||
span.Assembler { color: #252dbe; }
|
||||
span.Preprocessor { color: #252dbe; }
|
||||
span.Directive { color: #252dbe; }
|
||||
|
||||
span.Command, span.Rule, span.Hyperlink, span.Label, span.Reference,
|
||||
span.Other { color: black; }
|
||||
|
||||
/* Pop type, const, proc, and iterator defs in nim def blocks */
|
||||
dt pre > span.Identifier, dt pre > span.Operator { color: #155da4; font-weight: 700; }
|
||||
}
|
||||
dt pre > span.Identifier ~ span.Identifier, dt pre > span.Operator ~ span.Identifier {
|
||||
color: inherit;
|
||||
font-weight: inherit; }
|
||||
|
||||
dt pre > span.Operator ~ span.Identifier, dt pre > span.Operator ~ span.Operator {
|
||||
color: inherit;
|
||||
font-weight: inherit; }
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
module Docs
|
||||
class Nim
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
@doc = at_css('#documentId .container')
|
||||
|
||||
css('.docinfo').remove
|
||||
|
||||
content = at_css('#content')
|
||||
if content != nil
|
||||
at_css('#content').remove_attribute('class')
|
||||
@doc.add_child(at_css('#content').inner_html)
|
||||
end
|
||||
|
||||
css('> div.row').remove
|
||||
|
||||
css('pre').each do |node|
|
||||
node['data-language'] = 'nim'
|
||||
end
|
||||
|
||||
# remove link from headers
|
||||
css('h1 > a', 'h2 > a', 'h3 > a', 'h4 > a').each do |node|
|
||||
node.parent['id'] = node['id']
|
||||
node.parent.content = node.content
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,51 @@
|
||||
module Docs
|
||||
class Nim
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_type
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def get_name
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
entries = []
|
||||
if get_name.start_with? 'Module '
|
||||
module_name = get_name[7..-1]
|
||||
css('div .section').map do |node|
|
||||
section_node = node.at_css('h1 a')
|
||||
if section_node != nil
|
||||
section_name = section_node.content.strip
|
||||
items_node = node.at_css('dl.item')
|
||||
if items_node != nil
|
||||
items_node.css('dt a').map do |item_node|
|
||||
item_name = item_node['name']
|
||||
if item_name.include? ','
|
||||
item_name = item_name.sub(',', '(') + ')'
|
||||
end
|
||||
entries << [module_name + '.' + item_name, item_node.parent['id']]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
css('h1', 'h2', 'h3').map do |node|
|
||||
id = node['id']
|
||||
name = node.content.strip
|
||||
if id != nil
|
||||
entries << [name, id]
|
||||
else
|
||||
a = node.at_css('a')
|
||||
if a != nil
|
||||
id = a['id']
|
||||
entries << [name, id]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,21 @@
|
||||
module Docs
|
||||
class Nim < UrlScraper
|
||||
self.type = 'nim'
|
||||
self.release = '0.17.0'
|
||||
self.links = {
|
||||
home: 'https://nim-lang.org/',
|
||||
code: 'https://github.com/nim-lang/Nim'
|
||||
}
|
||||
self.base_url = 'https://nim-lang.org/'
|
||||
self.root_path = 'docs/overview.html'
|
||||
|
||||
html_filters.push 'nim/entries', 'nim/clean_html'
|
||||
|
||||
options[:skip] = %w(cdn-cgi/l/email-protection docs/theindex.html docs/docgen.txt)
|
||||
options[:attribution] = <<-HTML
|
||||
© 2006–2017 Andreas Rumpf<br>
|
||||
All rights reserved. Licensed under the MIT License.
|
||||
HTML
|
||||
|
||||
end
|
||||
end
|
After Width: | Height: | Size: 789 B |
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1 @@
|
||||
https://nim-lang.org/assets/img/logo.svg
|
Loading…
Reference in new issue