Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,8 @@ def _split_table_row(line: str) -> list[str]:

The document contains at least one cell whose code span itself contains a
pipe character - the `||` concatenation operator, written as
`` `str1 || str2` `` - which a naive `str.split("|")` would shred into
`` `str1 \\|\\| str2` `` (GitHub-Flavored Markdown requires escaping pipes
even inside a code span) - which a naive `str.split("|")` would shred into
extra empty cells. Backticks otherwise never appear as literal (non-code)
content in this document's tables, so "toggle on backtick" is a safe,
general rule rather than a special case for that one row.
Expand All @@ -1756,8 +1757,9 @@ def _split_table_row(line: str) -> list[str]:


def _clean(cell: str) -> str:
"""Strip markdown code-span backticks, leaving the underlying syntax text."""
return cell.replace("`", "").strip()
"""Strip markdown code-span backticks and unescape pipes, leaving the
underlying syntax text."""
return cell.replace("`", "").replace("\\|", "|").strip()


def _is_section_excluded(heading_stack: dict[int, str]) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions core-spec/expression_language.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ a dialect extension.
| Function | Syntax | Description |
| :---- | :---- | :---- |
| `CONCAT` | `CONCAT(str1, str2, ...)` | Concatenate strings |
| `||` | `str1 || str2` | Concatenation operator |
| `\|\|` | `str1 \|\| str2` | Concatenation operator |
| `LENGTH` | `LENGTH(str)` | String length in characters |
| `LOWER` | `LOWER(str)` | Convert to lowercase |
| `UPPER` | `UPPER(str)` | Convert to uppercase |
Expand Down Expand Up @@ -673,7 +673,7 @@ expression:
| :---- | :---- | :---- | :---- | :---- | :---- |
| Date truncation | `DATE_TRUNC('month', d)` | `DATE_TRUNC('month', d)` | `DATE_TRUNC(d, MONTH)` | `DATE_TRUNC('month', d)` | `DATE_TRUNC('month', d)` |
| Date add | `DATEADD(day, 7, d)` | `DATEADD(day, 7, d)` | `DATE_ADD(d, INTERVAL 7 DAY)` | `DATE_ADD(d, 7)` | `d + INTERVAL '7 days'` |
| String concat | `CONCAT(a, b)` | `CONCAT(a, b)` | `CONCAT(a, b)` | `CONCAT(a, b)` | `a || b` |
| String concat | `CONCAT(a, b)` | `CONCAT(a, b)` | `CONCAT(a, b)` | `CONCAT(a, b)` | `a \|\| b` |
| Null coalesce | `COALESCE(a, b)` | `COALESCE(a, b)` or `NVL(a, b)` | `COALESCE(a, b)` or `IFNULL(a, b)` | `COALESCE(a, b)` | `COALESCE(a, b)` |
| Current timestamp | `CURRENT_TIMESTAMP` | `CURRENT_TIMESTAMP()` | `CURRENT_TIMESTAMP()` | `CURRENT_TIMESTAMP()` | `CURRENT_TIMESTAMP` |
| Substring | `SUBSTRING(s, start, len)` | `SUBSTR(s, start, len)` | `SUBSTR(s, start, len)` | `SUBSTRING(s, start, len)` | `SUBSTRING(s, start, len)` |
Expand Down
Loading