Commit 66ffdc2
committed
feat: improve body parsing logic
Current body parsing logic with trim() + split("###") is too fragile and
pose problems with some body that contains case with ### in the middle
of the line or case with codeblock ``` section.
These case will cause the script to parse these as separate section and
produce wrong outputs and in some case even prints error assuming things
are checkbox and errors out on the concat function.
To make the parsing logic more solid, implement a dedicated function and
parse with this logic:
- We split the body for "\n"
- We ignore codeblock ``` section
- We check "###" only at the start of the line
- We check for "### " (with the space included) as that is the correct
section Github issue template expects.
With the following change case like:
```
root@OpenWrt:~# cat /boot/config.txt
```
Are correctly parsed as all part of a single section instead of being
wrongly treated as different empty sections.
Signed-off-by: Christian Marangi <[email protected]>1 parent 2ac1a18 commit 66ffdc2
1 file changed
+29
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
117 | 143 | | |
118 | 144 | | |
119 | 145 | | |
| |||
0 commit comments