Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove html tag escaping in chapter-single-definition.tmpl #47089

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api-ref-assets/templates/chapter-single-definition.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ guide. You can file document formatting bugs against the
{{if .Import}}`import "{{.Import}}"`{{end}}

{{range .Sections}}
{{.Description | replace "<" "\\<" }}
{{.Description}}

<hr>
{{range .Fields}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,37 @@ guide. You can file document formatting bugs against the
`import "k8s.io/apimachinery/pkg/api/resource"`


Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.
<p>Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors.</p>
<p>The serialization format is:</p>
<pre><code> &lt;quantity&gt; ::= &lt;signedNumber&gt;&lt;suffix&gt;

The serialization format is:
(Note that &lt;suffix&gt; may be empty, from the &quot;&quot; case in &lt;decimalSI&gt;.)

``` \<quantity> ::= \<signedNumber>\<suffix>
&lt;digit&gt; ::= 0 | 1 | ... | 9 &lt;digits&gt; ::= &lt;digit&gt; | &lt;digit&gt;&lt;digits&gt; &lt;number&gt; ::= &lt;digits&gt; | &lt;digits&gt;.&lt;digits&gt; | &lt;digits&gt;. | .&lt;digits&gt; &lt;sign&gt; ::= &quot;+&quot; | &quot;-&quot; &lt;signedNumber&gt; ::= &lt;number&gt; | &lt;sign&gt;&lt;number&gt; &lt;suffix&gt; ::= &lt;binarySI&gt; | &lt;decimalExponent&gt; | &lt;decimalSI&gt; &lt;binarySI&gt; ::= Ki | Mi | Gi | Ti | Pi | Ei

(Note that \<suffix> may be empty, from the "" case in \<decimalSI>.)
(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)

\<digit> ::= 0 | 1 | ... | 9 \<digits> ::= \<digit> | \<digit>\<digits> \<number> ::= \<digits> | \<digits>.\<digits> | \<digits>. | .\<digits> \<sign> ::= "+" | "-" \<signedNumber> ::= \<number> | \<sign>\<number> \<suffix> ::= \<binarySI> | \<decimalExponent> | \<decimalSI> \<binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei
&lt;decimalSI&gt; ::= m | &quot;&quot; | k | M | G | T | P | E

(International System of units; See: http://physics.nist.gov/cuu/Units/binary.html)
(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)

\<decimalSI> ::= m | "" | k | M | G | T | P | E
&lt;decimalExponent&gt; ::= &quot;e&quot; &lt;signedNumber&gt; | &quot;E&quot; &lt;signedNumber&gt;
</code></pre>
<p>No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.</p>
<p>When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.</p>
<p>Before serializing, Quantity will be put in &quot;canonical form&quot;. This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:</p>
<ul>
<li>No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.</li>
</ul>
<p>The sign will be omitted unless the number is negative.</p>
<p>Examples:</p>
<ul>
<li>1.5 will be serialized as &quot;1500m&quot; - 1.5Gi will be serialized as &quot;1536Mi&quot;</li>
</ul>
<p>Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.</p>
<p>Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)</p>
<p>This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.</p>

(Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.)

\<decimalExponent> ::= "e" \<signedNumber> | "E" \<signedNumber> ```

No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities.

When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized.

Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that:

- No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible.

The sign will be omitted unless the number is negative.

Examples:

- 1.5 will be serialized as "1500m" - 1.5Gi will be serialized as "1536Mi"

Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise.

Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.)

This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.

<hr>

Expand Down