Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Enter-tainer
Copy link
Owner

@Enter-tainer Enter-tainer commented May 26, 2024

fix #76

@Enter-tainer
Copy link
Owner Author

@ntjess you may see detailed comparsion here

@Enter-tainer Enter-tainer marked this pull request as ready for review June 29, 2024 16:30
@Enter-tainer
Copy link
Owner Author

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?

Comment on lines 62 to +65
#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 }
Copy link
Owner Author

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.")
}
Copy link
Owner Author

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

Comment on lines 4222 to +4224
let last-row-size = if rows.len() == 0 {
auto
} else {
rows.last()
}
} else { rows.last() }
Copy link
Owner Author

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.

Comment on lines +437 to +440
#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) }
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: inline functions with if statements
1 participant