@@ -0,0 +1,817 @@
+%0Adef csv():%0A%0A    def Receipt(meta, body, variables):%0A        output = %5B%5D%0A%0A        def add(s) : output.append(s)%0A%0A        if %22store%22 in meta:%0A            add(%22# Store: %7B%7D%22.format(meta%5B%22store%22%5D))%0A        if %22date%22 in meta:%0A            add(%22# Date: %7B%7D%22.format(meta%5B%22date%22%5D))%0A        if %22location%22 in meta:%0A            add(%22# Location: %7B%7D%22.format(meta%5B%22location%22%5D))%0A%0A        add(body)%0A%0A        return %22%5Cn%22.join(output)%0A%0A    def ItemList(s): return s%0A    def ItemListSep(): return %22%5Cn%22%0A%0A    ## Could also be used to collapse the fields, or exclude some.%0A    def Item(name, cost, discount, tax):%0A        return %22%7B%7D, %7B%7D, %7B%7D, %7B%7D%22.format(name, cost, discount, tax)%0A%0A    return %7B%0A            %22Receipt%22 : Receipt,%0A            %22ItemList%22 : ItemList,%0A            %22ItemListSep%22 : ItemListSep,%0A            %22Item%22 : Item,%0A        %7D%0A%0A

Add simple csv writer.