This commit is contained in:
scotttrinh 2020-12-19 19:53:57 +00:00
parent 8edb288c9a
commit 7c7252e369
2 changed files with 64 additions and 116 deletions

View File

@ -11,81 +11,61 @@
<link rel="stylesheet" href="/styles/global.css" /> <link rel="stylesheet" href="/styles/global.css" />
</head> </head>
<body> <body>
<main> <main><header class="py-10 bg-gray-300">
<header class="py-10 bg-gray-300">
<h1 class="text-4xl text-center">kdl - Kat's Document Language</h1> <h1 class="text-4xl text-center">kdl - Kat's Document Language</h1>
</header> </header>
<section class="kdl-section" id="description"> <section class="kdl-section" id="description">
<p> <p>kdl is a document language, mostly based on
kdl is a document language, mostly based on <a href="https://sdlang.org">SDLang</a>, with xml-like semantics that looks
<a href="https://sdlang.org/">SDLang</a>, with xml-like semantics that looks like you're invoking a bunch of CLI commands!</p>
like you're invoking a bunch of CLI commands! <p>It's meant to be used both as a serialization format and a configuration
</p> language, and is relatively light on syntax compared to XML.</p>
<p>
It's meant to be used both as a serialization format and a configuration
language, and is relatively light on syntax compared to XML.
</p>
</section> </section>
<section class="kdl-section" id="design-and-discussion"> <section class="kdl-section" id="design-and-discussion">
<h2>Design and Discussion</h2> <h2>Design and Discussion</h2>
<p> <p>kdl is still extremely new, and discussion about the format should happen
kdl is still extremely new, and discussion about the format should happen over on the
over on the <a href="https://github.com/kdoclang/kdl/discussions">discussions</a> page
<a href="https://github.com/kdoclang/kdl/discussions">discussions</a> page in the Github repo. Feel free to jump in and give us your 2 cents!</p>
in the Github repo. Feel free to jump in and give us your 2 cents!
</p>
</section> </section>
<section class="kdl-section" id="design-principles"> <section class="kdl-section" id="design-principles">
<h2>Design Principles</h2> <h2>Design Principles</h2>
<ol> <ol>
<li>Maintainability</li> <li>Maintainability</li>
<li>Flexibility</li> <li>Flexibility</li>
<li>Cognitive simplicity and Learnability</li> <li>Cognitive simplicity and Learnability</li>
<li>Ease of de/serialization</li> <li>Ease of de/serialization</li>
<li>Ease of implementation</li> <li>Ease of implementation</li>
</ol> </ol>
<p>These are the guiding principles behind the design of KDL, in order of
<p> importance. These principles will hopefully be useful in tie-breaking and
These are the guiding principles behind the design of KDL, in order of otherwise directing specific decisions when it comes down to it. They are
importance. These principles will hopefully be useful in tie-breaking and intentionally vague when it comes to specifics, but more concrete
otherwise directing specific decisions when it comes down to it. They are definitions for each one will be settled on as the project matures.</p>
intentionally vague when it comes to specifics, but more concrete
definitions for each one will be settled on as the project matures.
</p>
</section> </section>
<section class="kdl-section" id="overview"> <section class="kdl-section" id="overview">
<h2>Overview</h2> <h2>Overview</h2>
<p>The basic syntax is similar to SDLang:</p>
<p>The basic syntax is similar to SDLang:</p> <pre><code class="language-kdl">// This is a node with a single string value
title &quot;Hello, World&quot;
<pre>
<code>
// This is a node with a single string value
title "Hello, World"
// Multiple values are supported, too // Multiple values are supported, too
bookmarks 12 15 188 1234 bookmarks 12 15 188 1234
// Nodes can have properties // Nodes can have properties
author "Alex Monad" email="alex@example.com" active=true author &quot;Alex Monad&quot; email=&quot;alex@example.com&quot; active=true
// Nodes can be arbitrarily nested // Nodes can be arbitrarily nested
contents { contents {
section "First section" { section &quot;First section&quot; {
paragraph "This is the first paragraph" paragraph &quot;This is the first paragraph&quot;
paragraph "This is the second paragraph" paragraph &quot;This is the second paragraph&quot;
} }
} }
// Nodes can be separated into multiple lines // Nodes can be separated into multiple lines
title \ title \
"Some title" &quot;Some title&quot;
// Comment formats: // Comment formats:
@ -96,39 +76,34 @@ C style multiline
*/ */
tag /*foo=true*/ bar=false tag /*foo=true*/ bar=false
</code> </code></pre>
</pre> <p>But kdl changes a few details:</p>
<pre><code class="language-kdl">// Files must be utf8 encoded!
<p>But kdl changes a few details:</p> smile &quot;😁&quot;
<pre>
<code>
// Files must be utf8 encoded!
smile "😁"
// Instead of anonymous nodes, nodes and properties can be wrapped // Instead of anonymous nodes, nodes and properties can be wrapped
// in "" for arbitrary node names. // in &quot;&quot; for arbitrary node names.
"!@#$@$%Q#$%~@!40" "1.2.3" "!!!!!"=true &quot;!@#$@$%Q#$%~@!40&quot; &quot;1.2.3&quot; &quot;!!!!!&quot;=true
// The following is a legal bare identifier: // The following is a legal bare identifier:
foo123~!@#$%^&*.:'|<>/?+ "weeee" foo123~!@#$%^&amp;*.:'|&lt;&gt;/?+ &quot;weeee&quot;
// kdl specifically allows properties and values to be // kdl specifically allows properties and values to be
// interspersed with each other, much like CLI commands. // interspersed with each other, much like CLI commands.
foo bar=true "baz" quux=false 1 2 3 foo bar=true &quot;baz&quot; quux=false 1 2 3
// strings can be multiline as-is, without a different syntax. // strings can be multiline as-is, without a different syntax.
string "my string &quot;my
multiline multiline
value" value&quot;
// raw/unescaped strings use the "r" prefix on string literals and // raw/unescaped strings use the &quot;r&quot; prefix on string literals and
// otherwise behave the same, including multiline support. // otherwise behave the same, including multiline support.
raw r"C:\Users\kdl" raw r&quot;C:\Users\kdl&quot;
// You can add any number of # after the r and the last " to // You can add any number of # after the r and the last &quot; to
// disambiguate literal " characters. // disambiguate literal &quot; characters.
other-raw r#"hello"world"# other-raw r#&quot;hello&quot;world&quot;#
// There is a single decimal number type, much like JSON's. // There is a single decimal number type, much like JSON's.
num 1.234e-42 num 1.234e-42
@ -143,36 +118,32 @@ my-binary 0b1010_1101
// You can comment out individual nodes with /-. In the case below, everything // You can comment out individual nodes with /-. In the case below, everything
// up until the closing `}` becomes commented. // up until the closing `}` becomes commented.
/-mynode "foo" key=1 { /-mynode &quot;foo&quot; key=1 {
a a
b b
c c
} }
// You can apply /- ("slashdash") comments to individual values, properties, // You can apply /- (&quot;slashdash&quot;) comments to individual values, properties,
// or child blocks, too: // or child blocks, too:
mynode /-"commented" "not commented" /-key="value" /-{ mynode /-&quot;commented&quot; &quot;not commented&quot; /-key=&quot;value&quot; /-{
a a
b b
} }
</code> </code></pre>
</pre> <p>The following SDLang features are removed altogether:</p>
<ul>
<p>The following SDLang features are removed altogether:</p> <li>&quot;Anonymous&quot; nodes</li>
<li>Binary data literals</li>
<ul> <li>Date/time formats</li>
<li>"Anonymous" nodes</li> <li><code>on</code> and <code>off</code> booleans</li>
<li>Binary data literals</li> <li>Backtick strings</li>
<li>Date/time formats</li> <li>Semicolons</li>
<li><code>on</code> and <code>off</code> booleans</li> <li>Namespaces with <code>:</code></li>
<li>Backtick strings</li> <li>Shell style (<code>#</code>) and Lua style (<code>--</code>) comments</li>
<li>Semicolons</li> <li>Distinction between 32/64/128-bit numbers. There's just numbers.</li>
<li>Namespaces with <code>:</code></li> </ul>
<li>Shell style (<code>#</code>) and Lua style (<code>--</code>) comments</li>
<li>Distinction between 32/64/128-bit numbers. There's just numbers.</li>
</ul>
</section> </section>
</main> </main>
</body> </body>
</html> </html>

View File

@ -510,29 +510,10 @@ video {
height: auto; height: auto;
} }
.bg-gray-300 {
--tw-bg-opacity: 1;
background-color: rgba(209, 213, 219, var(--tw-bg-opacity));
}
.table { .table {
display: table; display: table;
} }
.contents {
display: contents;
}
.text-4xl {
font-size: 2.25rem;
line-height: 2.5rem;
}
.py-10 {
padding-top: 2.5rem;
padding-bottom: 2.5rem;
}
* { * {
--tw-shadow: 0 0 #0000; --tw-shadow: 0 0 #0000;
} }
@ -546,10 +527,6 @@ video {
--tw-ring-shadow: 0 0 #0000; --tw-ring-shadow: 0 0 #0000;
} }
.text-center {
text-align: center;
}
@-webkit-keyframes spin { @-webkit-keyframes spin {
to { to {
transform: rotate(360deg); transform: rotate(360deg);