Skip to content

Commit

Permalink
readme edit
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianconcept committed Jan 25, 2024
1 parent b937a57 commit 607ae9b
Showing 1 changed file with 39 additions and 39 deletions.
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,39 @@ Templates with the Power of Smalltalk

[![Pharo 10](https://img.shields.io/badge/Pharo-10-%23aac9ff.svg)](https://pharo.org/download)

## Description

`STTemplate` is a Smalltalk template class.

It can run Smalltalk code found between the opening (`<st`) and closing (`>`) tags when present in in the string that is the source of an STTemplate.

There are two ways to have Smalltalk code executed from `STTemplate` instances:

### 1. Displayed

Analogous to a `printIt` (note the `=` after the opening tag `<st`):

```smalltalk
'<p><st= ''Hello '', self ></p>' sttRenderOn: 'STT'.
"'<p>Hello STT</p>'"
```

### 2. Evaluated

Analogous to a `doIt` (note the lack of `=` after the opening tag `<st`):

```smalltalk
'<p>Hello STT<st 40+2 ></p>' sttRenderOn: 'STT'.
"'<p>Hello STT</p>'"
'<p>Hello STT<st self crShow: ''Greetings from an STT closure!'' ></p>' sttRenderOn: Transcript.
"'<p>Hello STT</p>'"
"And in the Transcript you'll see:"
'Greetings from an STT closure!'
```

## Features

- Content agnostic.
Expand All @@ -20,12 +53,12 @@ Templates with the Power of Smalltalk
- Compiles content lazily only once.
- Opening and closing tags and display token can be customized.
___
1. [Description](#description)
2. [Examples](#examples)
3. [Install](#install)
4. [Guides](#guides)
5. [Performance](#performance)
6. [Backstory](#backstory)

1. [Examples](#examples)
2. [Install](#install)
3. [Guides](#guides)
4. [Performance](#performance)
5. [Backstory](#backstory)

## Install

Expand All @@ -47,39 +80,6 @@ Or as dependency in your `Baseline`
spec baseline: 'STTemplate' with: [ spec repository: 'github://sebastianconcept/STTemplate:v0.0.3' ]
```

## Description

`STTemplate` is a Smalltalk template class.

It can run Smalltalk code found between the opening (`<st`) and closing (`>`) tags when present in the content.

There are two ways to have Smalltalk running from `STTemplate` instances:

### 1. Displayed

Analogous to a `printIt`

```smalltalk
'<p><st= ''Hello '', self ></p>' sttRenderOn: 'STT'.
"'<p>Hello STT</p>'"
```

### 2. Evaluated

Analogous to a `doIt`

```smalltalk
'<p>Hello STT<st 40+2 ></p>' sttRenderOn: 'STT'.
"'<p>Hello STT</p>'"
'<p>Hello STT<st self crShow: ''Greetings from an STT closure!'' ></p>' sttRenderOn: Transcript.
"'<p>Hello STT</p>'"
"And in the Transcript you'll see:"
'Greetings from an STT closure!'
```

### Examples

```smalltalk
Expand Down

0 comments on commit 607ae9b

Please sign in to comment.