summary refs log tree commit diff
path: root/doc
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2018-04-30 22:35:54 -0400
committerGraham Christensen <graham@grahamc.com>2018-04-30 22:37:58 -0400
commitab1648bf0d13afc19bdf7e3d092a3f7ce15a4de1 (patch)
treeb32ed86cc9db3763580a26abdbbb94052bf1e9e7 /doc
parent8cb0252b1e50a5236793e0fbf39b39510725ccf0 (diff)
downloadnixpkgs-ab1648bf0d13afc19bdf7e3d092a3f7ce15a4de1.tar
nixpkgs-ab1648bf0d13afc19bdf7e3d092a3f7ce15a4de1.tar.gz
nixpkgs-ab1648bf0d13afc19bdf7e3d092a3f7ce15a4de1.tar.bz2
nixpkgs-ab1648bf0d13afc19bdf7e3d092a3f7ce15a4de1.tar.lz
nixpkgs-ab1648bf0d13afc19bdf7e3d092a3f7ce15a4de1.tar.xz
nixpkgs-ab1648bf0d13afc19bdf7e3d092a3f7ce15a4de1.tar.zst
nixpkgs-ab1648bf0d13afc19bdf7e3d092a3f7ce15a4de1.zip
nixpkgs doc: add format Make target
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile7
-rw-r--r--doc/default.nix3
-rw-r--r--doc/shell.nix1
3 files changed, 9 insertions, 2 deletions
diff --git a/doc/Makefile b/doc/Makefile
index 952ef4bfcbb..8a4612e95f1 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,12 +1,17 @@
 MD_TARGETS=$(addsuffix .xml, $(basename $(wildcard ./*.md ./**/*.md)))
 
 .PHONY: all
-all: validate out/html/index.html out/epub/manual.epub
+all: validate format out/html/index.html out/epub/manual.epub
 
 .PHONY: debug
 debug:
 	nix-shell --run "xmloscopy --docbook5 ./manual.xml ./manual-full.xml"
 
+.PHONY: format
+format:
+	find . -iname '*.xml' -type f -print0 | xargs -0 -I{} -n1 \
+		xmlformat --config-file "$$XMLFORMAT_CONFIG" -i {}
+
 .PHONY: clean
 clean:
 	rm -f ${MD_TARGETS} .version manual-full.xml
diff --git a/doc/default.nix b/doc/default.nix
index e5be364506f..0d95d3f0457 100644
--- a/doc/default.nix
+++ b/doc/default.nix
@@ -7,7 +7,7 @@ in
 pkgs.stdenv.mkDerivation {
   name = "nixpkgs-manual";
 
-  buildInputs = with pkgs; [ pandoc libxml2 libxslt zip jing ];
+  buildInputs = with pkgs; [ pandoc libxml2 libxslt zip jing  xmlformat ];
 
   src = ./.;
 
@@ -18,6 +18,7 @@ pkgs.stdenv.mkDerivation {
   HIGHLIGHTJS = pkgs.documentation-highlighter;
   XSL = "${pkgs.docbook5_xsl}/xml/xsl";
   RNG = "${pkgs.docbook5}/xml/rng/docbook/docbook.rng";
+  XMLFORMAT_CONFIG = ../nixos/doc/xmlformat.conf;
   xsltFlags = lib.concatStringsSep " " [
     "--param section.autolabel 1"
     "--param section.label.includes.component.label 1"
diff --git a/doc/shell.nix b/doc/shell.nix
index 22590142ee1..e8da2eaf16b 100644
--- a/doc/shell.nix
+++ b/doc/shell.nix
@@ -1,4 +1,5 @@
 { pkgs ? import ../. {} }:
 (import ./default.nix).overrideAttrs (x: {
   buildInputs = x.buildInputs ++ [ pkgs.xmloscopy ];
+
 })