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
44 dt { @extend %block-label, %label-blue; }
55 .todo { @extend %note, %note-red; }
66 }
7+
8+svg {
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
55 EMPTY_NODES_RGX = /<(?!td|th|iframe|mspace)(\w+)[^>]*>[[:space:]]*<\/\1>/
66
77 def call
8+ return html if context[:clean_text] == false
89 html.strip!
910 while html.gsub!(EMPTY_NODES_RGX, ''); end
1011 html
lib/docs/filters/sqlite/clean_html.rb+21−2
@@ -7,13 +7,14 @@ module Docs · 6 unmodified lines
77 css('.rightsidebar', 'hr', '.sh_mark', '.fancy_toc > a', '.fancy_toc_mark', 'h[style*="none"]',
88 'a[href$="intro.html"] > h2', 'a[href$="intro"] > h2', '#document_title + #toc_header',
99 '#document_title ~ #toc').remove
10+ css('a[href$="intro.html"]:empty', 'a[href$="intro"]:empty').remove
1011
1112 css('.fancy_title', '> h2[align=center]', '#document_title').each do |node|
1213 node.name = 'h1'
1314 end
1415
1516 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]
1718 at_css('h2').name = 'h1'
1819 else
1920 doc.child.before("<h1>#{context[:html_title]}</h1>")
@@ -81,8 +82,26 @@ module Docs · 61 unmodified lines
8182 node.remove_attribute('onclick')
8283 end
8384
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')
85101 css('*[style]:not(.imgcontainer)').remove_attr('style')
102+ css('.imgcontainer').remove_class('imgcontainer')
103+
104+ css('*[align]').remove_attr('align')
86105 css('table[border]').remove_attr('border')
87106
88107 doc
lib/docs/scrapers/sqlite.rb+2−1
@@ -2,7 +2,7 @@ module Docs · 1 unmodified line
22 class Sqlite < FileScraper
33 self.name = 'SQLite'
44 self.type = 'sqlite'
5− self.release = '3.33.0'
5+ self.release = '3.34.0'
66 self.base_url = 'https://sqlite.org/'
77 self.root_path = 'docs.html'
88 self.initial_paths = %w(keyword_index.html)
@@ -14,6 +14,7 @@ module Docs · 5 unmodified lines
1414 html_filters.insert_before 'clean_html', 'sqlite/clean_js_tables'
1515 html_filters.push 'sqlite/entries', 'sqlite/clean_html'
1616
17+ options[:clean_text] = false # keep SVG elements
1718 options[:only_patterns] = [/\.html\z/]
1819 options[:skip_patterns] = [/releaselog/, /consortium/]
1920 options[:skip] = %w(