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

Pill 07: readable code form, fix to shell variable quoting #73

Closed
wants to merge 3 commits into from

Conversation

Anton-Latukha
Copy link
Contributor

@Anton-Latukha Anton-Latukha commented Aug 5, 2018

  • Now sets are readable and can be more easily understood.
  • Converted from DocBook to txt, because found no advantage for DocBook there.
  • Since warnings in nix-repl would popup - included that warnings, and explained that they are not relevant at that moment.
  • Fix shell variable quoting.

Copy link
Contributor

@jtojnar jtojnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plain text files will cause the nix-repl to be no longer formatted as screen dump and the user input will not be visually distinguished.

@@ -1,7 +0,0 @@
<screen xmlns="http://docbook.org/ns/docbook"><prompt>nix-repl> </prompt><userinput>:l &lt;nixpkgs></userinput>
<prompt>nix-repl> </prompt><userinput>simple = derivation { name = "simple"; builder = "${bash}/bin/bash"; args = [ ./simple_builder.sh ]; gcc = gcc; coreutils = coreutils; src = ./simple.c; system = builtins.currentSystem; }</userinput>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just change this input to multi-line – nix-repl supports line continuation after all.

@jtojnar
Copy link
Contributor

jtojnar commented Aug 5, 2018

It is weird that div.docbook code has white-space: normal even within pre, resulting in

image

instead of

image

(source: https://nixos.org/nixos/nix-pills/working-derivation.html)

@Anton-Latukha
Copy link
Contributor Author

Anton-Latukha commented Aug 6, 2018

Oh gush.

Do I and we really need to study a book on DocBook to make multi-lines.

If txt as is - is a way more handy, practical and works. And works a way better then DocBook, maybe we use txt, until someone makes DocBook work, and then convert txt's to DocBook.

Because seems like now we have both at the same time. And I not touched example right under changes (in "Enough of nix-repl") - because it presents formatted code block content, and it is txt example.

Or I need to also read a book to format code. Ok.

@Anton-Latukha
Copy link
Contributor Author

Anton-Latukha commented Aug 6, 2018

@jtojnar

I can make it multi-line by inserting line-breaks <sbr/>.
But sbr not encountered once, at this point, in the whole source code.

So should I do that? Or I need more research and do something else.

@Anton-Latukha
Copy link
Contributor Author

Anton-Latukha commented Aug 6, 2018

At this point I not found a better way for DocBook then to spam <sbr/>.

And this is the best professional suggestions found so far:


Chapter 27. Program listings

You can turn off interpretation of characters that would be recognized as XML markup by enclosing the text in a CDATA section.

(aka "disable the DocBook parsing for code blocks")

OR

Formatting listings

Formatting a program listing for HTML output is best handled by CSS.

(aka "if you use a DocBook to get HTML - avoid DocBook formatting in code blocks, and use CSS directly")


And it is a source "DocBook XSL: The Complete Guide, Fourth Edition": http://www.sagehill.net/docbookxsl/ProgramListings.html

@jtojnar
Copy link
Contributor

jtojnar commented Aug 6, 2018

TXT definitely works much worse than DocBook – it does not format the screen dump, nor does it distinguish between the user input and output.

The line breaks are there in the DocBook, you just need to fix the CSS (see the second screenshot above). Something like the following should work:

div.docbook pre code {
    white-space: pre;
}

@Anton-Latukha
Copy link
Contributor Author

Ok. Thank you. I really do not know CSS.

I would do my best, when I get back to this one.

@grahamc
Copy link
Member

grahamc commented Oct 1, 2018

I don't think so, the existing code is well structured and semantically nice. New submissions don't have to be so complicated, but there is not a good reason to undo it for the existing stuff. I'd be interested in PR to fix the whitespace handling.

@grahamc grahamc closed this Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants