Skip to content

Commit f5fc018

Browse files
authored
Finish tab and tab-item (#66)
1 parent 667b6d6 commit f5fc018

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/Elastic.Markdown/Myst/Directives/TabSetBlock.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Licensed to Elasticsearch B.V under one or more agreements.
22
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
33
// See the LICENSE file in the project root for more information
4-
using System.Xml;
5-
using System.Xml.Xsl;
64

75
namespace Elastic.Markdown.Myst.Directives;
86

@@ -26,17 +24,26 @@ public int FindIndex()
2624
public class TabItemBlock(DirectiveBlockParser parser, Dictionary<string, string> properties)
2725
: DirectiveBlock(parser, properties)
2826
{
29-
public override string Directive => "tab-set-item";
27+
public override string Directive => "tab-item";
3028

31-
public string Title { get; set; } = default!;
32-
public int Index { get; set; }
33-
public int TabSetIndex { get; set; }
29+
public string Title { get; private set; } = default!;
30+
public int Index { get; private set; }
31+
public int TabSetIndex { get; private set; }
32+
33+
public string? SyncKey { get; private set; }
34+
public bool Selected { get; private set; }
3435

3536
public override void FinalizeAndValidate(ParserContext context)
3637
{
37-
Title = Arguments ?? "Unnamed Tab";
38+
if (string.IsNullOrWhiteSpace(Arguments))
39+
EmitError(context, "{tab-item} requires an argument to name the tab.");
40+
41+
Title = Arguments ?? "{undefined}";
3842
Index = Parent!.IndexOf(this);
3943
TabSetIndex = Parent is TabSetBlock tb ? tb.FindIndex() : -1;
44+
45+
SyncKey = Prop("sync");
46+
Selected = PropBool("selected");
4047
}
4148

4249
}

0 commit comments

Comments
 (0)