From bfc6975cbc399cac0719b9305a8ac0fedb957aca Mon Sep 17 00:00:00 2001 From: pennae Date: Sun, 12 Feb 2023 11:47:33 +0100 Subject: [PATCH] nixos/manual: remove holdovers from docbook times these files provided mainly or exclusively xml-related tooling and support for editing the manual. since docbook is now an implementation detail (except for still being allowed in option docs, for now) these tools are no longer necessary, useful, or even functional. xmlformat.conf is still used by the nixpkgs documentation, so we have to keep it. there's no reason it can't go live with the nixpkgs docs though. --- doc/doc-support/default.nix | 2 +- {nixos/doc => doc/doc-support}/xmlformat.conf | 0 nixos/doc/manual/.gitignore | 2 - nixos/doc/manual/Makefile | 30 ----- nixos/doc/manual/shell.nix | 8 -- nixos/doc/varlistentry-fixer.rb | 124 ------------------ 6 files changed, 1 insertion(+), 165 deletions(-) rename {nixos/doc => doc/doc-support}/xmlformat.conf (100%) delete mode 100644 nixos/doc/manual/.gitignore delete mode 100644 nixos/doc/manual/Makefile delete mode 100644 nixos/doc/manual/shell.nix delete mode 100755 nixos/doc/varlistentry-fixer.rb diff --git a/doc/doc-support/default.nix b/doc/doc-support/default.nix index e9cb96e37fd..bea3e12a70b 100644 --- a/doc/doc-support/default.nix +++ b/doc/doc-support/default.nix @@ -75,7 +75,7 @@ in pkgs.runCommand "doc-support" {} ln -s ${epub-xsl} ./epub.xsl ln -s ${xhtml-xsl} ./xhtml.xsl - ln -s ${../../nixos/doc/xmlformat.conf} ./xmlformat.conf + ln -s ${./xmlformat.conf} ./xmlformat.conf ln -s ${pkgs.documentation-highlighter} ./highlightjs echo -n "${version}" > ./version diff --git a/nixos/doc/xmlformat.conf b/doc/doc-support/xmlformat.conf similarity index 100% rename from nixos/doc/xmlformat.conf rename to doc/doc-support/xmlformat.conf diff --git a/nixos/doc/manual/.gitignore b/nixos/doc/manual/.gitignore deleted file mode 100644 index 87928262421..00000000000 --- a/nixos/doc/manual/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -generated -manual-combined.xml diff --git a/nixos/doc/manual/Makefile b/nixos/doc/manual/Makefile deleted file mode 100644 index b2b6481b20c..00000000000 --- a/nixos/doc/manual/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -.PHONY: all -all: manual-combined.xml - -.PHONY: debug -debug: generated manual-combined.xml - -manual-combined.xml: generated *.xml **/*.xml - rm -f ./manual-combined.xml - nix-shell --pure -Q --packages xmloscopy \ - --run "xmloscopy --docbook5 ./manual.xml ./manual-combined.xml" - -.PHONY: format -format: - nix-shell --pure -Q --packages xmlformat \ - --run "find ../../ -iname '*.xml' -type f -print0 | xargs -0 -I{} -n1 \ - xmlformat --config-file '../xmlformat.conf' -i {}" - -.PHONY: fix-misc-xml -fix-misc-xml: - find . -iname '*.xml' -type f \ - -exec ../varlistentry-fixer.rb {} ';' - -.PHONY: clean -clean: - rm -f manual-combined.xml generated - -generated: - nix-build ../../release.nix \ - --attr manualGeneratedSources.x86_64-linux \ - --out-link ./generated diff --git a/nixos/doc/manual/shell.nix b/nixos/doc/manual/shell.nix deleted file mode 100644 index e5ec9b8f97f..00000000000 --- a/nixos/doc/manual/shell.nix +++ /dev/null @@ -1,8 +0,0 @@ -let - pkgs = import ../../.. { }; -in -pkgs.mkShell { - name = "nixos-manual"; - - packages = with pkgs; [ xmlformat jing xmloscopy ruby ]; -} diff --git a/nixos/doc/varlistentry-fixer.rb b/nixos/doc/varlistentry-fixer.rb deleted file mode 100755 index 02168016b55..00000000000 --- a/nixos/doc/varlistentry-fixer.rb +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env ruby - -# This script is written intended as a living, evolving tooling -# to fix oopsies within the docbook documentation. -# -# This is *not* a formatter. It, instead, handles some known cases -# where something bad happened, and fixing it manually is tedious. -# -# Read the code to see the different cases it handles. -# -# ALWAYS `make format` after fixing with this! -# ALWAYS read the changes, this tool isn't yet proven to be always right. - -require "rexml/document" -include REXML - -if ARGV.length < 1 then - $stderr.puts "Needs a filename." - exit 1 -end - -filename = ARGV.shift -doc = Document.new(File.open(filename)) - -$touched = false - -# Fixing varnames having a sibling element without spacing. -# This is to fix an initial `xmlformat` issue where `term` -# would mangle as spaces. -# -# -# types.separatedStringsep <---- -# -# ... -# -# Generates: types.separatedStringsep -# ^^^^ -# -# -# -# makeWrapperexecutablewrapperfileargs <---- -# -# -# Generates: makeWrapperexecutablewrapperfileargs -# ^^^^ ^^^^ ^^ ^^ -# -# -# namevalue <----- -# -# -# Generates: --optionnamevalue -# ^^ ^^ -doc.elements.each("//varlistentry/term") do |term| - ["varname", "function", "option", "replaceable"].each do |prev_name| - term.elements.each(prev_name) do |el| - if el.next_element and - el.next_element.name == "replaceable" and - el.next_sibling_node.class == Element - then - $touched = true - term.insert_after(el, Text.new(" ")) - end - end - end -end - - - -# -# nixos-option -# -# path <------ -# -# -# Generates: -Ipath -# ^^ -doc.elements.each("//cmdsynopsis/arg") do |term| - ["option", "replaceable"].each do |prev_name| - term.elements.each(prev_name) do |el| - if el.next_element and - el.next_element.name == "replaceable" and - el.next_sibling_node.class == Element - then - $touched = true - term.insert_after(el, Text.new(" ")) - end - end - end -end - -# -# -# -# -# -# -# -# -# -# -# name <---- -# -# -# Generates: [{--profile-name | -p }name] -# ^^^^ -doc.elements.each("//cmdsynopsis/arg") do |term| - ["group"].each do |prev_name| - term.elements.each(prev_name) do |el| - if el.next_element and - el.next_element.name == "replaceable" and - el.next_sibling_node.class == Element - then - $touched = true - term.insert_after(el, Text.new(" ")) - end - end - end -end - - -if $touched then - doc.context[:attribute_quote] = :quote - doc.write(output: File.open(filename, "w")) -end