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 .md under content/doc and in the .md files 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 and DocLinkFix::relativeLink() writes them. A url: line of a sidecar is a link too, as DocLinkScan::scan() reads it.
  • It rewrites each sidecar cross reference documentation/<path> to a moved page, under the keys prerequisites, related_concepts, next_steps and see_also.
  • It rewrites each string literal in src/, test/ and integration/ that names a moved page. A literal names a page when it is the page path, with an optional prefix documentation/, content/doc/published/ or :/help/, an optional suffix .md or /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 of octomy::tool::VendoredPaths is 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, from the first path, to the 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.

In this section