-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow single item code block be put in a single line #77
base: master
Are you sure you want to change the base?
Conversation
@ntjess you may see detailed comparsion here |
6aa8351
to
26dc8ee
Compare
26dc8ee
to
eed47bd
Compare
Hi @ntjess I just add scoped based checking and only expr-like-if will be put in a single line(if possible). Would you mind look at the diff and comment the current behavior? |
#show raw.where(block: false): it => if it.text.starts-with("<") and it.text.ends-with(">") { | ||
set text(1.2em) | ||
doc-style.show-type(it.text.slice(1, -1)) | ||
} else { | ||
it | ||
} | ||
} else { it } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look good. I suggest we only try put them in a single line iff both branch of if
has exactly one item
return (node.y, node.x) | ||
} else { | ||
panic(message: "Invalid tree direction.") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like currently else-if
pattern is not well recognized. They should be stmt-like-if but not expr-like-if
let last-row-size = if rows.len() == 0 { | ||
auto | ||
} else { | ||
rows.last() | ||
} | ||
} else { rows.last() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should either put the two branch in a single line, or we completely expand them. Current status doesn't look good.
#let max-if-not-none(a, b) = if a in (none, auto) { b } else if b in ( | ||
none, | ||
auto, | ||
) { a } else { calc.max(a, b) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ugly
fix #76