From bb15dbcbaf39d4595feb9f12fd1716cbe06723a9 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 27 Jan 2024 20:49:43 -0500 Subject: [PATCH] Add support for optional pairs. --- src/OrgAst.module.css | 3 ++- src/OrgAst.module.css.d.ts | 1 + src/OrgAst.tsx | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/OrgAst.module.css b/src/OrgAst.module.css index 76bf9af..549d0ea 100644 --- a/src/OrgAst.module.css +++ b/src/OrgAst.module.css @@ -54,7 +54,8 @@ } .OrgAstProperties, -.OrgAstObjectTree { +.OrgAstObjectTree, +.OrgAstOptionalPair { border: 1px solid #000000; margin: 5px; diff --git a/src/OrgAst.module.css.d.ts b/src/OrgAst.module.css.d.ts index f2e03aa..4bfbc17 100644 --- a/src/OrgAst.module.css.d.ts +++ b/src/OrgAst.module.css.d.ts @@ -6,3 +6,4 @@ export const selected: string; export const hovered: string; export const OrgAstProperties: string; export const OrgAstObjectTree: string; +export const OrgAstOptionalPair: string; diff --git a/src/OrgAst.tsx b/src/OrgAst.tsx index b8a31d9..e07190a 100644 --- a/src/OrgAst.tsx +++ b/src/OrgAst.tsx @@ -258,6 +258,21 @@ const OrgPropertyValue = (props: { /> ); + } else if (is_optional_pair(props.value)) { + return ( + + + + + + + + + + + +
Optional value:{JSON.stringify(props.value.optval)}
Value:{JSON.stringify(props.value.val)}
+ ); } else if (is_object_tree(props.value)) { return (