implement tables#52
Conversation
|
Ah, I think I'm on the wrong gleam version that's what's making the reformat happen. |
|
|
||
| fn table_row_cells(line: String) -> Option(List(String)) { | ||
| let line = string.trim(line) | ||
| case string.starts_with(line, "|") { |
There was a problem hiding this comment.
Prefer pattern matching to starts_with + drop_start 🙏
| } | ||
| } | ||
|
|
||
| fn split_table_row( |
There was a problem hiding this comment.
This function is extremely slow due to repeatedly splitting a string into graphemes and joining them back into a string. Please use splitters and string pattern matching instead 🙏
| string.to_graphemes(cell) | ||
| |> list.all(fn(char) { char == "-" || char == ":" }) | ||
| } | ||
| }) |
There was a problem hiding this comment.
Use string pattern matching please instead of converting to graphemes etc
There was a problem hiding this comment.
Yeah I really need to remember most of the time grapheme is not a crucial detail
| #(Some(drop_empty_text(caption)), in) | ||
| } | ||
|
|
||
| fn take_caption_lines(in: String, lines: List(String)) -> #(String, String) { |
There was a problem hiding this comment.
I think this function is finding the first \n\n. Couldn't we use string.split_once for that?
There was a problem hiding this comment.
I'm actually looking for any line indentation
|
I've force pushed a new version. Have kept most function names but switch quite a few things.
|
Just used the available tests as mentioned in #36
Wraps up running the formatter. let me know if you want that on a separate commit or branch.