|
|
| Line 3: |
Line 3: |
| == Freedom begins under this line == | | == Freedom begins under this line == |
|
| |
|
| This page demonstrates the instance's '''multi-line content''' capability: content items (quotations, math, code) can now hold genuinely multi-line payloads. Multi-line payloads are stored '''backslash-escaped''' — the wiki's string values reject raw line breaks — and '''decoded at render time'''. Everything below is live data: edit the item and this page updates by itself.
| | <uml> |
| | @startuml |
| | !theme bluegray |
| | hide circle |
| | skinparam classAttributeIconSize 0 |
|
| |
|
| === 1. The multi-line item ===
| | class Session { |
| | } |
|
| |
|
| [[Item:Q1129|Bernoulli numbers in Python]] is a code-snippet item whose payload is a real 12-line Python program — an Akiyama–Tanigawa computation of the Bernoulli numbers, echoing the algorithm Ada Lovelace sketched in her 1843 note. Earlier code items (e.g. [[Item:Q99|Factorial in Python]]) were single-line only, squeezed onto one line; this one keeps its real shape.
| | class "Process Group" as PG { |
| | } |
|
| |
|
| {| class="wikitable"
| | class Process { |
| ! Kind !! Item !! Live data rendered from statements
| | } |
| |-
| |
| | Code snippet || [[Item:Q1129|Bernoulli numbers in Python]] || instance of: {{#statements:P1|from=Q1129}} · language: {{#statements:P5|from=Q1129}} · attributed to: {{#statements:P6|from=Q1129}} · source: {{#statements:P28|from=Q1129}}
| |
| |-
| |
| | Person || [[Item:Q94|Ada Lovelace]] || instance of: {{#statements:P1|from=Q94}}
| |
| |-
| |
| | Book (citable source) || [[Item:Q95|Notes by the Translator]] || author: {{#statements:P6|from=Q95}} · publisher: {{#statements:P54|from=Q95}} · year: {{#statements:P8|from=Q95}}
| |
| |}
| |
|
| |
|
| === 2. How the payload is stored ===
| | Session *-- PG : contains 1+ |
| | | PG *-- Process : contains 1+ |
| The stored statement escapes each line break as a two-character <code>\n</code> sequence (and <code>\t</code> for tabs, <code>\r</code> for carriage returns, <code>\\</code> for backslashes — backslashes first, so a literal <code>\n</code> inside the code survives the round trip). The <nowiki>{{#statements:}}</nowiki> parser function shows the raw, escaped value — one long line, exactly what storage holds:
| | @enduml |
| | | </uml> |
| <code>{{#statements:P3|from=Q1129}}</code>
| |
| | |
| === 3. How it renders ===
| |
| | |
| ==== The embed surface ====
| |
| | |
| The standalone embed decodes the payload — real line breaks, no escape sequences: [https://wikibase.ronzz.org/wiki/Special:Embed/Q1129 rendered embed]. (The sanitizer strips <code>iframe</code> tags from wiki pages, so on-wiki the reliable surface is this URL — which also feeds the citation auto-collect in § 4.)
| |
| | |
| ==== On this page ====
| |
| | |
| The <nowiki>{{#content:}}</nowiki> parser function is the on-wiki decoder — it returns the same payload with the escapes undone:
| |
| | |
| <div style="border:1px solid #c8ccd1; border-left:4px solid #36c; padding:0.75em 1em; background:#f8f9fa;">{{#content:Q1129}}</div>
| |
| | |
| That is the decoded payload rendered live: each line of the program is on its own line, indentation preserved, no <code>\n</code> in sight.
| |
| | |
| === 4. Citations and bibliography ===
| |
| | |
| The snippet's source, [[Item:Q95|Notes by the Translator]] (Ada Lovelace, 1843), is cited inline:<ref>{{#cite:Q95}}</ref> Lovelace's note described the computation of Bernoulli numbers on the Analytical Engine — widely regarded as the first published computer program, and the direct inspiration for this snippet.<ref>{{#cite:Q95}}</ref>
| |
| | |
| The Babbage quotation [[Item:Q1086|Pray, Mr. Babbage, …]] embeds the same way: [https://wikibase.ronzz.org/wiki/Special:Embed/Q1086 rendered embed] — its source is collected automatically too.
| |
| | |
| ==== Bibliography ====
| |
| | |
| <references/>
| |
| | |
| ==== Sources collected automatically ====
| |
| | |
| The <nowiki>{{#citations:}}</nowiki> collector gathers the same sources here — deduplicated across the inline citations above and the embed URLs in § 3:
| |
| | |
| {{#citations:}}
| |
| | |
| === 5. Try it yourself ===
| |
| | |
| * Open [[Item:Q1129]] and edit its <code>code source</code> statement — § 3 updates immediately.
| |
| * See the help pages: [[Help:Contributing/code]], [[Help:Contributing/citations]], [[Help:Contributing/semanticDynamicContent]], [[Help:Contributing/quotation]], [[Help:Contributing/math]].
| |
This is a scratch page. You can do whatever to it below this line
Freedom begins under this line