[DOCs] Added a very visible warning about `-s all`

- In the set_text_variables
This commit is contained in:
Salvador E. Tropea 2023-09-01 13:45:29 -03:00
parent 91d664e78a
commit 91f5bb81da
3 changed files with 18 additions and 4 deletions

View File

@ -115,10 +115,14 @@ Supported preflights
- ``text`` :index:`: <pair: preflight - sch_replace - replace_tags; text>` [string=''] Text to insert instead of the tag.
- **set_text_variables**: :index:`: <pair: preflights; set_text_variables>` [dict|list(dict)] Defines KiCad 6 variables.
- **set_text_variables**: :index:`: <pair: preflights; set_text_variables>` [dict|list(dict)] Defines KiCad 6+ variables.
They are expanded using ${VARIABLE}, and stored in the project file. |br|
This preflight replaces `pcb_replace` and `sch_replace` when using KiCad 6. |br|
The KiCad project file is modified.
The KiCad project file is modified. |br|
.. warning::
don't use `-s all` or this preflight will be skipped
.. .
- Valid keys:

View File

@ -1006,6 +1006,7 @@ def adapt_text(text):
if len(lines) > 1:
t = []
in_list = False
in_warning = False
for ln in lines:
if ln[0] == '-':
if not in_list:
@ -1017,7 +1018,15 @@ def adapt_text(text):
t.append('')
if ln[-1] == '.' and not in_list:
ln += ' |br|'
if 'Warning: ' in ln:
indent = ln.index('Warning: ')
t.append('')
t.append('.. warning::')
in_warning = True
ln = ln[:indent]+ln[indent+9:]
t.append(ln)
if in_warning:
t.append('.. ')
text = '\n'.join(t)
return adapt_to_rst_urls(text)
text = text.replace('\\*', '*')

View File

@ -76,10 +76,11 @@ class Set_Text_VariablesOptions(Optionable):
@pre_class
class Set_Text_Variables(BasePreFlight): # noqa: F821
""" [dict|list(dict)] Defines KiCad 6 variables.
""" [dict|list(dict)] Defines KiCad 6+ variables.
They are expanded using ${VARIABLE}, and stored in the project file.
This preflight replaces `pcb_replace` and `sch_replace` when using KiCad 6.
The KiCad project file is modified """
The KiCad project file is modified.
Warning: don't use `-s all` or this preflight will be skipped """
def __init__(self, name, value):
f = Set_Text_VariablesOptions()
f.set_tree({'variables': value})