Skip to content

Commit

Permalink
Merge branch 'main' into bmorelli25-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mpdreamz authored Dec 18, 2024
2 parents 5c5c4b5 + 614082b commit 63947ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Elastic.Markdown/Myst/Directives/AdmonitionBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public string Title
public override void FinalizeAndValidate(ParserContext context)
{
CrossReferenceName = Properties.GetValueOrDefault("name");
DropdownOpen = PropBool("open");
DropdownOpen = TryPropBool("open");
if (DropdownOpen.HasValue)
Classes = "dropdown";
}
Expand Down
10 changes: 10 additions & 0 deletions src/Elastic.Markdown/Myst/Directives/DirectiveBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ protected bool PropBool(params string[] keys)
return bool.TryParse(value, out var result) && result;
}

protected bool? TryPropBool(params string[] keys)
{
var value = Prop(keys);
if (string.IsNullOrEmpty(value))
return keys.Any(k => Properties.ContainsKey(k)) ? true : null;

return bool.TryParse(value, out var result) ? result : null;
}


protected string? Prop(params string[] keys)
{
foreach (var key in keys)
Expand Down

0 comments on commit 63947ea

Please sign in to comment.