Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified and fixed mdbook-replace regexs #36

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ edit-url-template = "https://github.com/lowRISC/sonata-software/edit/main/{path}
[preprocessor.replace]
after = ["links"]

# Replace all links to a README.md to an index.md
# Replace all links to a README.md to with a link to an index.md
link_replacements = [
{regex = '^(?P<path>[^:#\?]*)README\.md(?P<suffix>[?#].*)?', replacement = '${path}index.md${suffix}'},
]

[[preprocessor.replace.local_link_replacements]]
# Replace all paths pointing to something in the cheriot-rtos
# to a link pointing to them in github.
regex = '^cheriot-rtos/*(?P<path>.*)?'
# Replace all paths pointing to something in cheriot-rtos
# to a link pointing to it in github.
regex = '^cheriot-rtos/(?P<path>.*)?'
replacement = 'https://github.com/CHERIoT-Platform/cheriot-rtos/tree/main/${path}'

[[preprocessor.replace.local_link_replacements]]
# Replace all paths pointing to something in this repository,
# that is not a markdown file or image,
# to a link pointing to them in github.
regex = '[^:#\?]*[^(\.(md|svg|png))]([?#].*)?'
# that ends with .cc, .hh, .h, .rego, .lua or / (for directories)
# to a link pointing to to in github.
regex = '.*(\/|\.(cc|hh|h|rego|lua))$'
replacement = 'https://github.com/lowRISC/sonata-software/tree/main/${0}'