Support mapping files specified in the INI format
Opened this issue · 0 comments
Feature Request
- wordrow version: v0.7.0-beta
Description
Add support for .ini
files as mappings.
Example
Add support for files following the INI file format as mapping files. The format is not really intended for this kind of job, it is intended primarily to map keys to values in sections. wordrow can utilize the format by simple mapping keys to values (or values to keys in case --invert
is used) and ignore the sections entirely. The sections can be a human-readable way of splitting one mapping files into distinct... sections.
Proposal
An .ini
file (including when using explicit formatting, e.g. --map-file ./file:ini
) should be parsed into a mapping such that every "key" will be replaced by the corresponding "value". E.g.:
key=value
foo=bar
dog=cat
Should result in the mapping:
from | to |
---|---|
"key" | "value" |
"foo" | "bar" |
"dog" | "cat" |
Sections should be ignored entirely when parsing an .ini
file. E.g.:
[nonsense]
key=value
foo=bar
[animals]
dog=cat
canary=parrot
horse=donkey
Should result in the mapping:
from | to |
---|---|
"key" | "value" |
"foo" | "bar" |
"dog" | "cat" |
"canary" | "parrot" |
"horse" | "donkey" |
Furthermore, whitespace should be trimmed as always (removed before the first letter and after the last letter). E.g.:
..bar...=.baz.....
Should result in the mapping:
from | to |
---|---|
"bar" | "baz" |