From: Mischa POSLAWSKY Date: Fri, 29 May 2020 05:14:37 +0000 (+0200) Subject: word: restrict by priority level X-Git-Tag: v1.13~242 X-Git-Url: http://git.shiar.net/sheet.git/commitdiff_plain/5d52e8a4f389cd87b310c609ec76c9ba339284f6 word: restrict by priority level Default to commonly known concepts (level 3) unless overridden by ?v. --- diff --git a/tools/mkwordlist b/tools/mkwordlist index d4dfaa2..5e965fe 100755 --- a/tools/mkwordlist +++ b/tools/mkwordlist @@ -1,4 +1,4 @@ #!/bin/sh psql sheet -XAt -c " SELECT json_object_agg(coalesce(form, ''), forms) FROM _cat_words -" | sed 's/:/=>/g' +" | sed 's/ : / => /g' diff --git a/tools/word.pg.sql b/tools/word.pg.sql index 22ff113..1dc4f5b 100644 --- a/tools/word.pg.sql +++ b/tools/word.pg.sql @@ -25,7 +25,10 @@ COMMENT ON COLUMN word.thumb IS 'ImageMagick convert options to create thum COMMENT ON COLUMN word.wptitle IS 'reference Wikipedia article'; CREATE OR REPLACE FUNCTION exportform(word) RETURNS text AS $$ - SELECT (CASE WHEN $1.cover THEN '*' ELSE '' END) || array_to_string($1.form || $1.alt, '/'); + SELECT concat( + $1.prio || CASE WHEN $1.cover THEN 'c' ELSE '' END || ':', + array_to_string($1.form || $1.alt, '/') + ); $$ LANGUAGE SQL IMMUTABLE; CREATE OR REPLACE VIEW _cat_words AS diff --git a/word.plp b/word.plp index dd5985a..ac596b5 100644 --- a/word.plp +++ b/word.plp @@ -1,6 +1,8 @@ <(common.inc.plp)><: my $wordlist = 'wordlist.eng.inc.pl'; +my $limit = $get{v} // (exists $get{v} ? 4 : 3); + Html({ title => 'words cheat sheet', version => '1.0', @@ -61,7 +63,6 @@ figure:hover > figcaption { EOT }); - :>

Words

@@ -92,11 +93,13 @@ sub showimg { sub printimgs { say '