Allow LineComment to take different input types#28
Allow LineComment to take different input types#28quachpas merged 5 commits intotypst-community:mainfrom
Conversation
|
Example of how the above renders (without the |
|
Thank you! |
Done. I didn't mention this above, but expressions such as |
|
Great, thank you @nonl4331. Can you add a corresponding test and mention it in the changelog? Thank you! |
I've modified the existing linecomment test to include the new linecomment modes. I decided to do it all in a single test since:
I'm not sure what you mean by the changelog, the commit for the test is descriptive and I could not find anything in the repo unless you mean NEWS.md? I did not change the LineComment documentation in the README.md as the new uses align with what is already documented implicitly. Is there anything I missed or further changes that are actionable by me that are needed? |
|
Thank you again, yes I meant the NEWS.MD Everything in a single test is fine! I'll test then merge, that should be everything needed |
Did you want me to put something in NEWS.md or will you being doing that? If I am to put something in NEWS.md which version would it come under? |
|
If you can put something in news that's be great, just put it under the next patch version |
I've added an entry under 1.0.7 in NEWS.md. Note that I have not bumped the version from 1.0.6 to 1.0.7. It is up to you when you would like that to happen. Apologies for the late response, it seems I have an issue with my github notifications that I will need to resolve. |
|
FYI I think there's still an issue here, for #import "@preview/algorithmic:1.0.6": *
// Line comment definition from this PR
#let LC(l, c) = {
if type(l) == array and l.len() > 0 {
([#l.first()#h(1fr)#CommentInline(c)], ..l.slice(1))
} else {
([#l#h(1fr)#CommentInline(c)],)
}
}
#algorithm({
// This works
LC(Line[], [bar1])
// This doesn't
LC(IfElseChain([baz], {Line[]}), [bar2])
}) |
|
@nonl4331 could you add this in your test? Probably needs arraify |
|
Thanks, I'll look into a fix and add a test. I'll amend my PR over the next couple of days or so. |
|
I've pushed an update that should fix the problem @patrick-kidger, thanks for pointing it out. The test now covers the following: 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])Thanks @quachpas for the arraify tip. It wasn't the problem in this case but it did allow me to simply the LineComment code ontop of the fix. I simply had to flatten the array passed in this case. |
|
Thank you @nonl4331 , I'll take a look when I have time. Unfortunately I'm quite busy at the moment so don't worry if this does not get any review within the month. |


Includes a version bump to 1.0.7.
PR now allows all of the following to work properly.