if ($mime == 'text/plain') {
if ($v = self::html_video($str)) return $v;
+ elseif($v = preg_replace_callback(',(\w+://\S+),',function($v){
+ return '<a target="_blank" href="'.$v[1].'">'.htmlentities($v[1]).'</a>';
+ },$str) and $str != $v) return $v;
+ #else preg_replace(',(\w+://\S+),e','<a href="$1">'.htmlentities('$1').'</a>',$str);
+
} elseif (preg_match('@^image/@',$mime)) {
return self::html_img_data($str);
--- /dev/null
+DROP TABLE IF EXISTS css_reference;
+CREATE TABLE IF NOT EXISTS css_reference (
+ name varchar(200) PRIMARY KEY,
+ description varchar(500),
+ link varchar(300)
+);
+BEGIN TRANSACTION;
+DELETE FROM css_reference;
+COPY css_reference (name,description,link) FROM PROGRAM '. /etc/profile && html2txt https://www.w3schools.com/cssref/ | perl -ne " \
+next unless /^align-content .*Specifies/ .. /^z-index/ and /^[a-z]/; \
+s/\s+/\t/; \
+chomp; /^(\S+)/; \
+print qq|\$_\thttps://www.w3schools.com/cssref/css3_pr_\$1.asp\n|" \
+' WITH (format 'text', NULL '');
+COMMIT;
#
#
set +e
-cd "$(dirname "$0")" && (
+cd "$(dirname "$0")"
+
+# Get existing tables, we don't want everything
+tables=$(
+sqlite3 "nb.db" ".tab" | sed -E 's/\s+/\n/g' | sort -u | grep -v '^$' | tr "\n" ","
+)
+tables=${tables%,*}
+#echo $tables; exit
+
+[ -n "$tables" ] && (
echo 'PRAGMA encoding="UTF-8";'
echo 'PRAGMA foreign_keys=OFF;'
- nb_api '/pub/dump/sqlite?table-name=!~^(zipcode|geo|meta)'
+ nb_api "/pub/dump/sqlite?table-name=$tables"
echo 'VACUUM;'
) | sqlite3 "nb.db"