diff options
author | Lucas Neves <lcneves@gmail.com> | 2017-10-30 21:13:32 +0000 |
---|---|---|
committer | Lucas Neves <lcneves@gmail.com> | 2017-10-30 21:13:32 +0000 |
commit | 723fba2c05a80274ab50e529d8fcba0310dad1ae (patch) | |
tree | 9c99e7be78978b4a23888251ffa1af80df49cc2e | |
parent | 21a344cfb578bc53ef41b2d2459f3f8892aec30b (diff) | |
download | libcss-723fba2c05a80274ab50e529d8fcba0310dad1ae.tar.gz |
WIP: Select: autogen for selection properties.
-rw-r--r-- | src/select/select_generator.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/select/select_generator.py b/src/select/select_generator.py index 701d7d5..c37aa74 100644 --- a/src/select/select_generator.py +++ b/src/select/select_generator.py @@ -68,18 +68,27 @@ class FileText: if self._comment: line += ' * ' prefix_size = (3 if self._comment else 0) + 8 * self._indent - line += text[:column_max - prefix_size] + if prefix_size + len(text) <= column_max: + line += text + text = '' + else: + break_index = text[:text[:column_max - prefix_size].rfind(' ')] + line += text[:break_index].rstrip() + text = text[break_index:].lstrip() self.lines.append(line) - text = text[column_max - prefix_size:] if text and not self._comment and not multiline: - self._indent(2) + self.indent(2) multiline = True if multiline: self._indent(-2) + def write_file(self, filename): + with open(filename, 'w') as f: + f.write('\n'.join(self._lines)) + def make_computed_h(group, is_main=false): - pass + class CSSValue: 'Values to be associated with properties.' |