X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/9899aae804cce937958d38dfa5dd1a3fb39651e9..3f7dad54f210fdd8af812faa5256a495d7e3188d:/doc/plugins/contrib/getfield/discussion.mdwn diff --git a/doc/plugins/contrib/getfield/discussion.mdwn b/doc/plugins/contrib/getfield/discussion.mdwn index d3c1a1277..13ea8b1b3 100644 --- a/doc/plugins/contrib/getfield/discussion.mdwn +++ b/doc/plugins/contrib/getfield/discussion.mdwn @@ -14,7 +14,36 @@ yields: ARRAY(0x266db10) -Seems to me this could be checked and `join(" ")`'d. :) +Seems to me this could be checked and `join(" ")`'d. :) -- [[anarcat]] + +> I wrote a stupid fix for this, which works for getfield, but isn't as good for report. It simply does that `join()`. Here's the patch: +> +> [[!format diff """ +--- a/IkiWiki/Plugin/field.pm ++++ b/IkiWiki/Plugin/field.pm +@@ -322,6 +322,9 @@ sub field_get_value ($$;@) { + { + $basevalue = calculated_values($lc_field_name, $page); + } ++ if (ref($basevalue) eq "ARRAY") { ++ $basevalue = join(" ", @{$basevalue}); # hack ++ } + if (defined $basevalue) + { + $Cache{$page}{$basename} = $basevalue; +@@ -360,6 +363,9 @@ sub field_get_value ($$;@) { + { + $value = $basevalue; + } ++ if (ref($value) eq "ARRAY") { ++ $value = join(" ", @{$value}); # hack ++ } + if (defined $value) + { + $Cache{$page}{$lc_field_name} = $value; +"""]] +> +> Seems to me this should be the default, at the very least in getfield. But at least, with the above patch we don't see expanded Perl ref's. ;) --[[anarcat]] ## Templating, and other uses