A value that is a block string read whole: the label it gives in buf, its * text added to the diagram's docstring, and whether a `{` follows it. */
| 2017 | /* A value that is a block string read whole: the label it gives in buf, its |
| 2018 | * text added to the diagram's docstring, and whether a `{` follows it. */ |
| 2019 | static dg_str_t d2_value(dg_t *dg, dg_lines_t *it, dg_str_t value, char *buf, size_t cap, |
| 2020 | bool *opens) { |
| 2021 | dg_str_t text; |
| 2022 | dg_str_t after; |
| 2023 | if (!value.n || value.p[0] != '|' || !d2_block(it, value, &text, &after)) { |
| 2024 | return value; |
| 2025 | } |
| 2026 | *opens = after.n && after.p[after.n - SKIP_ONE] == '{'; |
| 2027 | size_t n = d2_block_label(text, buf, cap); |
| 2028 | char all[DG_LABEL_MAX]; |
| 2029 | size_t an = dg_label_text(text, all, sizeof(all)); |
| 2030 | if (an > n) { |
| 2031 | dg_doc_add(dg, all, an); |
| 2032 | } |
| 2033 | return dg_s(buf, n); |
| 2034 | } |
| 2035 | |
| 2036 | /* A connection chain `a -> b <- c: label`: true when the line is one. */ |
| 2037 | static bool d2_connection(dg_t *dg, dg_lines_t *it, dg_str_t ln, const char *path, uint32_t line, |
no test coverage detected