Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/doc/manual: print context on failing xmllint validation #31806

Merged
merged 1 commit into from Nov 22, 2017

Conversation

Profpatsch
Copy link
Member

Previously only the line numbers of a giant, internally generated XML file were
printed, without any kind of debuggability.
Now at least the mentioned lines are printed with a little bit of surrounding
context (to have something to grep for).

manual-combined.xml:4863: element para: Relax-NG validity error : Did not expect element para there
  4859	<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" xml:id="sec-writing-modules">
  4860
  4861	<title>Writing NixOS Modules</title>
  4862
  4863	<para>NixOS has a modular system for declarative configuration.  This
  4864	system combines multiple <emphasis>modules</emphasis> to produce the
  4865	full system configuration.  One of the modules that constitute the

Previously only the line numbers of a giant, internally generated XML file were
printed, without any kind of debuggability.
Now at least the mentioned lines are printed with a little bit of surrounding
context (to have something to grep for).

```
manual-combined.xml:4863: element para: Relax-NG validity error : Did not expect element para there
  4859	<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude" version="5.0" xml:id="sec-writing-modules">
  4860
  4861	<title>Writing NixOS Modules</title>
  4862
  4863	<para>NixOS has a modular system for declarative configuration.  This
  4864	system combines multiple <emphasis>modules</emphasis> to produce the
  4865	full system configuration.  One of the modules that constitute the
```
@Profpatsch
Copy link
Member Author

Update: added comments, print to stderr like the original xmllint output.

@grahamc
Copy link
Member

grahamc commented Nov 21, 2017

I love the output, I don't love that we have to do it ourselves. Can you think of an easy way to apply this to the nixpkgs docs too?

@Profpatsch
Copy link
Member Author

Profpatsch commented Nov 21, 2017

I love the output, I don't love that we have to do it ourselves.
Sure; on the other hand they use a pretty standard format for error messages (file:linenumber).

Can you think of an easy way to apply this to the nixpkgs docs too?

Should be possible, but we already use jing for that it seems?

    xmllint --nonet --xinclude --noxincludenode manual.xml --output manual-full.xml
    ${pkgs.jing}/bin/jing ${pkgs.docbook5}/xml/rng/docbook/docbook.rng manual-full.xml

afaik that gives better output. See #14320

@Profpatsch
Copy link
Member Author

@grahamc Do you think we can merge?

@grahamc
Copy link
Member

grahamc commented Nov 22, 2017 via email

@Profpatsch Profpatsch merged commit f09f49d into NixOS:master Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants