Revert "lib/options: Use escapeNixIdentifier for showOption"

This is used in in the manual generation for option identifiers that can
be linked. This, unike what the example describes, doesn't preserve
quotes which is needed for these identifiers to be valid.

This reverts commit 124cccbe3b.
This commit is contained in:
Daiderd Jordan 2020-04-14 20:29:37 +02:00
parent 1c951b1484
commit 31a03daa72
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
1 changed files with 8 additions and 7 deletions

View File

@ -200,13 +200,14 @@ rec {
Unlike attributes, options can also start with numbers: Unlike attributes, options can also start with numbers:
(showOption ["windowManager" "2bwm" "enable"]) == "windowManager.2bwm.enable" (showOption ["windowManager" "2bwm" "enable"]) == "windowManager.2bwm.enable"
*/ */
showOption = parts: showOption = parts: let
let
escapeOptionPart = part: escapeOptionPart = part:
if part == "*" || builtins.match "<.+>" part != null || builtins.match "[a-zA-Z0-9_][a-zA-Z0-9_'-]+" part != null let
escaped = lib.strings.escapeNixString part;
in if escaped == "\"${part}\""
then part then part
else escapeNixIdentifier part; else escaped;
in concatMapStringsSep "." escapeOptionPart parts; in (concatStringsSep ".") (map escapeOptionPart parts);
showFiles = files: concatStringsSep " and " (map (f: "`${f}'") files); showFiles = files: concatStringsSep " and " (map (f: "`${f}'") files);
unknownModule = "<unknown-file>"; unknownModule = "<unknown-file>";