forked from mirrors/nixpkgs
lib: turn *MD functions into aliases
with docbook gone and MD the default these aren't needed any more. we can't remove them yet because there's thousands of uses, but maybe some day we can.
This commit is contained in:
parent
20152b4269
commit
d36f950d40
|
@ -1146,14 +1146,11 @@ let
|
||||||
use = id;
|
use = id;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Transitional version of mkAliasOptionModule that uses MD docs. */
|
/* Transitional version of mkAliasOptionModule that uses MD docs.
|
||||||
mkAliasOptionModuleMD = from: to: doRename {
|
|
||||||
inherit from to;
|
This function is no longer necessary and merely an alias of `mkAliasOptionModule`.
|
||||||
visible = true;
|
*/
|
||||||
warn = false;
|
mkAliasOptionModuleMD = mkAliasOptionModule;
|
||||||
use = id;
|
|
||||||
markdown = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b
|
/* mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b
|
||||||
|
|
||||||
|
@ -1175,7 +1172,7 @@ let
|
||||||
(opt.highestPrio or defaultOverridePriority)
|
(opt.highestPrio or defaultOverridePriority)
|
||||||
(f opt.value);
|
(f opt.value);
|
||||||
|
|
||||||
doRename = { from, to, visible, warn, use, withPriority ? true, markdown ? false }:
|
doRename = { from, to, visible, warn, use, withPriority ? true }:
|
||||||
{ config, options, ... }:
|
{ config, options, ... }:
|
||||||
let
|
let
|
||||||
fromOpt = getAttrFromPath from options;
|
fromOpt = getAttrFromPath from options;
|
||||||
|
@ -1186,9 +1183,7 @@ let
|
||||||
{
|
{
|
||||||
options = setAttrByPath from (mkOption {
|
options = setAttrByPath from (mkOption {
|
||||||
inherit visible;
|
inherit visible;
|
||||||
description = if markdown
|
description = "Alias of {option}`${showOption to}`.";
|
||||||
then lib.mdDoc "Alias of {option}`${showOption to}`."
|
|
||||||
else "Alias of <option>${showOption to}</option>.";
|
|
||||||
apply = x: use (toOf config);
|
apply = x: use (toOf config);
|
||||||
} // optionalAttrs (toType != null) {
|
} // optionalAttrs (toType != null) {
|
||||||
type = toType;
|
type = toType;
|
||||||
|
|
|
@ -100,10 +100,7 @@ rec {
|
||||||
name: mkOption {
|
name: mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
example = true;
|
example = true;
|
||||||
description =
|
description = "Whether to enable ${name}.";
|
||||||
if name ? _type && name._type == "mdDoc"
|
|
||||||
then lib.mdDoc "Whether to enable ${name.text}."
|
|
||||||
else "Whether to enable ${name}.";
|
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,10 +182,10 @@ rec {
|
||||||
(if isList example then "pkgs." + concatStringsSep "." example else example);
|
(if isList example then "pkgs." + concatStringsSep "." example else example);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Like mkPackageOption, but emit an mdDoc description instead of DocBook. */
|
/* Alias of mkPackageOption. Previously used to create options with markdown
|
||||||
mkPackageOptionMD = pkgs: name: extra:
|
documentation, which is no longer required.
|
||||||
let option = mkPackageOption pkgs name extra;
|
*/
|
||||||
in option // { description = lib.mdDoc option.description; };
|
mkPackageOptionMD = mkPackageOption;
|
||||||
|
|
||||||
/* This option accepts anything, but it does not produce any result.
|
/* This option accepts anything, but it does not produce any result.
|
||||||
|
|
||||||
|
@ -347,11 +344,9 @@ rec {
|
||||||
literalExample = lib.warn "literalExample is deprecated, use literalExpression instead, or use literalMD for a non-Nix description." literalExpression;
|
literalExample = lib.warn "literalExample is deprecated, use literalExpression instead, or use literalMD for a non-Nix description." literalExpression;
|
||||||
|
|
||||||
/* Transition marker for documentation that's already migrated to markdown
|
/* Transition marker for documentation that's already migrated to markdown
|
||||||
syntax.
|
syntax. This is a no-op and no longer needed.
|
||||||
*/
|
*/
|
||||||
mdDoc = text:
|
mdDoc = lib.id;
|
||||||
if ! isString text then throw "mdDoc expects a string."
|
|
||||||
else { _type = "mdDoc"; inherit text; };
|
|
||||||
|
|
||||||
/* For use in the `defaultText` and `example` option attributes. Causes the
|
/* For use in the `defaultText` and `example` option attributes. Causes the
|
||||||
given MD text to be inserted verbatim in the documentation, for when
|
given MD text to be inserted verbatim in the documentation, for when
|
||||||
|
|
Loading…
Reference in a new issue