commit
e092cb029c
252 files changed
+35037
No files matched your search
@@ -0,0 +1,68 @@
|
||||
---
|
||||
title: "Live views and listings"
|
||||
subtitle: "The app in the page, and the programs as text"
|
||||
---
|
||||
|
||||
A live view is the app itself, in an `<iframe>`, with the program carried in its URL. The reader can edit the program, step it and run it again. Their edits stay in their own browser, and **Reset** brings back the page's version. Live views need the network, where rendered views do not (see [Rendered views](index.qmd)).
|
||||
|
||||
## The whole playground
|
||||
|
||||
```markdown
|
||||
{{{< pplus-playground lingo="programs/count-base.lingo" pseudo="programs/count-base.pseudo" panel="flow" >}}}
|
||||
```
|
||||
|
||||
{{< pplus-playground lingo="programs/count-base.lingo" pseudo="programs/count-base.pseudo" panel="flow" >}}
|
||||
|
||||
Arrange it the way the playground's own controls do: the area, the tab it opens on, the build, the dock and the splits.
|
||||
|
||||
```markdown
|
||||
{{{< pplus-playground mojo="programs/count-base.mojo" area="dev" panel="compiler" dock="open" editor="0.6" >}}}
|
||||
```
|
||||
|
||||
## One view of it
|
||||
|
||||
`pplus-embed` shows one view with the code it reads. The views are `trace`, `table`, `flow`, `data`, `life`, `problems`, `proof`, `tests`, `compiler` and `asm`, or the name of a pane to show only that editor.
|
||||
|
||||
```markdown
|
||||
{{{< pplus-embed pseudo="programs/count-base.pseudo" view="trace" t="9" >}}}
|
||||
{{{< pplus-embed pseudo="programs/binary-search.pseudo" view="flow" height="auto" showcall="0" >}}}
|
||||
```
|
||||
|
||||
{{< pplus-embed pseudo="programs/count-base.pseudo" view="trace" t="9" >}}
|
||||
|
||||
The original shortcode, `{{{< pplus >}}}`, still works as it did. It takes the same options as `pplus-embed`, plus `show="listing"` and `show="both"`.
|
||||
|
||||
## Listings
|
||||
|
||||
`pplus-listing` prints the files as code blocks, highlighted by the syntax definitions the extension ships. The header lines (`// CALL:`, `// EXPECT:`) are left out, and a `.tex` file is typeset as equations.
|
||||
|
||||
```markdown
|
||||
{{{< pplus-listing pseudo="programs/count-base.pseudo" numbers="1" >}}}
|
||||
{{{< pplus-listing matho="programs/mean.tex" >}}}
|
||||
```
|
||||
|
||||
{{< pplus-listing pseudo="programs/count-base.pseudo" numbers="1" >}}
|
||||
|
||||
{{< pplus-listing matho="programs/mean.tex" >}}
|
||||
|
||||
`pplus-tabs` gives the files one tab each:
|
||||
|
||||
```markdown
|
||||
{{{< pplus-tabs lingo="programs/count-base.lingo" pseudo="programs/count-base.pseudo" mojo="programs/count-base.mojo" >}}}
|
||||
```
|
||||
|
||||
{{< pplus-tabs lingo="programs/count-base.lingo" pseudo="programs/count-base.pseudo" mojo="programs/count-base.mojo" >}}
|
||||
|
||||
## A link
|
||||
|
||||
```markdown
|
||||
{{{< pplus-link pseudo="programs/count-base.pseudo" text="Open count_base in Programming+" >}}}
|
||||
```
|
||||
|
||||
{{< pplus-link pseudo="programs/count-base.pseudo" text="Open count_base in Programming+" >}}
|
||||
|
||||
## Folded away
|
||||
|
||||
Any shortcode takes `collapse="1"`, which folds it into a block the reader opens:
|
||||
|
||||
{{< pplus-steps pseudo="programs/binary-search.pseudo" collapse="1" title="Show the binary search, step by step" >}}
|
||||
Reference in new issue
Block a user