X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/odin-cgi/blobdiff_plain/795ac774f8b37658f0d0c07523bc1acdab9a02f1..2322e7a8a1ebfe0f9b64a0af50d90cf4feac8a6b:/bin/populate-lang-table?ds=inline diff --git a/bin/populate-lang-table b/bin/populate-lang-table index a5b6bee..64526b3 100755 --- a/bin/populate-lang-table +++ b/bin/populate-lang-table @@ -1,4 +1,27 @@ #! /usr/bin/perl +### +### Setup program for Odin services +### +### (c) 2015 Mark Wooding +### + +###----- Licensing notice --------------------------------------------------- +### +### This file is part of the `odin.gg' service, `odin-cgi'. +### +### `odin-cgi' is free software; you can redistribute it and/or modify +### it under the terms of the GNU Affero General Public License as +### published by the Free Software Foundation; either version 3 of the +### License, or (at your option) any later version. +### +### `odin-cgi' is distributed in the hope that it will be useful, +### but WITHOUT ANY WARRANTY; without even the implied warranty of +### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +### GNU Affero General Public License for more details. +### +### You should have received a copy of the GNU Affero General Public +### License along with `odin-cgi'; if not, see +### . use lib "lib"; use Odin; @@ -9,11 +32,12 @@ my %newlang, %oldlang; open my $fh, "-|", "highlight", "-p" or die "highlight: $!"; while (<$fh>) { my ($descr, $lang) = /^(.*\S)\s*:\s*(\S+)(?:\s.*|)$/; - next unless defined $lang; - $newlang{$lang} = $descr; + next if !defined $lang or $lang eq "txt"; + $newlang{"hl:$lang"} = $descr; } close $fh or die "close highlight: $! $?"; -$newlang{"txt"} //= "Plain text"; +$newlang{"txt"} = "Plain text"; +$newlang{"md"} = "Markdown"; Odin::xact { my $h = $db->selectall_hashref