-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more examples & small TOML improvement (#1917)
This adds some of the missing examples and makes a small improvement to TOML.
- Loading branch information
1 parent
4b6b6e8
commit 3e18124
Showing
9 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<h2>Full example</h2> | ||
<pre><code class="language-java">/** | ||
* Returns the value to which the specified key is mapped, | ||
* or {@code null} if this map contains no mapping for the key. | ||
* | ||
* <p>More formally, if this map contains a mapping from a key | ||
* {@code k} to a value {@code v} such that {@code (key==null ? k==null : | ||
* key.equals(k))}, then this method returns {@code v}; otherwise | ||
* it returns {@code null}. (There can be at most one such mapping.) | ||
* | ||
* <p>If this map permits null values, then a return value of | ||
* {@code null} does not <i>necessarily</i> indicate that the map | ||
* contains no mapping for the key; it's also possible that the map | ||
* explicitly maps the key to {@code null}. The {@link #containsKey | ||
* containsKey} operation may be used to distinguish these two cases. | ||
* | ||
* @param key the key whose associated value is to be returned | ||
* @return the value to which the specified key is mapped, or | ||
* {@code null} if this map contains no mapping for the key | ||
* @throws ClassCastException if the key is of an inappropriate type for | ||
* this map | ||
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>) | ||
* @throws NullPointerException if the specified key is null and this map | ||
* does not permit null keys | ||
* (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>) | ||
*/ | ||
V get(Object key); | ||
|
||
// Source: Java 1.8, Map#get(Object)</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h2>Full example</h2> | ||
<pre><code class="language-javascript">/** | ||
* @typedef {object} Foo | ||
* @property {string} bar | ||
* @memberof Baz | ||
*/ | ||
|
||
/** | ||
* Trims the given string. | ||
* | ||
* @param {string} [str=""] the string. | ||
* @returns {string} the trimmed string. | ||
* @throws {TypeError} if the argument is not a string. | ||
* @example trim(" hello ") | ||
*/ | ||
function trim(str = "") { | ||
if (typeof str != "string") { | ||
throw new TypeError("str has to be a string"); | ||
} | ||
return str.trim(); | ||
}</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<h2>Full example</h2> | ||
<pre><code class="language-php"><?php | ||
|
||
/** @var \DateTime[] An array of DateTime objects. */ | ||
/** @var string[] An array of string objects. */ | ||
/** @var callable[] An array of with callable functions or methods. */ | ||
|
||
/** @var \ArrayObject|\DateTime[] */ | ||
$dates = array() | ||
|
||
/** | ||
* @param bool|\DateTime $foo the first argument | ||
* @return string|null | ||
*/ | ||
function bar($foo) { ... }</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<h2>Full example</h2> | ||
<pre><code><#@ template hostspecific="false" language="C#" #> | ||
<#@ assembly name="System.Core.dll" #> | ||
<#@ output extension=".txt" #> | ||
<# | ||
using System.Collections.Generic; | ||
|
||
var numbers = new List<int> { 0, 1, 2, 3, 4, 5, 6, /* 7, */ 8, 9, 10 }; | ||
|
||
foreach (var i in numbers) | ||
{ | ||
#> | ||
The square of <#= i #> is <#= i * i #> | ||
<# | ||
} | ||
#></code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<h2>Full example</h2> | ||
<pre><code><#@ template hostspecific="false" language="VB" #> | ||
<#@ assembly name="System.Core.dll" #> | ||
<#@ output extension=".txt" #> | ||
<# | ||
Imports System.Collections.Generic | ||
|
||
Dim numbers() As Integer = { 0, 1, 2, 3, 4, 5, 6, 8, 9, 10 } | ||
' not including 7 | ||
|
||
For Each i In numbers | ||
#> | ||
The square of <#= i #> is <#= i * i #> | ||
<# | ||
Next | ||
#></code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<h2>Full example</h2> | ||
<pre><code># This is a comment | ||
|
||
key = "value" | ||
paths.home = 'c:\foo\' | ||
|
||
[database.prod] | ||
server = "192.168.1.1" | ||
ports = [ 8001, 8001, 8002 ] | ||
connection_max = 5000 | ||
enabled = true | ||
|
||
|
||
[[users]] | ||
name = "John" | ||
bday = 1995-09-22 | ||
bio = "" | ||
interests = [ "biking", "fishing" ] | ||
|
||
[[users]] | ||
name = "Jane" | ||
bday = 1989-05-09 | ||
bio = """\ | ||
Hi! | ||
|
||
I love programming!\ | ||
""" | ||
interests = [ "programming" ]</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters