History

Merge pull request #1492 from freeCodeCamp/sqlite-3.34

Update SQLite documentation (3.34.0)

Simon Legner committed 5 years ago

Commit be1ec852 parents a86b914 b5bc2e04 files · +30 −3Browse files

Unified · Split

4 files
  1. assets/stylesheets/pages/_sqlite.scss +6 −0
  2. lib/docs/filters/core/clean_text.rb +1 −0
  3. lib/docs/filters/sqlite/clean_html.rb +21 −2
  4. lib/docs/scrapers/sqlite.rb +2 −1
assets/stylesheets/pages/_sqlite.scss+6−0
@@ -4,3 +4,9 @@ · 3 unmodified lines
4 dt { @extend %block-label, %label-blue; }4 dt { @extend %block-label, %label-blue; }
5 .todo { @extend %note, %note-red; }5 .todo { @extend %note, %note-red; }
6}6}
7
8svg {
9 text.fill { fill: var(--textColor); }
10 .fill { fill: var(--textColorLighter); }
11 .stroke { fill: none; stroke-width: 2.16; stroke: var(--textColorLighter); }
12}
lib/docs/filters/core/clean_text.rb+1−0
@@ -5,6 +5,7 @@ module Docs · 4 unmodified lines
5 EMPTY_NODES_RGX = /<(?!td|th|iframe|mspace)(\w+)[^>]*>[[:space:]]*<\/\1>/5 EMPTY_NODES_RGX = /<(?!td|th|iframe|mspace)(\w+)[^>]*>[[:space:]]*<\/\1>/
6 6
7 def call7 def call
8 return html if context[:clean_text] == false
8 html.strip!9 html.strip!
9 while html.gsub!(EMPTY_NODES_RGX, ''); end10 while html.gsub!(EMPTY_NODES_RGX, ''); end
10 html11 html
lib/docs/filters/sqlite/clean_html.rb+21−2
@@ -7,13 +7,14 @@ module Docs · 6 unmodified lines
7 css('.rightsidebar', 'hr', '.sh_mark', '.fancy_toc > a', '.fancy_toc_mark', 'h[style*="none"]',7 css('.rightsidebar', 'hr', '.sh_mark', '.fancy_toc > a', '.fancy_toc_mark', 'h[style*="none"]',
8 'a[href$="intro.html"] > h2', 'a[href$="intro"] > h2', '#document_title + #toc_header',8 'a[href$="intro.html"] > h2', 'a[href$="intro"] > h2', '#document_title + #toc_header',
9 '#document_title ~ #toc').remove9 '#document_title ~ #toc').remove
10 css('a[href$="intro.html"]:empty', 'a[href$="intro"]:empty').remove
10 11
11 css('.fancy_title', '> h2[align=center]', '#document_title').each do |node|12 css('.fancy_title', '> h2[align=center]', '#document_title').each do |node|
12 node.name = 'h1'13 node.name = 'h1'
13 end14 end
14 15
15 unless at_css('h1')16 unless at_css('h1')
16 if at_css('h2').content == context[:html_title]17 if at_css('h2') && at_css('h2').content == context[:html_title]
17 at_css('h2').name = 'h1'18 at_css('h2').name = 'h1'
18 else19 else
19 doc.child.before("<h1>#{context[:html_title]}</h1>")20 doc.child.before("<h1>#{context[:html_title]}</h1>")
@@ -81,8 +82,26 @@ module Docs · 61 unmodified lines
81 node.remove_attribute('onclick')82 node.remove_attribute('onclick')
82 end83 end
83 84
84 css('*[align]').remove_attr('align')85 css('svg *[style], svg *[fill]').each do |node|
86 # transform style in SVG diagrams, e.g. on https://sqlite.org/lang_insert.html
87 if node['style'] == 'fill:rgb(0,0,0)' or node['fill'] == 'rgb(0,0,0)'
88 node.add_class('fill')
89 node.remove_attribute('fill')
90 elsif node['style'] == 'fill:none;stroke-width:2.16;stroke:rgb(0,0,0);'
91 node.add_class('stroke')
92 elsif node['style'] == 'fill:none;stroke-width:3.24;stroke:rgb(211,211,211);'
93 node.add_class('stroke')
94 elsif node['style']
95 raise NotImplementedError, "SVG style #{node['style']}"
96 end
97 node.remove_attribute('style')
98 end
99
100 css('.imgcontainer > div[style]').add_class('imgcontainer')
85 css('*[style]:not(.imgcontainer)').remove_attr('style')101 css('*[style]:not(.imgcontainer)').remove_attr('style')
102 css('.imgcontainer').remove_class('imgcontainer')
103
104 css('*[align]').remove_attr('align')
86 css('table[border]').remove_attr('border')105 css('table[border]').remove_attr('border')
87 106
88 doc107 doc
lib/docs/scrapers/sqlite.rb+2−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
2 class Sqlite < FileScraper2 class Sqlite < FileScraper
3 self.name = 'SQLite'3 self.name = 'SQLite'
4 self.type = 'sqlite'4 self.type = 'sqlite'
5 self.release = '3.33.0'5 self.release = '3.34.0'
6 self.base_url = 'https://sqlite.org/'6 self.base_url = 'https://sqlite.org/'
7 self.root_path = 'docs.html'7 self.root_path = 'docs.html'
8 self.initial_paths = %w(keyword_index.html)8 self.initial_paths = %w(keyword_index.html)
@@ -14,6 +14,7 @@ module Docs · 5 unmodified lines
14 html_filters.insert_before 'clean_html', 'sqlite/clean_js_tables'14 html_filters.insert_before 'clean_html', 'sqlite/clean_js_tables'
15 html_filters.push 'sqlite/entries', 'sqlite/clean_html'15 html_filters.push 'sqlite/entries', 'sqlite/clean_html'
16 16
17 options[:clean_text] = false # keep SVG elements
17 options[:only_patterns] = [/\.html\z/]18 options[:only_patterns] = [/\.html\z/]
18 options[:skip_patterns] = [/releaselog/, /consortium/]19 options[:skip_patterns] = [/releaselog/, /consortium/]
19 options[:skip] = %w(20 options[:skip] = %w(