Skip to content

Commit be1ec85

Browse files
authored
Merge pull request #1492 from freeCodeCamp/sqlite-3.34
Update SQLite documentation (3.34.0)
2 parents a86b914 + b5bc2e0 commit be1ec85

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

assets/stylesheets/pages/_sqlite.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class CleanTextFilter < Filter
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

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ def call
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 @@ def call
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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Docs
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 @@ class Sqlite < FileScraper
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(

0 commit comments

Comments
 (0)