PageMove
Moves one published page, and rewrites every reference to it (white-label-docs §WLO-A6).
Declared in src/libs/libhelpbuild/helpbuild/PageMove.hpp.
Detailed description
A page's identity is its path. No sidecar sets page_id, and about 2 206 cross references name a path (white-label-docs §WLO-R4). A move by hand breaks them, so this class does every move. It makes five kinds of change:
- It renames the page and its sidecar. For a folder page, it renames the folder, with every file in it.
- It rewrites each relative link to a moved file, in each
.mdundercontent/docand in the.mdfiles of the checkout root. It also rewrites each relative link of a moved page, because the folder of the page changes.DocLinkScan::linksOf()finds the links andDocLinkFix::relativeLink()writes them. Aurl: line of a sidecar is a link too, asDocLinkScan::scan()reads it. - It rewrites each sidecar cross reference
documentation/<path>to a moved page, under the keysprerequisites,related_concepts,next_stepsandsee_also. - It rewrites each string literal in
src/,test/andintegration/that names a moved page. A literal names a page when it is the page path, with an optional prefixdocumentation/,content/doc/published/or:/help/, an optional suffix.mdor/index.md, and an optional anchor#heading. A bare path with no/and no prefix or suffix is a word, not a page, and stays. A file under a prefix ofoctomy::tool::VendoredPathsis not ours, and stays too. - It adds or updates one entry of the move record for each moved page (§WLO-D4). A page that moves again keeps its entry,
fromthe first path,tothe last.
The class computes every change on the old layout first. Without Options::apply it writes nothing. With it, it writes the edited files, then renames, then writes the record.
plan() reads the page apps (§WLO-D3) and gives the move list: a page with one app id, not counting the audience ids, that sits outside <type>/<app>/ moves into it, and a name prefix equal to the app id drops.
The two helpers are the namespaces DocLinkScan and DocLinkFix.