Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Algorithmic NEWS

## v1.0.7

> ![INFO]
> @nonl4331 fixed an issue with `LineComment` not working with certain input types (#27, #28).
>
> LineComment statements similar to the instances below will now render correctly.
> ```typ
> #{
> LineComment([Initialize hashmap], [Count instances])
> LineComment([$c += a-b$], [Sum of differences])
> }
> ```

## v1.0.6

> ![INFO]
Expand Down
5 changes: 4 additions & 1 deletion algorithmic.typ
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@
#let Call(..args) = (CallInline(..args),)
#let Fn(..args) = (FnInline(..args),)
#let Comment(c) = (CommentInline(c),)
#let LineComment(l, c) = ([#l.first()#h(1fr)#CommentInline(c)], ..l.slice(1))
#let LineComment(l, c) = {
let l = arraify(l).flatten()
([#l.first()#h(1fr)#CommentInline(c)], ..l.slice(1))
}

// Control flow
#let If = iflike.with(kw1: "if", kw2: "then", kw3: "end")
Expand Down
Binary file modified tests/linecomment/ref/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 9 additions & 1 deletion tests/linecomment/test.typ
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#import "../../algorithmic.typ"
#import algorithmic: algorithm
#set page(margin: (left: .1cm, top: .1cm, bottom: .1cm), width: 6cm, height: auto)
#set page(margin: (left: .1cm, top: .1cm, bottom: .1cm), width: 8cm, height: auto)
#algorithm({
import algorithmic: *
LineComment(Assign[a][1], [Initialize $a$ to 1])
LineComment([Initialize hashmap], [Count instances])
LineComment(Break, [Early exit])
LineComment([$c += a-b$], [Sum of differences])
LineComment(IfElseChain([condition], {Line[Test]}), [It's just amazing])
LineComment([], [blank])
LineComment(While([stuff], {Line[Another test]}), [foo])
LineComment(Function("add", ($a$, $b$), {Assign[c][$a+b$]}), [bar])
LineComment(LineComment([nested], [inner]), [outer])
})
Loading