From: Nicolas Boisselier Date: Thu, 21 Jun 2018 22:49:39 +0000 (+0100) Subject: lib/postgres/html_width.sql X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=f17025d9288c2e6298ed89666ca75df6afc32346;p=nb.git lib/postgres/html_width.sql --- diff --git a/lib/postgres/html_attribute.sql b/lib/postgres/html_attribute.sql index aabb2185..dde3d17e 100644 --- a/lib/postgres/html_attribute.sql +++ b/lib/postgres/html_attribute.sql @@ -4,16 +4,15 @@ CREATE TABLE IF NOT EXISTS html_attribute ( description varchar(500), link varchar(200) ); -BEGIN TRANSACTION; DELETE FROM html_attribute; +BEGIN; COPY html_attribute (link,name,description) FROM PROGRAM '. /etc/profile && \ http_get https://html.com/attributes/ | \ sed -E "s,<(thrive_headline|header)[^.>]+>([^<]+),
\2
," | \ xmllint --html --xpath //table - 2>/dev/null | \ xml2csv - | \ sed -E \ - -e "s/”/\"/g" -e "s,^[^<]+(<[^>]+>)[^\t]+,\L\1," \ - -e "s,^(<([^ ]+) ([^=>]+)),https://html.com/attributes/\2-\3/\t\1," \ -' WITH (format 'text', NULL ''); + -e "s/”/\"/g" -e "s,^[^<]+(<[^>]+>)[^\t]+,\L\1," \ + -e "s,^(<([^ ]+) ([^=>]+)),https://html.com/attributes/\2-\3/\t\1," \ +' WITH (format 'text', NULL ''); COMMIT; - diff --git a/lib/postgres/html_width.sql b/lib/postgres/html_width.sql new file mode 100644 index 00000000..92153d9d --- /dev/null +++ b/lib/postgres/html_width.sql @@ -0,0 +1,16 @@ +DROP TABLE IF EXISTS html_width; +CREATE TABLE IF NOT EXISTS html_width ( + px smallint PRIMARY KEY, + name varchar(50) +); +BEGIN TRANSACTION; +DELETE FROM html_width; +COPY html_width FROM STDIN WITH (format 'text', NULL ''); +320 Mobile portrait +480 Mobile landscape +600 Small tablet +768 Tablet portrait +1024 Tablet landscape/Netbook +1280 Desktop +\. +COMMIT;