requirements.layout.repository_links
Requirements index · View definition
Requirement
The Habeas Codicem book MUST configure mdBook’s Git repository link for
nikomatsakis/habeas-codicemand its page edit links for themainbranch.
Rationale
The requirement has one MUST. It splits into two obligations: configure the Git repository link for nikomatsakis/habeas-codicem, and configure page edit links for the main branch.
- Repository link:
book.tomlline 18, in[output.html], setsgit-repository-url = "https://github.com/nikomatsakis/habeas-codicem". It carries an{impl}reference. - Edit links:
book.tomlline 20, in[output.html], setsedit-url-template = "https://github.com/nikomatsakis/habeas-codicem/edit/main/{path}". It carries an{impl}reference. The template uses theedit/mainpath on the same repository. - Tests:
tests/repository.rshasbook_links_to_the_repository_and_main_branch_edit_pages, which carries a{test}reference. It parsesbook.tomland asserts that bothoutput.htmlvalues equal those exact strings.
I found no unspecified behavior or gaps in the {impl} code. The other [output.html] keys carry references to other requirements or none.
One thing I noticed but did not count as a gap: mdBook’s {path} is relative to src, which is md here, so the generated edit URLs may omit the md/ directory. The requirement text only asks for the repository and the main branch, so I judged against that.
Inputs
Implementation
Input 2: outline book.toml table[output.html]/pair[git-repository-url]
- File:
book.toml - Selector:
table[output.html]/pair[git-repository-url] - Kind:
pair book.toml:17–18
# {impl}`requirements.layout.repository_links`
git-repository-url = "https://github.com/nikomatsakis/habeas-codicem"
Input 3: outline book.toml table[output.html]/pair[edit-url-template]
- File:
book.toml - Selector:
table[output.html]/pair[edit-url-template] - Kind:
pair book.toml:19–20
# {impl}`requirements.layout.repository_links`
edit-url-template = "https://github.com/nikomatsakis/habeas-codicem/edit/main/{path}"
Input 7: outline book.toml table[output.html]
- File:
book.toml - Selector:
table[output.html] - Kind:
table book.toml:13–21
[output.html]
additional-css = ["md/habeas.css", "md/intro.css"]
# {impl}`requirements.integration.ci`
site-url = "/habeas-codicem/"
# {impl}`requirements.layout.repository_links`
git-repository-url = "https://github.com/nikomatsakis/habeas-codicem"
# {impl}`requirements.layout.repository_links`
edit-url-template = "https://github.com/nikomatsakis/habeas-codicem/edit/main/{path}"
Tests
Input 4: outline tests/repository.rs fn[book_links_to_the_repository_and_main_branch_edit_pages]
- File:
tests/repository.rs - Selector:
fn[book_links_to_the_repository_and_main_branch_edit_pages] - Kind:
fn tests/repository.rs:300–313
// {test}`requirements.layout.repository_links`
#[test]
fn book_links_to_the_repository_and_main_branch_edit_pages() {
let book = repository_toml("book.toml");
let html = &book["output"]["html"];
assert_eq!(
html["git-repository-url"].as_str(),
Some("https://github.com/nikomatsakis/habeas-codicem")
);
assert_eq!(
html["edit-url-template"].as_str(),
Some("https://github.com/nikomatsakis/habeas-codicem/edit/main/{path}")
);
}
Other sources
Input 1: requirements selection requirements.layout.repository_links
requirements.layout.repository_links:md/requirements/layout.md:7–9
:::{req} repository_links
The Habeas Codicem book MUST configure mdBook's Git repository link for `nikomatsakis/habeas-codicem` and its page edit links for the `main` branch.
:::
Input 5: outline book.toml table[book]
- File:
book.toml - Selector:
table[book] - Kind:
table book.toml:1–6
[book]
title = "Habeas Codicem"
language = "en"
# {impl}`requirements.layout.project`
src = "md"
Input 6: outline book.toml table[preprocessor.habeas]
- File:
book.toml - Selector:
table[preprocessor.habeas] - Kind:
table book.toml:7–12
[preprocessor.habeas]
# {impl}`requirements.cli.mdbook`
# {impl}`requirements.layout.project`
command = "cargo habeas mdbook"
renderers = ["html"]
Input 8: outline book.toml table[output.html.fold]
- File:
book.toml - Selector:
table[output.html.fold] - Kind:
table book.toml:22–25
[output.html.fold]
enable = true
level = 0