Skip to content

Commit e4ad164

Browse files
authored
Merge pull request #545 from xpsi-group/540-module-generator-bug-in-configini-file-where-n-is-displayed-instead-of-newlines
540 Module generator: bug in config.ini file where "\n" is displayed …
2 parents 728ddba + 5bb2561 commit e4ad164

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

xpsi/module_generator.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -492,14 +492,14 @@ def _typeset(arg, default, nargs, comment_line_above, empty_lines_below, comment
492492
493493
:return str: The text for the argument in the configuration file.
494494
"""
495-
entry = '\\n' if newline else ''
495+
entry = '\n' if newline else ''
496496
497497
if comment_line_above is not None:
498498
if comment_line_above == 'rule':
499-
entry += '#' + '-'*78 + '#\\n'
499+
entry += '#' + '-'*78 + '#\n'
500500
else:
501501
_ = '## {{}} ##'.format(comment_line_above)
502-
entry += '##' + '-' * (len(_) - 4) + '##\\n' + _ + '\\n##' + '-' * (len(_) - 4) + '##\\n'
502+
entry += '##' + '-' * (len(_) - 4) + '##\n' + _ + '\n##' + '-' * (len(_) - 4) + '##\n'
503503
504504
_ = ' ## {{}}'.format(inline_comment) if inline_comment is not None else ''
505505
if not _ and isinstance(nargs, int) and nargs > 1:
@@ -513,24 +513,24 @@ def _typeset(arg, default, nargs, comment_line_above, empty_lines_below, comment
513513
'' if (i > 0 and nargs != 1) else arg,
514514
'' if nargs != 1 else '=',
515515
'' if (i == 0 and nargs != 1) else str(_default),
516-
(_ if i == 0 else '') + ('\\n{{0}}{{1}}'.format('#' if comment else '', str(_default)) if i == 0 and nargs != 1 else ''),
517-
'\\n' if i > 0 else '')
516+
(_ if i == 0 else '') + ('\n{{0}}{{1}}'.format('#' if comment else '', str(_default)) if i == 0 and nargs != 1 else ''),
517+
'\n' if i > 0 else '')
518518
else:
519519
entry += '{{0}}{{1}}{{2}}{{3}}{{4}}'.format('#' if comment else '',
520520
arg,
521521
'=' if nargs == 1 else '',
522522
_ if nargs != 1 else (str(default) if default is not None else ''),
523-
('\\n' + str(default) if default is not None else '') if nargs != 1 else _)
523+
('\n' + str(default) if default is not None else '') if nargs != 1 else _)
524524
525525
if action == 'append':
526-
entry += '\\n#{{0}}='.format(arg)
526+
entry += '\n#{{0}}='.format(arg)
527527
528528
if isinstance(nargs, int) and nargs > 1:
529-
entry += '\\n' * nargs
529+
entry += '\n' * nargs
530530
elif isinstance(nargs, str):
531-
entry += '\\n' * 3
531+
entry += '\n' * 3
532532
533-
entry += '\\n' * empty_lines_below
533+
entry += '\n' * empty_lines_below
534534
535535
return entry
536536

0 commit comments

Comments
 (0)