Updates
This commit is contained in:
parent
22388bed8f
commit
e81cae09c6
7
build
7
build
@ -14,9 +14,12 @@ else
|
||||
./mdbook build -d public
|
||||
fi
|
||||
|
||||
cp -R static/* public/
|
||||
|
||||
# Work around some print.html bugs.
|
||||
sed -i "s/\(href\|src\)=\"[[:alnum:]\-]*\/\//\1=\"\//g" public/print.html
|
||||
|
||||
./move_html_to_dir public/
|
||||
|
||||
# Make checkboxes editable, just in case the user wants to keep their own checklist.
|
||||
find public/ -name "*.html" -type f -exec sed -i 's/input disabled=""/input/g' {} +
|
||||
|
||||
cp -R static/* public/
|
||||
|
@ -13,7 +13,7 @@ It's called Parachute, and you can download it here:
|
||||
|
||||
|
||||
## Building ArduPilot
|
||||
See [Building ArduPilot](/ardupilot/building-ardupilot) for instructions on how to build the latest version.
|
||||
See [Building ArduPilot](/ardupilot/building-ardupilot.html) for instructions on how to build the latest version.
|
||||
|
||||
|
||||
## Hardware setup
|
||||
@ -98,7 +98,7 @@ The values in this section are specific to the Omnibus F4, but the settings aren
|
||||
|
||||
## Recommended settings.
|
||||
|
||||
See the [recommended settings](/ardupilot/ardupilot-recommended-settings) page for other recommended defaults.
|
||||
See the [recommended settings](/ardupilot/ardupilot-recommended-settings.html) page for other recommended defaults.
|
||||
|
||||
## In the field
|
||||
- [ ] Run an autotune.
|
||||
|
@ -1,6 +1,6 @@
|
||||
# TECS tuning calculator
|
||||
|
||||
To use this calculator, first follow the steps in [Tuning the TECS](/ardupilot/tuning-the-tecs).
|
||||
To use this calculator, first follow the steps in [Tuning the TECS](/ardupilot/tuning-the-tecs.html).
|
||||
|
||||
<script>
|
||||
function kmhToMs(kmh) { return Math.round(kmh / 3.6); }
|
||||
|
@ -62,7 +62,7 @@ You're done with this step.
|
||||
### On the bench
|
||||
After you have the above measurements, you're ready to tune things. You can use the automatic calculator:
|
||||
|
||||
### [TECS tuning calculator](/ardupilot/tecs-tuning-calculator)
|
||||
### [TECS tuning calculator](/ardupilot/tecs-tuning-calculator.html)
|
||||
|
||||
Otherwise, you can do things manually, following the steps below, but you should really use the calculator instead.
|
||||
|
||||
|
@ -157,7 +157,9 @@ class JoplinExporter:
|
||||
def replacement(match):
|
||||
item_id = match.group(1)
|
||||
new_url = self.get_note_url_by_id(item_id)
|
||||
if not new_url:
|
||||
if new_url:
|
||||
new_url += ".html"
|
||||
else:
|
||||
new_url = self.get_resource_url_by_id(item_id)
|
||||
if not new_url:
|
||||
new_url = item_id
|
||||
|
@ -6,6 +6,54 @@ import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
from typing import List
|
||||
|
||||
|
||||
def get_safe_path(root: Path, candidate: Path) -> Path:
|
||||
"""
|
||||
Return the safe path between two paths.
|
||||
|
||||
This function checks that a candidate path is under the given root. If it is, it
|
||||
returns the candidate path unchanged. If not, it returns the topmost ancestor that
|
||||
is not part of the root, as the relative path.
|
||||
|
||||
For illustration, some inputs and outputs:
|
||||
>>> get_safe_path("/var/www/mydocs", "/var/www/mydocs/foo")
|
||||
"/var/www/mydocs/foo"
|
||||
|
||||
>>> get_safe_path("/var/www/mydocs", "/var/www/foo")
|
||||
"/var/www/mydocs/foo"
|
||||
|
||||
>>> get_safe_path("/var/www/mydocs", "/foo")
|
||||
"/var/www/mydocs/foo"
|
||||
"""
|
||||
if not root.is_absolute() and candidate.is_absolute():
|
||||
raise ValueError("Both paths must be absolute")
|
||||
|
||||
try:
|
||||
# If the candidate is under the root, we're done.
|
||||
candidate.relative_to(root)
|
||||
return candidate
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# Otherwise, look for the first point of divergence from the root.
|
||||
for counter, part in enumerate(root.parts):
|
||||
if counter >= len(candidate.parts):
|
||||
parts: List[str] = []
|
||||
break
|
||||
|
||||
if part != candidate.parts[counter]:
|
||||
# Everything past that is what we need.
|
||||
parts = candidate.parts[counter:]
|
||||
break
|
||||
|
||||
outpath = root
|
||||
# Tack the discovered parts onto the root.
|
||||
for part in parts:
|
||||
outpath /= part
|
||||
|
||||
return outpath
|
||||
|
||||
|
||||
def convert_relative_to_absolute(path: Path):
|
||||
@ -21,7 +69,12 @@ def convert_relative_to_absolute(path: Path):
|
||||
def replace_wrapper(filename: Path):
|
||||
def replace_link(match: re.Match) -> str:
|
||||
property, text, suffix = match.groups()
|
||||
if "://" in text or text == "/" or text.startswith("#"):
|
||||
if (
|
||||
"://" in text
|
||||
or text == "/"
|
||||
or text.startswith("#")
|
||||
or text.startswith("mailto")
|
||||
):
|
||||
# Not a valid filename, return it.
|
||||
return f"{property}{text}{suffix}"
|
||||
|
||||
@ -30,6 +83,7 @@ def convert_relative_to_absolute(path: Path):
|
||||
else:
|
||||
filepath = (filename.parent / text).resolve()
|
||||
|
||||
filepath = get_safe_path(path, filepath)
|
||||
if not filepath.exists():
|
||||
# Not a valid filename, return it.
|
||||
sys.exit(f"Possible broken link in {filename}: {text}")
|
||||
@ -87,6 +141,7 @@ def replace_links(path: Path, replacements: Dict[str, str]):
|
||||
|
||||
|
||||
def main(path: Path):
|
||||
path = path.resolve()
|
||||
convert_relative_to_absolute(path)
|
||||
|
||||
replacements: Dict[str, str] = {}
|
||||
|
Loading…
Reference in New Issue
Block a user