]> git.nbdom.net Git - nb.git/commitdiff
lib/postgres/html_width.sql
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 21 Jun 2018 22:49:39 +0000 (23:49 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 21 Jun 2018 22:49:39 +0000 (23:49 +0100)
lib/postgres/html_attribute.sql
lib/postgres/html_width.sql [new file with mode: 0644]

index aabb2185049eed0327e58fc23db21b72d36be784..dde3d17e3007ac727612eb34cb4f0ccdc7a4bb62 100644 (file)
@@ -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)[^.>]+>([^<]+)</\1>,<div>\2</div>," | \
 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 (file)
index 0000000..92153d9
--- /dev/null
@@ -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;