Skip to content

Commit

Permalink
zine v0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff-it committed Oct 16, 2024
1 parent d9f0a63 commit 4c970ee
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 17 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.7.0#36e5751c989cffbcf797d25ca7fe40d0dcd56a78",
.hash = "1220354bc547dec5285f1e5ea64ea7fc5eaab92d0e8becf366d8be5344dd086261d0",
.url = "git+https://github.com/kristoff-it/zine?ref=v0.7.1#3fc3ecc42b7802cb6a6fe0074a8201005679c9e0",
.hash = "1220ae95f3b2442dc8dc61dc9110e5df7c70aea331392c5a50b83a48958601d57381",
},
},
.paths = .{"."},
Expand Down
22 changes: 22 additions & 0 deletions content/docs/superhtml/scripty.smd
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,18 @@ structure section in the official docs for more info.
<span :text="$loop.it.title"></span>
</div>
```
### []($heading.id("Page.subpagesAlphabetic")) [`fn`]($link.ref("Page.subpagesAlphabetic")) subpagesAlphabetic () -> [[Page]($link.ref("Page"))] *(see also [[any]]($link.ref("Array")))*

Same as `subpages`, but returns the pages in alphabetic order by
comparing their titles.

#### Examples

```superhtml
<div :loop="$page.subpagesAlphabetic()">
<span :text="$loop.it.title"></span>
</div>
```
### []($heading.id("Page.nextPage")) [`fn`]($link.ref("Page.nextPage")) nextPage () -> ?[Page]($link.ref("Page"))

Returns the next page in the same section, sorted by date.
Expand Down Expand Up @@ -432,6 +444,16 @@ Renders the specified [content section]($link.page('docs/supermd/scripty').ref('
<div :html="$page.contentSection('section-id')"></div>
<div :html="$page.contentSection('other-section')"></div>
```
### []($heading.id("Page.hasContentSection")) [`fn`]($link.ref("Page.hasContentSection")) hasContentSection ([String]($link.ref("String"))) -> [String]($link.ref("String"))

Returns true if the page contains a content-section with the given id

#### Examples

```superhtml
<div :html="$page.hasContentSection('section-id')"></div>
<div :html="$page.hasContentSection('other-section')"></div>
```
### []($heading.id("Page.contentSections")) [`fn`]($link.ref("Page.contentSections")) contentSections () -> [[ContentSection]($link.ref("ContentSection"))] *(see also [[any]]($link.ref("Array")))*

Returns a list of sections for the current page.
Expand Down
56 changes: 42 additions & 14 deletions content/docs/supermd/scripty.smd
Original file line number Diff line number Diff line change
Expand Up @@ -84,26 +84,18 @@ This will be rendered by SuperHTML as:
<h1 id="foo" class="bar baz">Title</h1>
```

## `$image` : [Image]($link.ref("Image"))

An embedded image.
## `$text` : [Text]($link.ref("Text"))

Any text placed between `[]` will be used as a caption for the image.
Allows giving an id and attributes to some text.

Example:
```markdown
[This is the caption]($image.asset('foo.jpg'))
Hello [World]($text.id('foo').attrs('bar', 'baz'))!
```

## `$video` : [Video]($link.ref("Video"))

An embedded video.

Any text placed between `[]` will be used as a caption for the video.

Example:
```markdown
[This is the caption]($video.asset('foo.webm'))
This will be rendered by SuperHTML as:
```html
Hello <span id="foo" class="bar baz">World</span>!
```

## `$link` : [Link]($link.ref("Link"))
Expand All @@ -121,6 +113,28 @@ Example:
[This is the caption]($code.asset('foo.zig'))
```

## `$image` : [Image]($link.ref("Image"))

An embedded image.

Any text placed between `[]` will be used as a caption for the image.

Example:
```markdown
[This is the caption]($image.asset('foo.jpg'))
```

## `$video` : [Video]($link.ref("Video"))

An embedded video.

Any text placed between `[]` will be used as a caption for the video.

Example:
```markdown
[This is the caption]($video.asset('foo.webm'))
```

# [anydirective]($section.id('anydirective'))

Each Directive has a different set of properties that can be set.
Expand Down Expand Up @@ -412,3 +426,17 @@ Sets the source location of this directive to a build asset.
Sets the language of this code snippet, which is also used for
syntax highlighting.

# [Text]($section.id('Text'))

Allows giving an id and attributes to some text.

Example:
```markdown
Hello [World]($text.id('foo').attrs('bar', 'baz'))!
```

This will be rendered by SuperHTML as:
```html
Hello <span id="foo" class="bar baz">World</span>!
```

18 changes: 17 additions & 1 deletion content/log.smd
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,28 @@ You can [subscribe to this page via RSS](https://zine-ssg.io/log/index.xml).

To update Zine to the latest release run:
```sh
zig fetch --save "git+https://github.com/kristoff-it/zine#v0.7.0"
zig fetch --save "git+https://github.com/kristoff-it/zine#v0.7.1"
```

## Changes


[]($section.id('v0.7.1').data('date','2024-10-16'))
- When using the simplified `website()` / `multilingualWebsite()` interface,
you can now pass `-Dinclude-drafts` flag to enable rendering of content pages
that have `.draft = true` set in their frontmatter. Thank you nihklas ([#70](https://github.com/kristoff-it/zine/pull/70)).

- New SuperHTML Scripty builtin functions:
- `$page.hasContentSection`: You can now query a page to see if it contains a
content section with a given id. Thanks nihklas ([#76](https://github.com/kristoff-it/zine/pull/76)).
- `$page.subpagesAlphabetic`: lists sub pages sorted in alphabetic order.
Unblocks rockorager's [recipe website](https://culver.house/recipes/).
Recipe websites are good, make more of them.

- New SuperMD Scripty directive:
- `$text`, which can be used to give an id and attributes to a inline piece
of text.

[]($section.id('v0.7.0').data('date','2024-10-11'))
- Introduced actual arrays in Zine. Previously we would immediately evaluate
Scripty expressions into iterators, which made it awkward to implement bulitin
Expand Down

0 comments on commit 4c970ee

Please sign in to comment.