Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff-it committed Jul 26, 2024
1 parent 4956579 commit d12f5c2
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
.version = "0.0.0",
.dependencies = .{
.zine = .{
.url = "git+https://github.com/kristoff-it/zine?ref=v0.1.1#4e9a598fa2cb50b886597c636f5788a1333ad695",
.hash = "12207fb7cb27d47e4b2749e72f03d8a941c3dbbcaeb27e3224f8e5ef13341458e898",
.url = "git+https://github.com/kristoff-it/zine?ref=v0.1.3#6d52e6a3d0c578481af6181dd41b1a0163dfc953",
.hash = "1220c7a5284269c9aca520c601438155d81dc4e27cb79696b6648aef24686d4c942d",
},
},
.paths = .{"."},
Expand Down
4 changes: 2 additions & 2 deletions content/documentation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Your website only needs the following two files to get started:
.name = "sample website",
.version = "0.0.0",
.dependencies = .{
.url = "git+https://github.com/kristoff-it/zine#v0.1.0",
.hash = "1220e9f603ff14b5ec69442f0287588ad20072d836b05b3a7e4100dd30e95fef1cd3",
.url = "git+https://github.com/kristoff-it/zine#v0.1.3",
.hash = "1220c7a5284269c9aca520c601438155d81dc4e27cb79696b6648aef24686d4c942d",
},
.paths = .{"."},
}
Expand Down
22 changes: 19 additions & 3 deletions content/documentation/scripty/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The current page.
The iteration element in a loop, only available inside of elements with a `loop` attribute.
## $if : ?V

The payload of an optional value, only available inside of elements with an `if` attribute.
The payload of an optional value, only available inside of elemens with an `if` attribute.
# Types
## Site
### host_url : str,
Expand Down Expand Up @@ -65,7 +65,7 @@ the current page is an 'index.md' page).

Examples:
```
<div ></div>
$page.isSection()
```
### subpages() -> [Page]
Only available on 'index.md' pages, as those are the pages
Expand Down Expand Up @@ -130,6 +130,22 @@ Examples:
```
$page.title.len()
```
### endsWith(str) -> bool
Returns true if the receiver ends with the provided string.


Examples:
```
$page.permalink().endsWith("/blog/")
```
### eql(str) -> bool
Returns true if the receiver equals the provided string.


Examples:
```
$page.author.eql("Loris Cro")
```
### suffix(str, [...str]) -> str
Concatenates strings together (left-to-right).

Expand Down Expand Up @@ -276,7 +292,7 @@ $page.draft.or($site.tags.len().eq(0))
```
## dyn
### get?(str) -> ?dyn
Tries to get a dynamic value, to be used in conjunction with an `if` attribute.
Tries to get a dynamic value, to be used in conjuction with an `if` attribute.


Examples:
Expand Down
30 changes: 30 additions & 0 deletions content/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ pre {
overflow: hidden;
text-overflow: ellipsis;
}
pre:has(.superhtml) {
overflow: hidden;
text-overflow: unset;
overflow-x: auto;
}
pre:has(.sh) {
color: #111;
background-color: #ccc;
Expand All @@ -35,6 +40,31 @@ window.onload = function() {
}
</script>

### 2024-7-26

<button>copy</button>
```sh
zig fetch --save "git+https://github.com/kristoff-it/zine#v0.1.3"
```
- Scripty strings now have `eql`, `contains` and `endsWith`. With a pinch of creativity you can create menus that style differently the current active page:
```superhtml
<div class="$page.permalink().endsWith('/blog/').then('selected', '')">
Blog
</div>
```
Similarly, when printing out the list of pages in a section, you can filter-out occasional "miscellaneous" (as in belonging to the same section but unwanted in the current list):
```superhtml
<div loop="$page.subpages()">
<div if="$loop.it.permalink().contains('/blog/')">
<a href="$loop.it.permalink() var="$loop.it.title"></a>
</div>
</div>
```
- The [SuperHTML CLI tool](https://github.com/kristoff-it/superhtml) was updated with two new commands:
- `check`: checks HTML and SuperHTML template files for syntax errors, useful if you don't have / want LSP integration (see also `fmt` in such case).
- `interface`: prints out the interface of a given SuperHTML template file,
useful to bootstrap a new SuperHTML template that extends another.

### 2024-7-25

<button>copy</button>
Expand Down

0 comments on commit d12f5c2

Please sign in to comment.