Warn on invalid title length
This commit is contained in:
parent
e16c324b1f
commit
5f55de48ec
|
@ -165,7 +165,7 @@ Both options USB and OTA are done by running the command:
|
|||
More details on programming can be found on :doc:`/devices/sonoff_basic`
|
||||
|
||||
3. Prepping and installing
|
||||
****************************
|
||||
**************************
|
||||
|
||||
* Ensure power is switched off.
|
||||
* You can now add your water level sensor wiring to the PCB and have it extrude, SAFELY, next to your connector block.
|
||||
|
|
|
@ -54,9 +54,14 @@ RST primer:
|
|||
|
||||
.. code-block:: rst
|
||||
|
||||
My Sub-sub section
|
||||
My Sub-sub Section
|
||||
******************
|
||||
|
||||
.. note::
|
||||
|
||||
The length of the bar below the text **must** match the title Text length.
|
||||
Also, titles should be in Title Case
|
||||
|
||||
- **Links**: To create a link to an external resource (for example https://www.google.com), use
|
||||
``\`Link text <link_url>\`__``. For example:
|
||||
|
||||
|
|
17
travis.py
17
travis.py
|
@ -1,4 +1,5 @@
|
|||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
|
||||
errors = []
|
||||
|
@ -15,6 +16,9 @@ def find_all(a_str, sub):
|
|||
column += len(sub)
|
||||
|
||||
|
||||
section_regex = re.compile(r'^(=+|-+|\*+|~+)$')
|
||||
|
||||
|
||||
for f in sorted(Path('.').glob('**/*.rst')):
|
||||
try:
|
||||
content = f.read_text('utf-8')
|
||||
|
@ -28,6 +32,19 @@ for f in sorted(Path('.').glob('**/*.rst')):
|
|||
errors.append("File {} contains windows newline on line {}:{}. "
|
||||
"Please set your editor to unix newline mode.".format(f, line, col))
|
||||
|
||||
lines = content.splitlines(keepends=False)
|
||||
for i, line in enumerate(lines):
|
||||
if i == 0:
|
||||
continue
|
||||
|
||||
if not section_regex.match(line):
|
||||
continue
|
||||
line_above = lines[i - 1]
|
||||
if len(line_above) != len(line):
|
||||
errors.append("The title length must match the bar length below it. See {}:{}"
|
||||
"".format(f, i))
|
||||
|
||||
|
||||
for error in errors:
|
||||
print(error)
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ creating a POST request at ``/light/<id>/turn_on?brightness=128&transition=2`` w
|
|||
- **transition**: Transition to off in this duration in seconds.
|
||||
|
||||
Fan
|
||||
****
|
||||
***
|
||||
|
||||
Fans are similar to switches as they can be turned on/off and toggled. In addition, if the
|
||||
underlying fan supports it, fans in the web server also support the speed settings "low",
|
||||
|
|
Loading…
Reference in New Issue