-- -- MoneyMoney Export Extension -- http://moneymoney-app.com/api/export -- -- -- The MIT License (MIT) -- -- Copyright (c) 2014 Boris Penck -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in -- all copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -- THE SOFTWARE. -- -- -- Export transactions as HTML file. -- Exporter{version = 1.02, format = MM.localizeText("HTML file"), fileExtension = "html", reverseOrder = false, description = MM.localizeText("Export transactions as HTML file")} local function htmlData (str) -- Helper function for escaping reserved characters. return string.gsub(str, '["<>&]', {['"']='"', ['<']='<', ['>']='>', ['&']='&'}) end function WriteHeader (account, startDate, endDate, transactionCount) assert(io.write([[ ]] .. htmlData(account.name) .. [[, ]] .. os.date("%d.%m.%Y", startDate) .. [[ - ]] .. os.date("%d.%m.%Y", endDate) .. [[

]] .. htmlData(account.name) .. [[, ]] .. os.date("%d.%m.%Y", startDate) .. [[ - ]] .. os.date("%d.%m.%Y", endDate) .. [[

]])) end function WriteTransactions (account, transactions) for _,transaction in ipairs(transactions) do class = "" if transaction.amount > 0 then class="active" end assert(io.write([[ ]])) end end function WriteTail (account) assert(io.write([[
Datum Buchung Betrag Kategorie Kommentar
]] .. os.date("%d.%m.%Y", transaction.bookingDate) .. [[ ]] .. htmlData(transaction.name) .. [[
]] .. htmlData(transaction.purpose) .. [[
]] .. string.format("%.02f", transaction.amount) .. [[ ]] .. htmlData(transaction.currency) .. [[ ]] .. htmlData(transaction.category) .. [[ ]] .. htmlData(transaction.comment) .. [[
]] .. os.date("%d.%m.%Y", account.balanceDate) .. [[ Kontostand ]] .. string.format("%.02f", account.balance) .. [[ ]] .. htmlData(account.currency) .. [[
]])) end -- SIGNATURE: MC0CFQCIXcQw3VKkDktFGRPf4WmkBLjI5QIUFgTnfluP8LGtzlq6oGNyvJF5y4k=