You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugSomething isn't workingmodelRelated to model category, which is all about structure and semantics.stylingAbout set and show rules or style properties
// Definition#letauthors= contextdocument.author.len()
// Output
Authors: #authors// Error A (no error and nothing in about dialog)#setdocument(author: "test") ifauthors==0// Error B (no error and nothing in about dialog)#if (authors==0) { setdocument(author: "test"); [Done] }
In your example, authors is of type content, not int so all the comparisons return false. Everything that depends on the contextual information needs to be inside of the context expression.
That said, before #4768 was merged (which I coincidentally was just working on as you opened the issue) this still wouldn't have worked due to other bugs.
However, with it now merged, you can do it like this:
Note that document set rules are a special case here. Usually having a set rule without any following content in the same block is pointless because the set rule is scoped to the code block. However, because the document is a singleton, scoping does not make sense. So for document set rules, the last one just wins.
For other kinds of set rules, you'd usually have a setup like this, with an "everything show rule":
#setdocument(author: "Normal")
#show: body=>context {
settext(red) if"Normal"indocument.author
body
}
Hi there!
bugSomething isn't workingmodelRelated to model category, which is all about structure and semantics.stylingAbout set and show rules or style properties
Activity
Test for #4769
laurmaedje commentedon Aug 16, 2024
In your example,
authorsis of typecontent, notintso all the comparisons return false. Everything that depends on the contextual information needs to be inside of the context expression.That said, before #4768 was merged (which I coincidentally was just working on as you opened the issue) this still wouldn't have worked due to other bugs.
However, with it now merged, you can do it like this:
Note that document set rules are a special case here. Usually having a set rule without any following content in the same block is pointless because the set rule is scoped to the code block. However, because the document is a singleton, scoping does not make sense. So for document set rules, the last one just wins.
For other kinds of set rules, you'd usually have a setup like this, with an "everything show rule":