@@ 62-79 (lines=18) @@ | ||
59 | element.yaml_add_eol_comment(*args, **kwargs) |
|
60 | ||
61 | ||
62 | def _map_comment(_element, _key): |
|
63 | origin_comment = "" |
|
64 | token = _element.ca.items.get(_key, None) |
|
65 | if token is not None: |
|
66 | try: |
|
67 | origin_comment = token[2].value |
|
68 | except Exception: |
|
69 | try: |
|
70 | # comment is below element, add profix "#\n" |
|
71 | col = _element.lc.col + 2 |
|
72 | space_list = [" " for i in range(col)] |
|
73 | space_str = "".join(space_list) |
|
74 | ||
75 | origin_comment = "\n" + "".join([space_str + t.value for t in token[3]]) |
|
76 | except Exception: |
|
77 | pass |
|
78 | ||
79 | return origin_comment |
|
80 | ||
81 | ||
82 | def _seq_comment(_element, _index): |
@@ 62-79 (lines=18) @@ | ||
59 | element.yaml_add_eol_comment(*args, **kwargs) |
|
60 | ||
61 | ||
62 | def _map_comment(_element, _key): |
|
63 | origin_comment = "" |
|
64 | token = _element.ca.items.get(_key, None) |
|
65 | if token is not None: |
|
66 | try: |
|
67 | origin_comment = token[2].value |
|
68 | except Exception: |
|
69 | try: |
|
70 | # comment is below element, add profix "#\n" |
|
71 | col = _element.lc.col + 2 |
|
72 | space_list = [" " for i in range(col)] |
|
73 | space_str = "".join(space_list) |
|
74 | ||
75 | origin_comment = "\n" + "".join([space_str + t.value for t in token[3]]) |
|
76 | except Exception: |
|
77 | pass |
|
78 | ||
79 | return origin_comment |
|
80 | ||
81 | ||
82 | def _seq_comment(_element, _index): |