Index: VERSION ================================================================== --- VERSION +++ VERSION @@ -1,1 +1,1 @@ -0.10.0 +0.11.0-dev Index: cmd/register.go ================================================================== --- cmd/register.go +++ cmd/register.go @@ -1,7 +1,7 @@ //----------------------------------------------------------------------------- -// Copyright (c) 2020-2022 Detlef Stern +// Copyright (c) 2020-2023 Detlef Stern // // This file is part of Zettelstore. // // Zettelstore is licensed under the latest version of the EUPL (European Union // Public License). Please see file LICENSE.txt for your rights and obligations @@ -20,15 +20,14 @@ _ "zettelstore.de/z/box/membox" // Allow to use in-memory box. _ "zettelstore.de/z/encoder/htmlenc" // Allow to use HTML encoder. _ "zettelstore.de/z/encoder/mdenc" // Allow to use markdown encoder. _ "zettelstore.de/z/encoder/sexprenc" // Allow to use sexpr encoder. _ "zettelstore.de/z/encoder/textenc" // Allow to use text encoder. - _ "zettelstore.de/z/encoder/zjsonenc" // Allow to use ZJSON encoder. _ "zettelstore.de/z/encoder/zmkenc" // Allow to use zmk encoder. _ "zettelstore.de/z/kernel/impl" // Allow kernel implementation to create itself _ "zettelstore.de/z/parser/blob" // Allow to use BLOB parser. _ "zettelstore.de/z/parser/draw" // Allow to use draw parser. _ "zettelstore.de/z/parser/markdown" // Allow to use markdown parser. _ "zettelstore.de/z/parser/none" // Allow to use none parser. _ "zettelstore.de/z/parser/plain" // Allow to use plain parser. _ "zettelstore.de/z/parser/zettelmark" // Allow to use zettelmark parser. ) Index: docs/manual/00001004051200.zettel ================================================================== --- docs/manual/00001004051200.zettel +++ docs/manual/00001004051200.zettel @@ -2,11 +2,11 @@ title: The ''file'' sub-command role: manual tags: #command #configuration #manual #zettelstore syntax: zmk created: 20210126175322 -modified: 20230109105434 +modified: 20230125222036 Reads zettel data from a file (or from standard input / stdin) and renders it to standard output / stdout. This allows Zettelstore to render files manually. ``` zettelstore file [-t FORMAT] [file-1 [file-2]] @@ -17,14 +17,13 @@ Supported values are: [[''html''|00001012920510]] (default), [[''md''|00001012920513]], [[''sexpr''|00001012920516]], [[''text''|00001012920519]], - [[''zjson''|00001012920503]] (deprecated in v0.11), and [[''zmk''|00001012920522]]. ; ''file-1'' : Specifies the file name, where at least metadata is read. If ''file-2'' is not given, the zettel content is also read from here. ; ''file-2'' : File name where the zettel content is stored. If neither ''file-1'' nor ''file-2'' are given, metadata and zettel content are read from standard input / stdin. Index: docs/manual/00001012920500.zettel ================================================================== --- docs/manual/00001012920500.zettel +++ docs/manual/00001012920500.zettel @@ -2,15 +2,14 @@ title: Encodings available via the [[API|00001012000000]] role: manual tags: #api #manual #reference #zettelstore syntax: zmk created: 20210126175322 -modified: 20230109104839 +modified: 20230125222102 A zettel representation can be encoded in various formats for further processing. * [[html|00001012920510]] * [[md|00001012920513]] * [[sexpr|00001012920516]] * [[text|00001012920519]] -* [[zjson|00001012920503]] (will be deprecated in v0.11) * [[zmk|00001012920522]] DELETED docs/manual/00001012920503.zettel Index: docs/manual/00001012920503.zettel ================================================================== --- docs/manual/00001012920503.zettel +++ docs/manual/00001012920503.zettel @@ -1,38 +0,0 @@ -id: 00001012920503 -title: ZJSON Encoding -role: manual -tags: #api #manual #reference #zettelstore -syntax: zmk -created: 20210126175322 -modified: 20230109104722 - -**Note**: ZJSON encoding will be deprecated in v0.11 ---- -A zettel representation that allows to process the syntactic structure of a zettel. -It is a JSON-based encoding format, but different to the structures returned by using the plain [[endpoint|00001012920000]] ''/z/{ID}''. - -For an example, take a look at the ZJSON encoding of this page, which is available via the ""Info"" sub-page of this zettel: - -* [[//z/00001012920503?enc=zjson&part=zettel]], -* [[//z/00001012920503?enc=zjson&part=meta]], -* [[//z/00001012920503?enc=zjson&part=content]]. - -If transferred via HTTP, the content type will be ''application/json''. - -A full zettel encoding results in a JSON object with two keys: ''"meta"'' and ''"content"''. -Both values are the same as if you have requested just the appropriate [[part|00001012920800]]. - -=== Encoding of metadata -Metadata encoding results in a JSON object, where each metadata key is mapped to the same JSON object name. -The associated value is itself a JSON object with two names. -The first name ``""`` references the [[metadata key type|00001006030000]]. -Depending on the key type, the other name denotes the value of the metadata element. -The meaning of these names is [[well defined|00001012920582]], as well as the [[mapping of key types to used object names|00001012920584]]. - -=== Encoding of zettel content -The content encoding results in a JSON array of objects, where each objects represents a Zettelmarkup element. - -Every [!zettelmarkup|Zettelmarkup] element is encoded as a JSON object. -These objects always contain the empty name ''""'' with a string value describing the type of Zettelmarkup element. -Depending on the type, other one letter names denotes the details of the element. -The meaning of these names is [[well defined|00001012920588]]. Index: docs/manual/00001012920516.zettel ================================================================== --- docs/manual/00001012920516.zettel +++ docs/manual/00001012920516.zettel @@ -2,17 +2,15 @@ title: Sexpr Encoding role: manual tags: #api #manual #reference #zettelstore syntax: zmk created: 20220422181104 -modified: 20230109104812 +modified: 20230125222210 A zettel representation that is a [[s-expression|https://en.wikipedia.org/wiki/S-expression]] (also known as symbolic expression). -It is an alternative to the [[ZJSON encoding|00001012920503]][^ZJSON will be deprecated in v0.11]. -Both encodings are (relatively) easy to parse and contain all relevant information of a zettel, metadata and content. - +It is (relatively) easy to parse and contain all relevant information of a zettel, metadata and content. For example, take a look at the Sexpr encoding of this page, which is available via the ""Info"" sub-page of this zettel: * [[//z/00001012920516?enc=sexpr&part=zettel]], * [[//z/00001012920516?enc=sexpr&part=meta]], * [[//z/00001012920516?enc=sexpr&part=content]]. DELETED docs/manual/00001012920582.zettel Index: docs/manual/00001012920582.zettel ================================================================== --- docs/manual/00001012920582.zettel +++ docs/manual/00001012920582.zettel @@ -1,16 +0,0 @@ -id: 00001012920582 -title: ZJSON Encoding: List of Valid Metadata Value Objects Names -role: manual -tags: #api #manual #reference #zettelstore -syntax: zmk -modified: 20230109104713 - -**Note**: ZJSON encoding will be deprecated in v0.11 ---- -Every Metadata value element is mapped to a JSON object with some well defined names / keys. - -|=Name | JSON Value | Meaning -| ''"\"'' | string | The type of the Zettelmarkup element. -| ''"i"'' | array | A sequence of [[inline-structured|00001007040000]] elements. -| ''"s"'' | string | The first / major string value of an element. -| ''"y"'' | array | A set of string values. DELETED docs/manual/00001012920584.zettel Index: docs/manual/00001012920584.zettel ================================================================== --- docs/manual/00001012920584.zettel +++ docs/manual/00001012920584.zettel @@ -1,30 +0,0 @@ -id: 00001012920584 -title: ZJSON Encoding: Mapping of Metadata Key Types to Object Names -role: manual -tags: #api #manual #reference #zettelstore -syntax: zmk -modified: 20230109104703 - -**Note**: ZJSON encoding will be deprecated in v0.11 ---- -Every [[Metadata key|00001006030000]] is mapped to an [[object name|00001012920582]] where its value is encoded. - -|=Type | JSON Object Name | Remark -| [[Credential|00001006031000]] | ''"s"'' | A string with the decrypted credential. -| [[EString|00001006031500]] | ''"s"'' | A possibly empty string. -| [[Identifier|00001006032000]] | ''"s"'' | A string containing a [[zettel identifier|00001006050000]]. -| [[IdentifierSet|00001006032500]] | ''"y"'' | An array of strings containing [[zettel identifier|00001006050000]]. -| [[Number|00001006033000]] | ''"s"'' | A string containing a numeric value. -| [[String|00001006033500]] | ''"s"'' | A non-empty string. -| [[TagSet|00001006034000]] | ''"y"'' | An array of string containing zettel tags. -| [[Timestamp|00001006034500]] | ''"s"'' | A string containing a timestamp in the format YYYYMMDDHHmmSS. -| [[URL|00001006035000]] | ''"s"'' | A string containing an URL. -| [[Word|00001006035500]] | ''"s"'' | A string containing a word (no space characters) -| [[WordSet|00001006036000]] | ''"y"'' | An array of strings containing words. -| [[Zettelmarkup|00001006036500]] | ''"i"'' | A sequence of [[inline-structured|00001007040000]] elements. - -Please note, that metadata is weakly typed. -Every metadata key expects a certain type. -But the user is free to enter something different. -For example, even if the metadata type is ""number"", its value could still be ""abc"". -However, the mapping itself is always valid. DELETED docs/manual/00001012920588.zettel Index: docs/manual/00001012920588.zettel ================================================================== --- docs/manual/00001012920588.zettel +++ docs/manual/00001012920588.zettel @@ -1,27 +0,0 @@ -id: 00001012920588 -title: ZJSON Encoding: List of Valid Zettelmarkup Element Objects Names -role: manual -tags: #api #manual #reference #zettelstore -syntax: zmk -modified: 20230109104648 - -**Note**: ZJSON encoding will be deprecated in v0.11 ---- - -Every [[Zettelmarkup|00001007000000]] element is mapped to a JSON object with some well defined names / keys. - -|=Name | JSON Value | Meaning -| ''"\"'' | string | The type of the Zettelmarkup element. -| ''"a"'' | object | Additional attributes of the element. -| ''"b"'' | array | A sequence of [[block-structured|00001007030000]] elements. -| ''"c"'' | array | A sequence of a sequence of (sub-) list elements or [[inline-structured|00001007040000]] elements. Used for nested lists. -| ''"d"'' | array | A sequence of description list elements, where each element is an object of a definition term and a list of descriptions. -| ''"e"'' | array | A sequence of descriptions: a JSON array of simple description, which is itself a JSON array of block structured elements. -| ''"i"'' | array | A sequence of [[inline-structured|00001007040000]] elements. -| ''"j"'' | object | An objects describing a BLOB element. -| ''"n"'' | number | A numeric value, e.g. for specifying the [[heading|00001007030300]] level. -| ''"o"'' | string | A base64 encoded binary value. Used in some BLOB elements. -| ''"p"'' | array | A sequence of two elements: a sequence of [[table|00001007031000]] header value, followed by a sequence of sequence of table row values. -| ''"q"'' | string | A second string value, if ''""s""'' is already used. -| ''"s"'' | string | The first / major string value of an element. -| ''"v"'' | string | A third string value, if ''""q""'' is already used. Index: encoder/encoder_blob_test.go ================================================================== --- encoder/encoder_blob_test.go +++ encoder/encoder_blob_test.go @@ -38,11 +38,10 @@ 0x55, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x63, 0x62, 0x00, 0x00, 0x00, 0x06, 0x00, 0x03, 0x36, 0x37, 0x7c, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, }, expect: expectMap{ - encoderZJSON: `[{"":"BLOB","q":[{"":"Text","s":"PNG"}],"s":"png","o":"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg=="}]`, encoderHTML: `

PNG

`, encoderSexpr: `((BLOB ((TEXT "PNG")) "png" "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAAAAAA6fptVAAAACklEQVR4nGNiAAAABgADNjd8qAAAAABJRU5ErkJggg=="))`, encoderText: "", encoderZmk: `%% Unable to display BLOB with description 'PNG' and syntax 'png'.`, }, Index: encoder/encoder_block_test.go ================================================================== --- encoder/encoder_block_test.go +++ encoder/encoder_block_test.go @@ -1,7 +1,7 @@ //----------------------------------------------------------------------------- -// Copyright (c) 2021-2022 Detlef Stern +// Copyright (c) 2021-2023 Detlef Stern // // This file is part of Zettelstore. // // Zettelstore is licensed under the latest version of the EUPL (European Union // Public License). Please see file LICENSE.txt for your rights and obligations @@ -13,11 +13,10 @@ var tcsBlock = []zmkTestCase{ { descr: "Empty Zettelmarkup should produce near nothing", zmk: "", expect: expectMap{ - encoderZJSON: `[]`, encoderHTML: "", encoderMD: "", encoderSexpr: `()`, encoderText: "", encoderZmk: useZmk, @@ -25,11 +24,10 @@ }, { descr: "Simple text: Hello, world", zmk: "Hello, world", expect: expectMap{ - encoderZJSON: `[{"":"Para","i":[{"":"Text","s":"Hello,"},{"":"Space"},{"":"Text","s":"world"}]}]`, encoderHTML: "

Hello, world

", encoderMD: "Hello, world", encoderSexpr: `((PARA (TEXT "Hello,") (SPACE) (TEXT "world")))`, encoderText: "Hello, world", encoderZmk: useZmk, @@ -37,11 +35,10 @@ }, { descr: "Simple block comment", zmk: "%%%\nNo\nrender\n%%%", expect: expectMap{ - encoderZJSON: `[{"":"CommentBlock","s":"No\nrender"}]`, encoderHTML: ``, encoderMD: "", encoderSexpr: `((VERBATIM-COMMENT () "No\nrender"))`, encoderText: ``, encoderZmk: useZmk, @@ -49,11 +46,10 @@ }, { descr: "Rendered block comment", zmk: "%%%{-}\nRender\n%%%", expect: expectMap{ - encoderZJSON: `[{"":"CommentBlock","a":{"-":""},"s":"Render"}]`, encoderHTML: "", encoderMD: "", encoderSexpr: `((VERBATIM-COMMENT (("-" "")) "Render"))`, encoderText: ``, encoderZmk: useZmk, @@ -61,11 +57,10 @@ }, { descr: "Simple Heading", zmk: `=== Top`, expect: expectMap{ - encoderZJSON: `[{"":"Heading","n":1,"s":"top","i":[{"":"Text","s":"Top"}]}]`, encoderHTML: "

Top

", encoderMD: "# Top", encoderSexpr: `((HEADING 1 () "top" "top" (TEXT "Top")))`, encoderText: `Top`, encoderZmk: useZmk, @@ -73,11 +68,10 @@ }, { descr: "Simple List", zmk: "* A\n* B\n* C", expect: expectMap{ - encoderZJSON: `[{"":"Bullet","c":[[{"":"Para","i":[{"":"Text","s":"A"}]}],[{"":"Para","i":[{"":"Text","s":"B"}]}],[{"":"Para","i":[{"":"Text","s":"C"}]}]]}]`, encoderHTML: "", encoderMD: "* A\n* B\n* C", encoderSexpr: `((UNORDERED ((TEXT "A")) ((TEXT "B")) ((TEXT "C"))))`, encoderText: "A\nB\nC", encoderZmk: useZmk, @@ -85,11 +79,10 @@ }, { descr: "Nested List", zmk: "* T1\n** T2\n* T3\n** T4\n** T5\n* T6", expect: expectMap{ - encoderZJSON: `[{"":"Bullet","c":[[{"":"Para","i":[{"":"Text","s":"T1"}]},{"":"Bullet","c":[[{"":"Para","i":[{"":"Text","s":"T2"}]}]]}],[{"":"Para","i":[{"":"Text","s":"T3"}]},{"":"Bullet","c":[[{"":"Para","i":[{"":"Text","s":"T4"}]}],[{"":"Para","i":[{"":"Text","s":"T5"}]}]]}],[{"":"Para","i":[{"":"Text","s":"T6"}]}]]}]`, encoderHTML: ``, encoderMD: "* T1\n * T2\n* T3\n * T4\n * T5\n* T6", encoderSexpr: `((UNORDERED ((PARA (TEXT "T1")) (UNORDERED ((TEXT "T2")))) ((PARA (TEXT "T3")) (UNORDERED ((TEXT "T4")) ((TEXT "T5")))) ((PARA (TEXT "T6")))))`, encoderText: "T1\nT2\nT3\nT4\nT5\nT6", encoderZmk: useZmk, @@ -97,11 +90,10 @@ }, { descr: "Sequence of two lists", zmk: "* Item1.1\n* Item1.2\n* Item1.3\n\n* Item2.1\n* Item2.2", expect: expectMap{ - encoderZJSON: `[{"":"Bullet","c":[[{"":"Para","i":[{"":"Text","s":"Item1.1"}]}],[{"":"Para","i":[{"":"Text","s":"Item1.2"}]}],[{"":"Para","i":[{"":"Text","s":"Item1.3"}]}],[{"":"Para","i":[{"":"Text","s":"Item2.1"}]}],[{"":"Para","i":[{"":"Text","s":"Item2.2"}]}]]}]`, encoderHTML: "", encoderMD: "* Item1.1\n* Item1.2\n* Item1.3\n* Item2.1\n* Item2.2", encoderSexpr: `((UNORDERED ((TEXT "Item1.1")) ((TEXT "Item1.2")) ((TEXT "Item1.3")) ((TEXT "Item2.1")) ((TEXT "Item2.2"))))`, encoderText: "Item1.1\nItem1.2\nItem1.3\nItem2.1\nItem2.2", encoderZmk: "* Item1.1\n* Item1.2\n* Item1.3\n* Item2.1\n* Item2.2", @@ -109,11 +101,10 @@ }, { descr: "Simple horizontal rule", zmk: `---`, expect: expectMap{ - encoderZJSON: `[{"":"Thematic"}]`, encoderHTML: "
", encoderMD: "---", encoderSexpr: `((THEMATIC ()))`, encoderText: ``, encoderZmk: useZmk, @@ -121,11 +112,10 @@ }, { descr: "No list after paragraph", zmk: "Text\n*abc", expect: expectMap{ - encoderZJSON: `[{"":"Para","i":[{"":"Text","s":"Text"},{"":"Soft"},{"":"Text","s":"*abc"}]}]`, encoderHTML: "

Text *abc

", encoderMD: "Text\n*abc", encoderSexpr: `((PARA (TEXT "Text") (SOFT) (TEXT "*abc")))`, encoderText: `Text *abc`, encoderZmk: useZmk, @@ -133,11 +123,10 @@ }, { descr: "A list after paragraph", zmk: "Text\n# abc", expect: expectMap{ - encoderZJSON: `[{"":"Para","i":[{"":"Text","s":"Text"}]},{"":"Ordered","c":[[{"":"Para","i":[{"":"Text","s":"abc"}]}]]}]`, encoderHTML: "

Text

  1. abc
", encoderMD: "Text\n\n1. abc", encoderSexpr: `((PARA (TEXT "Text")) (ORDERED ((TEXT "abc"))))`, encoderText: "Text\nabc", encoderZmk: useZmk, @@ -145,11 +134,10 @@ }, { descr: "Simple List Quote", zmk: "> ToBeOrNotToBe", expect: expectMap{ - encoderZJSON: `[{"":"Quotation","c":[[{"":"Para","i":[{"":"Text","s":"ToBeOrNotToBe"}]}]]}]`, encoderHTML: "

ToBeOrNotToBe

", encoderMD: "> ToBeOrNotToBe", encoderSexpr: `((QUOTATION ((TEXT "ToBeOrNotToBe"))))`, encoderText: "ToBeOrNotToBe", encoderZmk: useZmk, @@ -157,11 +145,10 @@ }, { descr: "Simple Quote Block", zmk: "<<<\nToBeOrNotToBe\n<<< Romeo", expect: expectMap{ - encoderZJSON: `[{"":"Excerpt","b":[{"":"Para","i":[{"":"Text","s":"ToBeOrNotToBe"}]}],"i":[{"":"Text","s":"Romeo"}]}]`, encoderHTML: "

ToBeOrNotToBe

Romeo
", encoderMD: "> ToBeOrNotToBe", encoderSexpr: `((REGION-QUOTE () ((PARA (TEXT "ToBeOrNotToBe"))) ((TEXT "Romeo"))))`, encoderText: "ToBeOrNotToBe\nRomeo", encoderZmk: useZmk, @@ -169,11 +156,10 @@ }, { descr: "Quote Block with multiple paragraphs", zmk: "<<<\nToBeOr\n\nNotToBe\n<<< Romeo", expect: expectMap{ - encoderZJSON: `[{"":"Excerpt","b":[{"":"Para","i":[{"":"Text","s":"ToBeOr"}]},{"":"Para","i":[{"":"Text","s":"NotToBe"}]}],"i":[{"":"Text","s":"Romeo"}]}]`, encoderHTML: "

ToBeOr

NotToBe

Romeo
", encoderMD: "> ToBeOr\n\n> NotToBe", encoderSexpr: `((REGION-QUOTE () ((PARA (TEXT "ToBeOr")) (PARA (TEXT "NotToBe"))) ((TEXT "Romeo"))))`, encoderText: "ToBeOr\nNotToBe\nRomeo", encoderZmk: useZmk, @@ -189,11 +175,10 @@ Paragraph Spacy Para """ Author`, expect: expectMap{ - encoderZJSON: "[{\"\":\"Poem\",\"b\":[{\"\":\"Para\",\"i\":[{\"\":\"Text\",\"s\":\"A\"},{\"\":\"Space\",\"s\":\"\u00a0\"},{\"\":\"Text\",\"s\":\"line\"},{\"\":\"Hard\"},{\"\":\"Space\",\"s\":\"\u00a0\u00a0\"},{\"\":\"Text\",\"s\":\"another\"},{\"\":\"Space\",\"s\":\"\u00a0\"},{\"\":\"Text\",\"s\":\"line\"},{\"\":\"Hard\"},{\"\":\"Text\",\"s\":\"Back\"}]},{\"\":\"Para\",\"i\":[{\"\":\"Text\",\"s\":\"Paragraph\"}]},{\"\":\"Para\",\"i\":[{\"\":\"Space\",\"s\":\"\u00a0\u00a0\u00a0\u00a0\"},{\"\":\"Text\",\"s\":\"Spacy\"},{\"\":\"Space\",\"s\":\"\u00a0\u00a0\"},{\"\":\"Text\",\"s\":\"Para\"}]}],\"i\":[{\"\":\"Text\",\"s\":\"Author\"}]}]", encoderHTML: "

A\u00a0line
\u00a0\u00a0another\u00a0line
Back

Paragraph

\u00a0\u00a0\u00a0\u00a0Spacy\u00a0\u00a0Para

Author
", encoderMD: "", encoderSexpr: "((REGION-VERSE () ((PARA (TEXT \"A\") (SPACE \"\u00a0\") (TEXT \"line\") (HARD) (SPACE \"\u00a0\u00a0\") (TEXT \"another\") (SPACE \"\u00a0\") (TEXT \"line\") (HARD) (TEXT \"Back\")) (PARA (TEXT \"Paragraph\")) (PARA (SPACE \"\u00a0\u00a0\u00a0\u00a0\") (TEXT \"Spacy\") (SPACE \"\u00a0\u00a0\") (TEXT \"Para\"))) ((TEXT \"Author\"))))", encoderText: "A line\n another line\nBack\nParagraph\n Spacy Para\nAuthor", encoderZmk: "\"\"\"\nA\u00a0line\\\n\u00a0\u00a0another\u00a0line\\\nBack\nParagraph\n\u00a0\u00a0\u00a0\u00a0Spacy\u00a0\u00a0Para\n\"\"\" Author", @@ -205,11 +190,10 @@ A simple span and much more :::`, expect: expectMap{ - encoderZJSON: `[{"":"Block","b":[{"":"Para","i":[{"":"Text","s":"A"},{"":"Space"},{"":"Text","s":"simple"},{"":"Soft"},{"":"Space"},{"":"Text","s":"span"},{"":"Soft"},{"":"Text","s":"and"},{"":"Space"},{"":"Text","s":"much"},{"":"Space"},{"":"Text","s":"more"}]}]}]`, encoderHTML: "

A simple span and much more

", encoderMD: "", encoderSexpr: `((REGION-BLOCK () ((PARA (TEXT "A") (SPACE) (TEXT "simple") (SOFT) (SPACE) (TEXT "span") (SOFT) (TEXT "and") (SPACE) (TEXT "much") (SPACE) (TEXT "more"))) ()))`, encoderText: `A simple span and much more`, encoderZmk: useZmk, @@ -217,11 +201,10 @@ }, { descr: "Simple Verbatim Code", zmk: "```\nHello\nWorld\n```", expect: expectMap{ - encoderZJSON: `[{"":"CodeBlock","s":"Hello\nWorld"}]`, encoderHTML: "
Hello\nWorld
", encoderMD: " Hello\n World", encoderSexpr: `((VERBATIM-CODE () "Hello\nWorld"))`, encoderText: "Hello\nWorld", encoderZmk: useZmk, @@ -229,11 +212,10 @@ }, { descr: "Simple Verbatim Code with visible spaces", zmk: "```{-}\nHello World\n```", expect: expectMap{ - encoderZJSON: `[{"":"CodeBlock","a":{"-":""},"s":"Hello World"}]`, encoderHTML: "
Hello\u2423World
", encoderMD: " Hello World", encoderSexpr: `((VERBATIM-CODE (("-" "")) "Hello World"))`, encoderText: "Hello World", encoderZmk: useZmk, @@ -241,11 +223,10 @@ }, { descr: "Simple Verbatim Eval", zmk: "~~~\nHello\nWorld\n~~~", expect: expectMap{ - encoderZJSON: `[{"":"EvalBlock","s":"Hello\nWorld"}]`, encoderHTML: "
Hello\nWorld
", encoderMD: "", encoderSexpr: `((VERBATIM-EVAL () "Hello\nWorld"))`, encoderText: "Hello\nWorld", encoderZmk: useZmk, @@ -253,11 +234,10 @@ }, { descr: "Simple Verbatim Math", zmk: "$$$\nHello\n\\LaTeX\n$$$", expect: expectMap{ - encoderZJSON: `[{"":"MathBlock","s":"Hello\n\\LaTeX"}]`, encoderHTML: "
Hello\n\\LaTeX
", encoderMD: "", encoderSexpr: `((VERBATIM-MATH () "Hello\n\\LaTeX"))`, encoderText: "Hello\n\\LaTeX", encoderZmk: useZmk, @@ -265,11 +245,10 @@ }, { descr: "Simple Description List", zmk: "; Zettel\n: Paper\n: Note\n; Zettelkasten\n: Slip box", expect: expectMap{ - encoderZJSON: `[{"":"Description","d":[{"i":[{"":"Text","s":"Zettel"}],"e":[[{"":"Para","i":[{"":"Text","s":"Paper"}]}],[{"":"Para","i":[{"":"Text","s":"Note"}]}]]},{"i":[{"":"Text","s":"Zettelkasten"}],"e":[[{"":"Para","i":[{"":"Text","s":"Slip"},{"":"Space"},{"":"Text","s":"box"}]}]]}]}]`, encoderHTML: "
Zettel
Paper
Note
Zettelkasten
Slip box
", encoderMD: "", encoderSexpr: `((DESCRIPTION ((TEXT "Zettel")) (((TEXT "Paper")) ((TEXT "Note"))) ((TEXT "Zettelkasten")) (((TEXT "Slip") (SPACE) (TEXT "box")))))`, encoderText: "Zettel\nPaper\nNote\nZettelkasten\nSlip box", encoderZmk: useZmk, @@ -277,11 +256,10 @@ }, { descr: "Simple Table", zmk: "|c1|c2|c3\n|d1||d3", expect: expectMap{ - encoderZJSON: `[{"":"Table","p":[[],[[{"i":[{"":"Text","s":"c1"}]},{"i":[{"":"Text","s":"c2"}]},{"i":[{"":"Text","s":"c3"}]}],[{"i":[{"":"Text","s":"d1"}]},{"i":[]},{"i":[{"":"Text","s":"d3"}]}]]]}]`, encoderHTML: `
c1c2c3
d1d3
`, encoderMD: "", encoderSexpr: `((TABLE () ((CELL (TEXT "c1")) (CELL (TEXT "c2")) (CELL (TEXT "c3"))) ((CELL (TEXT "d1")) (CELL) (CELL (TEXT "d3")))))`, encoderText: "c1 c2 c3\nd1 d3", encoderZmk: useZmk, @@ -292,11 +270,10 @@ zmk: `|h1>|=h2|h3:| |%--+---+---+ |","i":[{"":"Text","s":"h1"}]},{"i":[{"":"Text","s":"h2"}]},{"s":":","i":[{"":"Text","s":"h3"}]}],[[{"s":"<","i":[{"":"Text","s":"c1"}]},{"i":[{"":"Text","s":"c2"}]},{"s":":","i":[{"":"Text","s":"c3"}]}],[{"s":">","i":[{"":"Text","s":"f1"}]},{"i":[{"":"Text","s":"f2"}]},{"s":":","i":[{"":"Text","s":"=f3"}]}]]]}]`, encoderHTML: `
h1h2h3
c1c2c3
f1f2=f3
`, encoderMD: "", encoderSexpr: `((TABLE ((CELL-RIGHT (TEXT "h1")) (CELL (TEXT "h2")) (CELL-CENTER (TEXT "h3"))) ((CELL-LEFT (TEXT "c1")) (CELL (TEXT "c2")) (CELL-CENTER (TEXT "c3"))) ((CELL-RIGHT (TEXT "f1")) (CELL (TEXT "f2")) (CELL-CENTER (TEXT "=f3")))))`, encoderText: "h1 h2 h3\nc1 c2 c3\nf1 f2 =f3", encoderZmk: `|=h1>|=h2|=h3: @@ -306,11 +283,10 @@ }, { descr: "Simple Endnotes", zmk: `Text[^Footnote]`, expect: expectMap{ - encoderZJSON: `[{"":"Para","i":[{"":"Text","s":"Text"},{"":"Footnote","i":[{"":"Text","s":"Footnote"}]}]}]`, encoderHTML: `

Text1

  1. Footnote ↩︎
`, encoderMD: "Text", encoderSexpr: `((PARA (TEXT "Text") (FOOTNOTE () (TEXT "Footnote"))))`, encoderText: "Text Footnote", encoderZmk: useZmk, @@ -318,11 +294,10 @@ }, { descr: "Transclusion", zmk: `{{{http://example.com/image}}}{width="100px"}`, expect: expectMap{ - encoderZJSON: `[{"":"Transclude","a":{"width":"100px"},"q":"external","s":"http://example.com/image"}]`, encoderHTML: `

`, encoderMD: "", encoderSexpr: `((TRANSCLUDE (("width" "100px")) (EXTERNAL "http://example.com/image")))`, encoderText: "", encoderZmk: useZmk, @@ -330,11 +305,10 @@ }, { descr: "A paragraph with a inline comment only should be empty in HTML", zmk: `%% Comment`, expect: expectMap{ - encoderZJSON: `[{"":"Para","i":[{"":"Comment","s":"Comment"}]}]`, encoderHTML: ``, encoderSexpr: `((PARA (LITERAL-COMMENT () "Comment")))`, encoderText: "", encoderZmk: useZmk, }, @@ -341,11 +315,10 @@ }, { descr: "", zmk: ``, expect: expectMap{ - encoderZJSON: `[]`, encoderHTML: ``, encoderSexpr: `()`, encoderText: "", encoderZmk: useZmk, }, Index: encoder/encoder_inline_test.go ================================================================== --- encoder/encoder_inline_test.go +++ encoder/encoder_inline_test.go @@ -13,11 +13,10 @@ var tcsInline = []zmkTestCase{ { descr: "Empty Zettelmarkup should produce near nothing (inline)", zmk: "", expect: expectMap{ - encoderZJSON: `[]`, encoderHTML: "", encoderMD: "", encoderSexpr: `()`, encoderText: "", encoderZmk: useZmk, @@ -25,11 +24,10 @@ }, { descr: "Simple text: Hello, world (inline)", zmk: `Hello, world`, expect: expectMap{ - encoderZJSON: `[{"":"Text","s":"Hello,"},{"":"Space"},{"":"Text","s":"world"}]`, encoderHTML: "Hello, world", encoderMD: "Hello, world", encoderSexpr: `((TEXT "Hello,") (SPACE) (TEXT "world"))`, encoderText: "Hello, world", encoderZmk: useZmk, @@ -37,11 +35,10 @@ }, { descr: "Emphasized formatting", zmk: "__emph__", expect: expectMap{ - encoderZJSON: `[{"":"Emph","i":[{"":"Text","s":"emph"}]}]`, encoderHTML: "emph", encoderMD: "*emph*", encoderSexpr: `((FORMAT-EMPH () (TEXT "emph")))`, encoderText: "emph", encoderZmk: useZmk, @@ -49,11 +46,10 @@ }, { descr: "Strong formatting", zmk: "**strong**", expect: expectMap{ - encoderZJSON: `[{"":"Strong","i":[{"":"Text","s":"strong"}]}]`, encoderHTML: "strong", encoderMD: "__strong__", encoderSexpr: `((FORMAT-STRONG () (TEXT "strong")))`, encoderText: "strong", encoderZmk: useZmk, @@ -61,11 +57,10 @@ }, { descr: "Insert formatting", zmk: ">>insert>>", expect: expectMap{ - encoderZJSON: `[{"":"Insert","i":[{"":"Text","s":"insert"}]}]`, encoderHTML: "insert", encoderMD: "insert", encoderSexpr: `((FORMAT-INSERT () (TEXT "insert")))`, encoderText: "insert", encoderZmk: useZmk, @@ -73,11 +68,10 @@ }, { descr: "Delete formatting", zmk: "~~delete~~", expect: expectMap{ - encoderZJSON: `[{"":"Delete","i":[{"":"Text","s":"delete"}]}]`, encoderHTML: "delete", encoderMD: "delete", encoderSexpr: `((FORMAT-DELETE () (TEXT "delete")))`, encoderText: "delete", encoderZmk: useZmk, @@ -85,11 +79,10 @@ }, { descr: "Update formatting", zmk: "~~old~~>>new>>", expect: expectMap{ - encoderZJSON: `[{"":"Delete","i":[{"":"Text","s":"old"}]},{"":"Insert","i":[{"":"Text","s":"new"}]}]`, encoderHTML: "oldnew", encoderMD: "oldnew", encoderSexpr: `((FORMAT-DELETE () (TEXT "old")) (FORMAT-INSERT () (TEXT "new")))`, encoderText: "oldnew", encoderZmk: useZmk, @@ -97,11 +90,10 @@ }, { descr: "Superscript formatting", zmk: "^^superscript^^", expect: expectMap{ - encoderZJSON: `[{"":"Super","i":[{"":"Text","s":"superscript"}]}]`, encoderHTML: `superscript`, encoderMD: "superscript", encoderSexpr: `((FORMAT-SUPER () (TEXT "superscript")))`, encoderText: `superscript`, encoderZmk: useZmk, @@ -109,11 +101,10 @@ }, { descr: "Subscript formatting", zmk: ",,subscript,,", expect: expectMap{ - encoderZJSON: `[{"":"Sub","i":[{"":"Text","s":"subscript"}]}]`, encoderHTML: `subscript`, encoderMD: "subscript", encoderSexpr: `((FORMAT-SUB () (TEXT "subscript")))`, encoderText: `subscript`, encoderZmk: useZmk, @@ -121,11 +112,10 @@ }, { descr: "Quotes formatting", zmk: `""quotes""`, expect: expectMap{ - encoderZJSON: `[{"":"Quote","i":[{"":"Text","s":"quotes"}]}]`, encoderHTML: "quotes", encoderMD: "quotes", encoderSexpr: `((FORMAT-QUOTE () (TEXT "quotes")))`, encoderText: `quotes`, encoderZmk: useZmk, @@ -133,11 +123,10 @@ }, { descr: "Quotes formatting (german)", zmk: `""quotes""{lang=de}`, expect: expectMap{ - encoderZJSON: `[{"":"Quote","a":{"lang":"de"},"i":[{"":"Text","s":"quotes"}]}]`, encoderHTML: `quotes`, encoderMD: "quotes", encoderSexpr: `((FORMAT-QUOTE (("lang" "de")) (TEXT "quotes")))`, encoderText: `quotes`, encoderZmk: `""quotes""{lang="de"}`, @@ -145,11 +134,10 @@ }, { descr: "Span formatting", zmk: `::span::`, expect: expectMap{ - encoderZJSON: `[{"":"Span","i":[{"":"Text","s":"span"}]}]`, encoderHTML: `span`, encoderMD: "span", encoderSexpr: `((FORMAT-SPAN () (TEXT "span")))`, encoderText: `span`, encoderZmk: useZmk, @@ -157,11 +145,10 @@ }, { descr: "Code formatting", zmk: "``code``", expect: expectMap{ - encoderZJSON: `[{"":"Code","s":"code"}]`, encoderHTML: `code`, encoderMD: "`code`", encoderSexpr: `((LITERAL-CODE () "code"))`, encoderText: `code`, encoderZmk: useZmk, @@ -169,11 +156,10 @@ }, { descr: "Code formatting with visible space", zmk: "``x y``{-}", expect: expectMap{ - encoderZJSON: `[{"":"Code","a":{"-":""},"s":"x y"}]`, encoderHTML: "x\u2423y", encoderMD: "`x y`", encoderSexpr: `((LITERAL-CODE (("-" "")) "x y"))`, encoderText: `x y`, encoderZmk: useZmk, @@ -181,11 +167,10 @@ }, { descr: "HTML in Code formatting", zmk: "``