[DOCs] Added a very visible warning about `-s all`
- In the set_text_variables
This commit is contained in:
parent
91d664e78a
commit
91f5bb81da
|
|
@ -115,10 +115,14 @@ Supported preflights
|
||||||
- ``text`` :index:`: <pair: preflight - sch_replace - replace_tags; text>` [string=''] Text to insert instead of the tag.
|
- ``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|
|
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|
|
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:
|
- Valid keys:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1006,6 +1006,7 @@ def adapt_text(text):
|
||||||
if len(lines) > 1:
|
if len(lines) > 1:
|
||||||
t = []
|
t = []
|
||||||
in_list = False
|
in_list = False
|
||||||
|
in_warning = False
|
||||||
for ln in lines:
|
for ln in lines:
|
||||||
if ln[0] == '-':
|
if ln[0] == '-':
|
||||||
if not in_list:
|
if not in_list:
|
||||||
|
|
@ -1017,7 +1018,15 @@ def adapt_text(text):
|
||||||
t.append('')
|
t.append('')
|
||||||
if ln[-1] == '.' and not in_list:
|
if ln[-1] == '.' and not in_list:
|
||||||
ln += ' |br|'
|
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)
|
t.append(ln)
|
||||||
|
if in_warning:
|
||||||
|
t.append('.. ')
|
||||||
text = '\n'.join(t)
|
text = '\n'.join(t)
|
||||||
return adapt_to_rst_urls(text)
|
return adapt_to_rst_urls(text)
|
||||||
text = text.replace('\\*', '*')
|
text = text.replace('\\*', '*')
|
||||||
|
|
|
||||||
|
|
@ -76,10 +76,11 @@ class Set_Text_VariablesOptions(Optionable):
|
||||||
|
|
||||||
@pre_class
|
@pre_class
|
||||||
class Set_Text_Variables(BasePreFlight): # noqa: F821
|
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.
|
They are expanded using ${VARIABLE}, and stored in the project file.
|
||||||
This preflight replaces `pcb_replace` and `sch_replace` when using KiCad 6.
|
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):
|
def __init__(self, name, value):
|
||||||
f = Set_Text_VariablesOptions()
|
f = Set_Text_VariablesOptions()
|
||||||
f.set_tree({'variables': value})
|
f.set_tree({'variables': value})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue