Wrap CLDR-derived time-zone ID tables to within a 100-column margin
Ugly display in code-review bugged me ... Change-Id: If9243907973cad49f1a5c8d78ff23c14fab2d4b4 Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
This commit is contained in:
parent
c84d78d105
commit
a0c5a7c483
File diff suppressed because it is too large
Load Diff
@ -240,7 +240,8 @@ class ByteArrayData:
|
||||
|
||||
def write(self, out, name):
|
||||
out(f'\nstatic constexpr char {name}[] = {{\n')
|
||||
out(wrap_list(self.data))
|
||||
out(wrap_list(self.data, 16)) # 16 == 100 // len('0xhh, ')
|
||||
# Will over-spill 100-col if some 4-digit hex show up, but none do (yet).
|
||||
out('\n};\n')
|
||||
|
||||
class ZoneIdWriter (SourceFileEditor):
|
||||
|
@ -41,12 +41,12 @@ def unicode2hex(s):
|
||||
lst.append(hex(v))
|
||||
return lst
|
||||
|
||||
def wrap_list(lst):
|
||||
def wrap_list(lst, perline=20):
|
||||
def split(lst, size):
|
||||
while lst:
|
||||
head, lst = lst[:size], lst[size:]
|
||||
yield head
|
||||
return ",\n".join(", ".join(x) for x in split(lst, 20))
|
||||
return ",\n".join(", ".join(x) for x in split(lst, perline))
|
||||
|
||||
|
||||
@contextmanager
|
||||
|
Loading…
Reference in New Issue
Block a user