Since the Image element is affected here, you need something like:
Image = function(img) img.attributes.width="100%"; img.attributes.height="100%"; return img end
(NOTE: if the height has already been set, eg by another filter, then only setting width to 100% might not be enough, which is why I also put height to 100% above; the LaTeX default template will adjust to it by keeping aspect ratio and prevent overflow, but I haven't tested what the ODT writer will do if height 100% is omitted...)
If this is the only element to change in this filter, then the filter is:
local filterImageWidth = { Image = function(img) img.attributes.width="100%"; img.attributes.height="100%"; return img end }
If this is the only filter in your lua file, than the file will simply consist of:
return { filterImageWidth }
or
return { { Image = function(img) img.attributes.width="100%"; img.attributes.height="100%"; return img end } }
You'll see this often written as:
return {
{ Image = function(img)
img.attributes.width="100%"
img.attributes.height="100%"
return img
end,
}
}
(which is more manageable if there's instructions)
or, alternatively, you could just write in this lua file:
function Image(img)
img.attributes.width="100%"
img.attributes.height="100%"
return img
end
and Pandoc will construct the return list of filters by itself.