Module:FuzzyDateDoc

local util_args = require('Module:ArgsUtil') local util_html = require("Module:HtmlUtil") local util_table = require("Module:TableUtil") local util_text = require("Module:TextUtil") local util_time = require("Module:TimeUtil") local util_vars = require("Module:VarsUtil") local i18n = require('Module:i18nUtil')

local COLUMNS = { 'input', 'approx', 'output' }

local h = {}

local p = {} function p.main(frame) local args = util_args.merge(true) i18n.init('FuzzyDateDoc') local examples = util_text.split(args[1]) local examplesForPrint = h.getExampleOutputs(examples) local output = mw.html.create('table') :addClass('wikitable') util_html.printHeaderFromI18n(output, COLUMNS) util_html.printRowsByList(output, examplesForPrint, COLUMNS) return output end

function h.getExampleOutputs(examples) local ret = {} for _, v in ipairs(examples) do		ret[#ret+1] = h.getExampleRow(v, true) ret[#ret+1] = h.getExampleRow(v, false) end return ret end

function h.getExampleRow(v, approx) return { input = v,		approx = approx and 'Yes' or '', output = util_time.strToDateStrFuzzyWithoutYear(v, approx) } end

return p