Skip to content

Commit

Permalink
Merge pull request #16 from sebastianconcept/15-Change-default-prefix…
Browse files Browse the repository at this point in the history
…es-to--code--for-familiarity

15 change default prefixes to  code  for familiarity
  • Loading branch information
sebastianconcept authored Feb 17, 2024
2 parents 5582302 + a99a38c commit 674773f
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 184 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Unit Tests

on: [push,pull_request,workflow_dispatch]
on: [push]

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
smalltalk: [ Pharo64-10 ]
smalltalk: [ Pharo64-11 ]
name: ${{ matrix.smalltalk }}
steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Feb 17, 2024
===================================
- Using by default the same convetion seen in Ruby on Rails.

Jan 23, 2024
===================================
- Added smalltalkCI
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec baseline: 'STTemplate' with: [ spec repository: 'github://sebastianconcept/

`STTemplate` is a Smalltalk template class.

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

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

Expand All @@ -60,7 +60,7 @@ There are two ways to have Smalltalk running from `STTemplate` instances:
Analogous to a `printIt`

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

Expand All @@ -69,10 +69,10 @@ Analogous to a `printIt`
Analogous to a `doIt`

```smalltalk
'<p>Hello STT<st 40+2 ></p>' sttRenderOn: 'STT'.
'<p>Hello STT<% 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<% self crShow: ''Greetings from an STT closure!'' %></p>' sttRenderOn: Transcript.
"'<p>Hello STT</p>'"
"And in the Transcript you'll see:"
Expand All @@ -85,15 +85,15 @@ Analogous to a `doIt`
```smalltalk
"Displays the 42 as content of the span element:"
'<p>The Answer: <span><st= 42></span></p>' sttRenderOn: nil.
'<p>The Answer: <span><%= 42%></span></p>' sttRenderOn: nil.
"'<p>The Answer: <span>42</span></p>'"
```

```smalltalk
"Displays the 42 as content of the span element because
adds 2 to the context sent with `sttRenderOn: 40`"
'<p>The Answer: <span><st= self + 2></span></p>' sttRenderOn: 40.
'<p>The Answer: <span><%= self + 2%></span></p>' sttRenderOn: 40.
"'<p>The Answer: <span>42</span></p>'"
```

Expand All @@ -102,7 +102,7 @@ adds 2 to the context sent with `sttRenderOn: 40`"
so it displays `Answer: ` coming from `self key capitalized, ': '`
and then `42` coming from displaying `self value + 2`"
'<p>The <span><st= self key capitalized, '': ''></span><span><st= self value + 2></span></p>' sttRenderOn: (#answer -> 40).
'<p>The <span><%= self key capitalized, '': ''%></span><span><%= self value + 2%></span></p>' sttRenderOn: (#answer -> 40).
"'<p>The <span>Answer: </span><span>42</span></p>'"
```

Expand All @@ -111,7 +111,7 @@ and then `42` coming from displaying `self value + 2`"
In each iteration, it creates another Smalltalk closure that has access
to self as expected and uses that to display its content:"
'<st 1 to: 3 do: [ :i | ><p>The Answer is <span><st= self value + 2>!</span></p><st ] >' sttRenderOn: (#answer -> 40).
'<% 1 to: 3 do: [ :i | %><p>The Answer is <span><%= self value + 2%>!</span></p><% ] >' sttRenderOn: (#answer -> 40).
"'<p>The Answer is <span>42!</span></p><p>The Answer is <span>42!</span></p><p>The Answer is <span>42!</span></p>'"
```

Expand Down
Loading

0 comments on commit 674773f

Please sign in to comment.