Snippets

Uses
- Term classes
- Character strings

Snippets are represented by terms of the sort SnippetLzSnippetTerm, with LzSnippetTermPharoTermClass. These definitions ensure that top-level snippet terms are created as instances of LzSnippetTerm LzTermInContext subclass: #LzSnippetTerm instanceVariableNames: '' classVariableNames: '' package: 'Leibniz2-Lepiter' .

A basic snippet reference stores the internal UID of the snippet:
snippet(String) : Snippet

The first snippet on a page whose text starts with a given string is accessible as
firstSnippetStartingWith(text:String, pageName:String) : Snippet
This term is rewritten to a basic snippet reference in Pharo code:
firstSnippetStartingWith(text:String, pageName:String) ⇒ Pharo:"text ensureString. pageName ensureString. signature opTerm: (LzPrefixOpName for: #snippet) args: { signature stringTerm: (LzSnippetTerm firstSnippetStartingWith: text page: pageName) }"

Example

Click on firstSnippetStartingWith("Click", "Snippets") ⇒ snippet("+ae0zu2jDQCYCyI1AE43Cg==") to see this snippet.