From 7e17853326f89adf5f812b7ac28667930067e32c Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 3 Oct 2016 20:04:23 +0200 Subject: [PATCH] Remove HTML-formatted man pages --- sql/update-2016-10-03.sql | 4 ++++ util/add_dir.pl | 1 + www/man.js | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 sql/update-2016-10-03.sql diff --git a/sql/update-2016-10-03.sql b/sql/update-2016-10-03.sql new file mode 100644 index 0000000..68605d2 --- /dev/null +++ b/sql/update-2016-10-03.sql @@ -0,0 +1,4 @@ +-- This check is not consistent with the HTML-check in util/add_dir.pl, but it +-- happens to match exactly the same man pages currently. +DELETE FROM man WHERE section = 'html'; +DELETE FROM contents c WHERE NOT EXISTS(SELECT 1 FROM man m WHERE m.hash = c.hash); diff --git a/util/add_dir.pl b/util/add_dir.pl index e905ff3..7ab29b0 100755 --- a/util/add_dir.pl +++ b/util/add_dir.pl @@ -125,6 +125,7 @@ sub addman { my($enc, $dec) = decodeman($dat, $locale); print "Invalid encoding or empty file: $path\n" and return if !$enc; + print "Ignoring HTML-formatted page: $path\n" and return if $dec =~ /^\s*<(?:html|head|\!DOCTYPE)/; $db->do(q{INSERT INTO contents (hash, content) VALUES(decode(?, 'hex'),?)}, {}, $hash, $dec) if !$db->selectrow_arrayref(q{SELECT 1 FROM contents WHERE hash = decode(?, 'hex')}, {}, $hash); diff --git a/www/man.js b/www/man.js index ad1ff68..788523b 100644 --- a/www/man.js +++ b/www/man.js @@ -296,7 +296,7 @@ dsInit(byId('q'), '/xml/search.xml?q=', function(item, tr) { }, function(item) { searchRedir = true; - location.href = '/'+item.getAttribute('name')+'.'+item.getAttribute('section').substr(0,1); + location.href = '/'+item.getAttribute('name')+'.'+item.getAttribute('section'); return item.getAttribute('name')+'('+item.getAttribute('section')+')'; }, function() {