Skip to content
Merged
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
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ window.__glpythonMount = (args, send) => {
const libraryUrls = options.filter((option) => /^https?:\/\//.test(option))
// "features=run,repl,…" shows only these parts (the course builds its
// profiles from it); without it, everything shows - except "coverage"
// (after Tests, the lines no example executed), which a course switches on
// (after Tests, the lines no example executed) and "listtree" (lists such
// as ["+", 2, 3] also drawn as a tree), which a course switches on
// explicitly. "large" enlarges the code and the visualizer, e.g. for a demo
// on the projector.
const featureNames = ["run", "tests", "visualize", "reset", "repl", "export", "ide", "coverage"]
const featureNames = ["run", "tests", "visualize", "reset", "repl", "export", "ide", "coverage", "listtree"]
const featuresOption = options.find((option) => option.startsWith("features="))
const requestedFeatures = featuresOption ? featuresOption.slice("features=".length).split(",").map((name) => name.trim()).filter(Boolean) : featureNames.filter((name) => name !== "coverage")
const requestedFeatures = featuresOption ? featuresOption.slice("features=".length).split(",").map((name) => name.trim()).filter(Boolean) : featureNames.filter((name) => name !== "coverage" && name !== "listtree")
const unknownFeatures = requestedFeatures.filter((name) => !featureNames.includes(name))
const hasFeature = (name) => requestedFeatures.includes(name)
const large = options.includes("large")
Expand Down Expand Up @@ -1068,6 +1069,14 @@ examples check the edge cases. Coverage finds untested code, not wrong code:
counts, not libraries or other files, and only lines in function bodies (not
`def` lines, docstrings or code outside functions). Nothing is marked in the
block's code editor; the report gives the line and its code.

`listtree` isn't part of «everything» either. It draws a list whose first
element is a string, such as `["+", 2, ["*", 3, 4]]`, also as a tree: in the
visualizer's variables (a wide tree behind «Baum zeigen»), in the full value's
window, and in the console, where such a value gets a «Baum» button next to
«Visualisieren». The visualizer's ⋮ menu can switch the trees off («Listen als
Baum zeigen»). Each tree is described by the list's own text for screen
readers.
`large` makes the code 20px (line height 1.6) and the visualizer at least 60% of
the window, e.g. for the projector in presentation mode.

Expand Down
19 changes: 18 additions & 1 deletion examples/profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import: https://raw.githubusercontent.com/glpython-edu/glpython-liascript/main

@Code.voll: @GLPython.eval(@0)

@Code.baum: @GLPython.eval(features=run,repl,visualize,ide,listtree @0)

@Code.demo: @GLPython.visual(large @0)
-->

Expand All @@ -33,6 +35,7 @@ Jede Folie zeigt ein Profil des Kurses. Die Profile sind Makros des Kurses, die
| rezept3 | `features=run,repl,visualize,tests,ide,coverage` |
| pruefung | `features=run` |
| voll | (alles) |
| baum | `features=run,repl,visualize,ide,listtree` |
| demo | `@GLPython.visual(large)` |

## erkunden
Expand Down Expand Up @@ -185,7 +188,7 @@ print(quadrat(7))

## voll

Ohne `features=`: alles wie bisher.
Ohne `features=`: alles wie bisher, ohne Abdeckung und ohne Bäume.

```python
def quadrat(x):
Expand All @@ -199,6 +202,20 @@ print(quadrat(7))
```
@Code.voll

## baum

Listen wie `["+", 2, 3]` auch als Baum: in den Variablen des Visualisierers, im
Fenster des ganzen Werts und in der Konsole (Knopf «Baum», z. B. nach
`ausdruck` in der Eingabezeile).

```python
ausdruck = ["+", 2, ["*", 3, 4]]
zahlen = [1, 2, 3]
breit = ["f", ["g", "erstes", "zweites"], ["h", "drittes", "viertes"], ["k", "fünftes"]]
print(ausdruck)
```
@Code.baum

## demo

Nur der Visualisierer, gross - für den Projektor.
Expand Down
Loading