X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-test.git;a=blobdiff_plain;f=yarrg%2FCommodsWeb.pm;h=9a608365d88ffb31f7f6059731770e7ea7aa2f30;hp=ab2a4a30a322e002135422a558eb1ecaff0b4c3e;hb=ea09579bdbec295cfe7735a262e06055a1f69835;hpb=05a607330cc73832ccc778cd10f69cbac8e6dba3 diff --git a/yarrg/CommodsWeb.pm b/yarrg/CommodsWeb.pm index ab2a4a3..9a60836 100644 --- a/yarrg/CommodsWeb.pm +++ b/yarrg/CommodsWeb.pm @@ -52,7 +52,7 @@ BEGIN { &to_json_shim &to_json_protecttags &set_ctype_utf8 &webdatadir &expected_error &dbw_lookup_string - &printable &tr_datarow + &printable &tr_datarow &tr_datarow_s &escerrq &prettyprint_age &meta_prettyprint_age); %EXPORT_TAGS = ( ); @@ -210,18 +210,30 @@ sub printable ($) { # printable($m) where $m is the Mason request object return 0; } -sub tr_datarow ($$) { +sub tr_datarow_s ($$) { my ($m, $lineno) = @_; $lineno &= 1; if (!printable($m)) { - $m->print(""); + return ""; } else { - $m->print(""); + return ""; } } +sub tr_datarow ($$) { + my ($m, $lineno) = @_; + $m->print(tr_datarow_s($m, $lineno)); +} + +sub escerrq ($) { + return '"'.CGI::escapeHTML($_[0]).'"'; + # Prettier qotes as below are not in HTML 3.2: +# return '“'.CGI::escapeHTML($_[0]).'”'; +# return '‘'.CGI::escapeHTML($_[0]).'’'; +} + package CommodsWeb::ExpectedError; sub emsg ($) {