mirror of
https://github.com/status-im/NimYAML.git
synced 2025-01-27 11:34:56 +00:00
Updated from master
This commit is contained in:
parent
185bb4582f
commit
6badec5c80
12
api.html
12
api.html
@ -11,9 +11,9 @@
|
||||
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</head>
|
||||
<body>
|
||||
<a href="https://github.com/flyx/NimYAML"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
|
||||
<a href="https://github.com/flyx/NimYAML"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 10;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
|
||||
<header>
|
||||
<a class="pagetitle" href="/">NimYAML</a>
|
||||
<a class="pagetitle" href="index.html">NimYAML</a>
|
||||
<a href="index.html">Home</a>
|
||||
<a href="testing.html">Testing Ground</a>
|
||||
<span>Docs:</span>
|
||||
@ -37,7 +37,11 @@
|
||||
|
||||
<h1 id="dumping-yaml">Dumping YAML</h1><p>Dumping is preferredly done with <a class="reference external" href="yaml.html#dump,K,Stream,PresentationStyle,TagStyle,AnchorStyle,int">dump</a>, which serializes a native Nim variable to a character stream. Like <tt class="docutils literal"><span class="pre">load</span></tt>, you can use the steps involved separately.</p>
|
||||
<p>You transform a variable into a <tt class="docutils literal"><span class="pre">YamlStream</span></tt> with <a class="reference external" href="yaml.html#represent,T,TagStyle,AnchorStyle">represent</a>. Depending on the <tt class="docutils literal"><span class="pre">AnchorStyle</span></tt> you specify, this will transform <tt class="docutils literal"><span class="pre">ref</span></tt> variables with multiple instances into anchored elements and aliases (for <tt class="docutils literal"><span class="pre">asTidy</span></tt> and <tt class="docutils literal"><span class="pre">asAlways</span></tt>) or write the same element into all places it occurs (for <tt class="docutils literal"><span class="pre">asNone</span></tt>). Be aware that if you use <tt class="docutils literal"><span class="pre">asNone</span></tt>, the value you serialize might not round-trip.</p>
|
||||
<p>Transforming a <tt class="docutils literal"><span class="pre">YamlStream</span></tt> into YAML character data is done with <a class="reference external" href="yaml.html#present,YamlStream,Stream,TagLibrary,PresentationStyle,int">present</a>. You can choose from multiple presentation styles. <tt class="docutils literal"><span class="pre">psJson</span></tt> is not able to process some features of <tt class="docutils literal"><span class="pre">YamlStream</span></tt> s, the other styles support all features and are guaranteed to round-trip to the same <tt class="docutils literal"><span class="pre">YamlStream</span></tt> if you parse the generated YAML character stream again. </p>
|
||||
<p>Transforming a <tt class="docutils literal"><span class="pre">YamlStream</span></tt> into YAML character data is done with <a class="reference external" href="yaml.html#present,YamlStream,Stream,TagLibrary,PresentationStyle,int">present</a>. You can choose from multiple presentation styles. <tt class="docutils literal"><span class="pre">psJson</span></tt> is not able to process some features of <tt class="docutils literal"><span class="pre">YamlStream</span></tt> s, the other styles support all features and are guaranteed to round-trip to the same <tt class="docutils literal"><span class="pre">YamlStream</span></tt> if you parse the generated YAML character stream again.</p>
|
||||
|
||||
<h1 id="the-document-object-model">The Document Object Model</h1><p>Much like XML, YAML also defines a <em>document object model</em>. If you cannot or do not want to load a YAML character stream to native Nim types, you can instead load it into a <tt class="docutils literal"><span class="pre">YamlDocument</span></tt>. This <tt class="docutils literal"><span class="pre">YamlDocument</span></tt> can also be serialized into a YAML character stream. All tags will be preserved exactly as they are when transforming from and to a <tt class="docutils literal"><span class="pre">YamlDocument</span></tt>. The only important thing to remember is that when a value has no tag, it will get the non-specific tag <tt class="docutils literal"><span class="pre">"!"</span></tt> for quoted scalars and <tt class="docutils literal"><span class="pre">"?"</span></tt> for all other nodes.</p>
|
||||
<p>While tags are preserved, anchors will be resolved during loading and re-added during serialization. It is allowed for a <tt class="docutils literal"><span class="pre">YamlNode</span></tt> to occur multiple times within a <tt class="docutils literal"><span class="pre">YamlDocument</span></tt>, in which case it will be serialized once and referred to afterwards via aliases.</p>
|
||||
<p>The document object model is provided for completeness, but you are encouraged to use native Nim types as start- or endpoint instead. That may be significantly faster, as every <tt class="docutils literal"><span class="pre">YamlNode</span></tt> is allocated on the heap and subject to garbage collection.</p>
|
||||
|
||||
|
||||
|
||||
@ -45,7 +49,7 @@
|
||||
<div class="twelve-columns footer">
|
||||
<span class="nim-sprite"></span>
|
||||
<br/>
|
||||
<small>Made with Nim. Generated: 2016-02-16 20:44:55 UTC</small>
|
||||
<small>Made with Nim. Generated: 2016-02-25 22:45:29 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -11,9 +11,9 @@
|
||||
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</head>
|
||||
<body>
|
||||
<a href="https://github.com/flyx/NimYAML"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
|
||||
<a href="https://github.com/flyx/NimYAML"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 10;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
|
||||
<header>
|
||||
<a class="pagetitle" href="/">NimYAML</a>
|
||||
<a class="pagetitle" href="index.html">NimYAML</a>
|
||||
<a href="index.html">Home</a>
|
||||
<a href="testing.html">Testing Ground</a>
|
||||
<span>Docs:</span>
|
||||
@ -89,7 +89,7 @@ nimble install nimyaml</pre>
|
||||
<div class="twelve-columns footer">
|
||||
<span class="nim-sprite"></span>
|
||||
<br/>
|
||||
<small>Made with Nim. Generated: 2016-02-16 20:44:55 UTC</small>
|
||||
<small>Made with Nim. Generated: 2016-02-25 22:45:29 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<svg version="1.1"
|
||||
baseProfile="full"
|
||||
width="600" height="340"
|
||||
width="600" height="420"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<defs>
|
||||
@ -47,6 +47,16 @@
|
||||
<path d="M 0 60 q 0 10 10 10 h 115" fill="transparent" stroke="black"/>
|
||||
<path d="M 225 70 h 90 q 10 0 10 -10 v -60" fill="transparent" stroke="black"/>
|
||||
</g>
|
||||
<g id="dom-right">
|
||||
<rect x="330" y="45" width="100" height="30" stroke="black" fill="white" stroke-width="1"/>
|
||||
<line x1="170" y1="60" x2="330" y2="60" stroke="black" stroke-width="2"/>
|
||||
<line x1="430" y1="60" x2="583" y2="60" stroke="black" stroke-width="2" marker-end="url(#Triangle)"/>
|
||||
</g>
|
||||
<g id="dom-left">
|
||||
<rect x="330" y="5" width="100" height="30" stroke="black" fill="white" stroke-width="1"/>
|
||||
<line x1="330" y1="20" x2="182" y2="20" stroke="black" stroke-width="2" marker-end="url(#Triangle)"/>
|
||||
<line x1="430" y1="20" x2="595" y2="20" stroke="black" stroke-width="2"/>
|
||||
</g>
|
||||
<g id="whole-right">
|
||||
<rect x="275" y="5" width="100" height="30" stroke="black" fill="white" stroke-width="1"/>
|
||||
<line x1="5" y1="20" x2="275" y2="20" stroke="black" stroke-width="2"/>
|
||||
@ -59,11 +69,11 @@
|
||||
</g>
|
||||
</defs>
|
||||
|
||||
<line x1="145" y1="0" x2="145" y2="340" stroke="gray"/>
|
||||
<line x1="145" y1="0" x2="145" y2="420" stroke="gray"/>
|
||||
<text x="55" y="25" fill="gray">Application</text>
|
||||
<text x="160" y="25" fill="gray">YAML</text>
|
||||
|
||||
<g id="boxes" text-anchor="middle" transform="translate(0 150)">
|
||||
<g id="boxes" text-anchor="middle" transform="translate(0 190)">
|
||||
<g id="native" transform="translate(0 0)">
|
||||
<use xlink:href="#box"/>
|
||||
<text x="60" y="25" font-style="italic">Native</text>
|
||||
@ -73,7 +83,9 @@
|
||||
<g id="representation" transform="translate(170 0)">
|
||||
<use xlink:href="#box"/>
|
||||
<text x="60" y="25" font-style="italic">Representation</text>
|
||||
<text x="60" y="45" font-weight="bold">not implemented</text>
|
||||
<a xlink:href="yaml.html#YamlDocument" target="_top">
|
||||
<text x="60" y="45" font-weight="bold">YamlDocument</text>
|
||||
</a>
|
||||
</g>
|
||||
|
||||
<g id="serialization" transform="translate(320 0)">
|
||||
@ -93,7 +105,7 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="atomics" text-anchor="middle" transform="translate(0 90)">
|
||||
<g id="atomics" text-anchor="middle" transform="translate(0 130)">
|
||||
<g id="represent" transform="translate(65 10)">
|
||||
<use xlink:href="#atomic-right-long"/>
|
||||
<text x="80" y="25" font-style="italic">represent</text>
|
||||
@ -101,7 +113,9 @@
|
||||
|
||||
<g id="serialize" transform="translate(235 10)">
|
||||
<use xlink:href="#atomic-right"/>
|
||||
<a xlink:href="yaml.html#serialize,YamlDocument,TagLibrary,AnchorStyle" target="_top">
|
||||
<text x="70" y="25" font-style="italic" font-weight="bold">serialize</text>
|
||||
</a>
|
||||
</g>
|
||||
|
||||
<g id="present" transform="translate(385 10)">
|
||||
@ -118,7 +132,9 @@
|
||||
|
||||
<g id="compose" transform="translate(235 120)">
|
||||
<use xlink:href="#atomic-left"/>
|
||||
<a xlink:href="yaml.html#compose,YamlStream,TagLibrary" target="_top">
|
||||
<text x="70" y="35" font-style="italic" font-weight="bold">compose</text>
|
||||
</a>
|
||||
</g>
|
||||
|
||||
<g id="parse" transform="translate(385 120)">
|
||||
@ -129,7 +145,7 @@
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<g id="skipping-things" text-anchor="middle" transform="translate(0 50)">
|
||||
<g id="skipping-things" text-anchor="middle" transform="translate(0 90)">
|
||||
<g id="skipping-represent" transform="translate(55 10)">
|
||||
<use xlink:href="#skipping-right"/>
|
||||
<a xlink:href="yaml.html#represent,T,TagStyle,AnchorStyle" target="_top">
|
||||
@ -151,7 +167,19 @@
|
||||
<text x="325" y="25" font-style="italic" font-weight="bold">dump</text>
|
||||
</a>
|
||||
</g>
|
||||
<g id="load" transform="translate(0 280)">
|
||||
<g id="dumpDOM">
|
||||
<use xlink:href="#dom-right"/>
|
||||
<a xlink:href="yaml.html#dumpDOM,YamlDocument,Stream,PresentationStyle,AnchorStyle,int" target="_top">
|
||||
<text x="380" y="65" font-weight="bold">dumpDOM</text>
|
||||
</a>
|
||||
</g>
|
||||
<g id="loadDOM" transform="translate(0 320)">
|
||||
<use xlink:href="#dom-left"/>
|
||||
<a xlink:href="yaml.html#loadDOM,Stream" target="_top">
|
||||
<text x="380" y="25" font-weight="bold">loadDOM</text>
|
||||
</a>
|
||||
</g>
|
||||
<g id="load" transform="translate(0 360)">
|
||||
<use xlink:href="#whole-left"/>
|
||||
<a xlink:href="yaml.html#load,Stream,K" target="_top">
|
||||
<text x="325" y="25" font-style="italic" font-weight="bold">load</text>
|
||||
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 8.5 KiB |
@ -11,9 +11,9 @@
|
||||
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||||
</head>
|
||||
<body>
|
||||
<a href="https://github.com/flyx/NimYAML"><img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
|
||||
<a href="https://github.com/flyx/NimYAML"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 10;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
|
||||
<header>
|
||||
<a class="pagetitle" href="/">NimYAML</a>
|
||||
<a class="pagetitle" href="index.html">NimYAML</a>
|
||||
<a href="index.html">Home</a>
|
||||
<a href="testing.html">Testing Ground</a>
|
||||
<span>Docs:</span>
|
||||
@ -129,7 +129,7 @@
|
||||
<div class="twelve-columns footer">
|
||||
<span class="nim-sprite"></span>
|
||||
<br/>
|
||||
<small>Made with Nim. Generated: 2016-02-16 20:44:55 UTC</small>
|
||||
<small>Made with Nim. Generated: 2016-02-25 22:45:29 UTC</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -12,7 +12,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<a class="pagetitle" href="/">NimYAML</a>
|
||||
<a class="pagetitle" href="index.html">NimYAML</a>
|
||||
<a href="index.html">Home</a>
|
||||
<a href="testing.html">Testing Ground</a>
|
||||
<span>Docs:</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user