This commit is contained in:
zkat 2024-12-22 21:43:35 +00:00
parent c12a5f8a2f
commit 55dc9dc498
1 changed files with 49 additions and 204 deletions

View File

@ -112,206 +112,51 @@ of some examples of KDL in the wild (either v1, v2, or both):</p>
</section> </section>
<section class="kdl-section" id="implementations"> <section class="kdl-section" id="implementations">
<h2>Implementations</h2> <h2>Implementations</h2>
<blockquote> <ul>
<p>There are two major versions of KDL. Different libraries may support one or the <li>C - <a href="https://github.com/tjol/ckdl">ckdl</a>*</li>
other, or even provide a &quot;hybrid&quot; mode where both versions are attempted, since <li>C#/.NET - <a href="https://github.com/oledfish/Kadlet">Kadlet</a></li>
there's no data ambiguity between v1 and v2 documents.</p> <li>C++ - <a href="https://github.com/tjol/ckdl">kdlpp</a>* (part of ckdl, requires C++20)</li>
</blockquote> <li>Common Lisp - <a href="https://github.com/chee/kdlcl">kdlcl</a></li>
<table> <li>Crystal - <a href="https://github.com/danini-the-panini/kdl-cr">kdl-cr</a></li>
<thead> <li>Dart - <a href="https://github.com/danini-the-panini/kdl-dart">kdl-dart</a></li>
<tr> <li>Elixir - <a href="https://github.com/IceDragon200/kuddle">kuddle</a>*</li>
<th>Language</th> <li>Go -
<th>Implementation</th> <ul>
<th>v1</th> <li><a href="https://github.com/lunjon/gokdl">gokdl</a></li>
<th>v2</th> <li><a href="https://github.com/sblinch/kdl-go">kdl-go</a></li>
<th>Notes</th> </ul>
</tr> </li>
</thead> <li>Haskell - <a href="https://github.com/fuzzypixelz/Hustle">Hustle</a></li>
<tbody> <li>Java - <a href="https://github.com/hkolbeck/kdl4j">kdl4j</a></li>
<tr> <li>JavaScript -
<td>C</td> <ul>
<td><a href="https://github.com/tjol/ckdl">ckdl</a></td> <li><a href="https://github.com/bgotink/kdl">@bgotink/kdl</a>* (Format/comment-preserving parser)</li>
<td></td> <li><a href="https://github.com/virtualstate/kdl">@virtualstate/kdl</a> (query only, JSX based)</li>
<td></td> <li><a href="https://github.com/kdl-org/kdljs">kdljs</a></li>
<td></td> </ul>
</tr> </li>
<tr> <li>Lua - <a href="https://github.com/danini-the-panini/kdlua">kdlua</a></li>
<td>C#/.NET</td> <li>Nim - <a href="https://github.com/Patitotective/kdl-nim">kdl-nim</a></li>
<td><a href="https://github.com/oledfish/Kadlet">Kadlet</a></td> <li>OCaml - <a href="https://github.com/Bannerets/ocaml-kdl">ocaml-kdl</a></li>
<td></td> <li>PHP - <a href="https://github.com/kdl-org/kdl-php">kdl-php</a></li>
<td>✖️</td> <li>Python -
<td></td> <ul>
</tr> <li><a href="https://github.com/tjol/ckdl">ckdl</a>*</li>
<tr> <li><a href="https://github.com/djmattyg007/python-cuddle">cuddle</a></li>
<td>C++</td> <li><a href="https://github.com/tabatkins/kdlpy">kdl-py</a>*</li>
<td><a href="https://github.com/tjol/ckdl">kdlpp</a></td> </ul>
<td></td> </li>
<td></td> <li>Ruby - <a href="https://github.com/danini-the-panini/kdl-rb">kdl-rb</a></li>
<td>part of ckdl, requires C++20</td> <li>Rust -
</tr> <ul>
<tr> <li><a href="https://github.com/kdl-org/kdl-rs">kdl-rs</a> (Format/comment-preserving parser)*</li>
<td>Common Lisp</td> <li><a href="https://crates.io/crates/knus/">knus</a> (Serde-<em>style</em> derive macros (not actual Serde))</li>
<td><a href="https://github.com/chee/kdlcl">kdlcl</a></td> </ul>
<td></td> </li>
<td>✖️</td> <li>Swift - <a href="https://github.com/danini-the-panini/kdl-swift">kdl-swift</a></li>
<td></td> <li>XSLT - <a href="https://github.com/Devasta/XML2KDL">xml2kdl</a></li>
</tr> </ul>
<tr> <p>* Supports both KDL v1 and v2</p>
<td>Crystal</td>
<td><a href="https://github.com/danini-the-panini/kdl-cr">kdl-cr</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Dart</td>
<td><a href="https://github.com/danini-the-panini/kdl-dart">kdl-dart</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Elixir</td>
<td><a href="https://github.com/IceDragon200/kuddle">kuddle</a></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Go</td>
<td><a href="https://github.com/lunjon/gokdl">gokdl</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Go</td>
<td><a href="https://github.com/sblinch/kdl-go">kdl-go</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Haskell</td>
<td><a href="https://github.com/fuzzypixelz/Hustle">Hustle</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Java</td>
<td><a href="https://github.com/hkolbeck/kdl4j">kdl4j</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>JavaScript</td>
<td><a href="https://github.com/bgotink/kdl">@bgotink/kdl</a></td>
<td></td>
<td></td>
<td>Format/comment-preserving parser</td>
</tr>
<tr>
<td>JavaScript</td>
<td><a href="https://github.com/virtualstate/kdl">@virtualstate/kdl</a></td>
<td></td>
<td>✖️</td>
<td>query only, JSX based</td>
</tr>
<tr>
<td>JavaScript</td>
<td><a href="https://github.com/kdl-org/kdljs">kdljs</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Lua</td>
<td><a href="https://github.com/danini-the-panini/kdlua">kdlua</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Nim</td>
<td><a href="https://github.com/Patitotective/kdl-nim">kdl-nim</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>OCaml</td>
<td><a href="https://github.com/Bannerets/ocaml-kdl">ocaml-kdl</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>PHP</td>
<td><a href="https://github.com/kdl-org/kdl-php">kdl-php</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Python</td>
<td><a href="https://github.com/tjol/ckdl">ckdl</a></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Python</td>
<td><a href="https://github.com/djmattyg007/python-cuddle">cuddle</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Python</td>
<td><a href="https://github.com/tabatkins/kdlpy">kdl-py</a></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Ruby</td>
<td><a href="https://github.com/danini-the-panini/kdl-rb">kdl-rb</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>Rust</td>
<td><a href="https://github.com/kdl-org/kdl-rs">kdl-rs</a></td>
<td></td>
<td></td>
<td>Format/comment-preserving parser</td>
</tr>
<tr>
<td>Rust</td>
<td><a href="https://crates.io/crates/knus/">knus</a></td>
<td></td>
<td>✖️</td>
<td>Serde-<em>style</em> derive macros (not actual Serde)</td>
</tr>
<tr>
<td>Swift</td>
<td><a href="https://github.com/danini-the-panini/kdl-swift">kdl-swift</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
<tr>
<td>XSLT</td>
<td><a href="https://github.com/Devasta/XML2KDL">xml2kdl</a></td>
<td></td>
<td>✖️</td>
<td></td>
</tr>
</tbody>
</table>
</section> </section>
<section class="kdl-section" id="editor-support"> <section class="kdl-section" id="editor-support">
<h2>Editor Support</h2> <h2>Editor Support</h2>
@ -347,18 +192,18 @@ children.</p>
<span class="line"></span></code></pre> <span class="line"></span></code></pre>
<p>Nodes without children are terminated by a newline, a semicolon, or the end of <p>Nodes without children are terminated by a newline, a semicolon, or the end of
a file stream:</p> a file stream:</p>
<pre class="shiki nord" style="background-color:#2e3440ff;color:#d8dee9ff" tabindex="0"><code><span class="line"><span style="color:#81A1C1">node1</span><span style="color:#D8DEE9FF">;</span><span style="color:#81A1C1"> node2</span><span style="color:#D8DEE9FF">;</span><span style="color:#81A1C1"> node3</span><span style="color:#D8DEE9FF">;</span></span> <pre class="shiki nord" style="background-color:#2e3440ff;color:#d8dee9ff" tabindex="0"><code><span class="line"><span style="color:#81A1C1">node1</span><span style="color:#D8DEE9FF">;</span><span style="color:#81A1C1"> node2</span><span style="color:#D8DEE9FF">;</span><span style="color:#81A1C1"> node3</span></span>
<span class="line"></span></code></pre> <span class="line"></span></code></pre>
<h3>Values</h3> <h3>Values</h3>
<p>KDL supports 4 data types:</p> <p>KDL supports 4 data types:</p>
<ul> <ul>
<li>Strings: <code>unquoted</code>, <code>&quot;hello world&quot;</code>, or <code>#&quot;hello world&quot;#</code></li> <li>Strings: <code>unquoted</code>, <code>&quot;hello world&quot;</code>, or <code>#&quot;hello world&quot;#</code></li>
<li>Numbers: <code>123.45</code></li> <li>Numbers: <code>123.45</code>, <code>0xdeadbeef</code>, <code>#inf</code>, <code>#-inf</code>, <code>#nan</code></li>
<li>Booleans: <code>#true</code> and <code>#false</code></li> <li>Booleans: <code>#true</code> and <code>#false</code></li>
<li>Null: <code>#null</code></li> <li>Null: <code>#null</code></li>
</ul> </ul>
<h4>Strings</h4> <h4>Strings</h4>
<p>It supports three different formats for string input: identifiers, quoted, and raw.</p> <p>It supports three different formats for string input: unquoted, quoted, and raw.</p>
<pre class="shiki nord" style="background-color:#2e3440ff;color:#d8dee9ff" tabindex="0"><code><span class="line"><span style="color:#81A1C1">node1</span><span style="color:#A3BE8C"> this-is-a-string</span></span> <pre class="shiki nord" style="background-color:#2e3440ff;color:#d8dee9ff" tabindex="0"><code><span class="line"><span style="color:#81A1C1">node1</span><span style="color:#A3BE8C"> this-is-a-string</span></span>
<span class="line"><span style="color:#81A1C1">node2</span><span style="color:#A3BE8C"> "this</span><span style="color:#EBCB8B">\n</span><span style="color:#A3BE8C">has</span><span style="color:#EBCB8B">\t</span><span style="color:#A3BE8C">escapes"</span></span> <span class="line"><span style="color:#81A1C1">node2</span><span style="color:#A3BE8C"> "this</span><span style="color:#EBCB8B">\n</span><span style="color:#A3BE8C">has</span><span style="color:#EBCB8B">\t</span><span style="color:#A3BE8C">escapes"</span></span>
<span class="line"><span style="color:#81A1C1">node3</span><span style="color:#A3BE8C"> #"C:\Users\zkat\raw\string"#</span></span> <span class="line"><span style="color:#81A1C1">node3</span><span style="color:#A3BE8C"> #"C:\Users\zkat\raw\string"#</span></span>
@ -571,7 +416,7 @@ some other reason have need to write &quot;JSON in KDL&quot;, <a href="https://g
microsyntax for losslessly encoding microsyntax for losslessly encoding
JSON</a>.</p> JSON</a>.</p>
<h4>What about TOML?</h4> <h4>What about TOML?</h4>
<p>It nests very poorly. It doesn't fare well with large files.</p> <p>It nests very poorly. It doesn't fare well with large files. Also, I felt some discomfort <a href="https://en.wikipedia.org/wiki/Tom_Preston-Werner#Resignation_from_GitHub">continuing to use and promote something by its creator</a>.</p>
<h4>What about XML?</h4> <h4>What about XML?</h4>
<p>XML is actually pretty fantastic, and has long been a standard for data <p>XML is actually pretty fantastic, and has long been a standard for data
exchange across many industries. At the same time, XML is known to be very exchange across many industries. At the same time, XML is known to be very