Skip to content

Commit

Permalink
Merge pull request #270 from ma10/revise-yaml2x-20241119
Browse files Browse the repository at this point in the history
yaml2x: 複数条件の出力時にカッコを用いて条件のグループを明示する
  • Loading branch information
ma10 authored Nov 19, 2024
2 parents 3986833 + 7c37981 commit 6a3dc5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tools/yaml2x/a11y_guidelines/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def summary(self, lang):
return f'{self.procedure.id}{language_info[lang]["simple_pass_singular"]}'

simple_conditions = [cond.summary(lang) for cond in self.conditions if cond.type == 'simple']
complex_conditions = [cond.summary(lang) for cond in self.conditions if cond.type != 'simple']
complex_conditions = [f'({cond.summary(lang)})' for cond in self.conditions if cond.type != 'simple']

if self.type == 'and':
summary_separator = language_info[lang]['and_separator']
Expand All @@ -743,7 +743,7 @@ def summary(self, lang):

if len(simple_conditions) > 1:
simple_conditions = [cond.replace(language_info[lang]['simple_pass_singular'], '') for cond in simple_conditions]
simple_summary = summary_separator.join(simple_conditions) + simple_pass
simple_summary = f'{summary_separator.join(simple_conditions)}{simple_pass}'
return f'{simple_summary}{summary_connector}{summary_connector.join(complex_conditions)}' if complex_conditions else simple_summary
else:
return summary_connector.join(simple_conditions + complex_conditions)
Expand Down
6 changes: 3 additions & 3 deletions tools/yaml2x/yaml2json/yaml2json.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ def reRST_str(str, info, lang):
halfwidth_chars = r'[\u0000-\u007F\uFF61-\uFFDC\uFFE8-\uFFEE]'

# Remove whitespaces between fullwidth chars
text = re.sub(f'({fullwidth_chars})\s+({fullwidth_chars})', r'\1\2', text)
text = re.sub(rf'({fullwidth_chars})\s+({fullwidth_chars})', r'\1\2', text)

# Remove whitespaces between halfwidth chars and full width chars
text = re.sub(f'({fullwidth_chars})\s+({halfwidth_chars})', r'\1\2', text)
text = re.sub(f'({halfwidth_chars})\s+({fullwidth_chars})', r'\1\2', text)
text = re.sub(rf'({fullwidth_chars})\s+({halfwidth_chars})', r'\1\2', text)
text = re.sub(rf'({halfwidth_chars})\s+({fullwidth_chars})', r'\1\2', text)

return text

Expand Down

0 comments on commit 6a3dc5a

Please sign in to comment.