(p *Markdown, data []byte, offset int, c byte)
| 1174 | } |
| 1175 | |
| 1176 | func helperTripleEmphasis(p *Markdown, data []byte, offset int, c byte) (int, *Node) { |
| 1177 | i := 0 |
| 1178 | origData := data |
| 1179 | data = data[offset:] |
| 1180 | |
| 1181 | for i < len(data) { |
| 1182 | length := helperFindEmphChar(data[i:], c) |
| 1183 | if length == 0 { |
| 1184 | return 0, nil |
| 1185 | } |
| 1186 | i += length |
| 1187 | |
| 1188 | // skip whitespace preceded symbols |
| 1189 | if data[i] != c || isspace(data[i-1]) { |
| 1190 | continue |
| 1191 | } |
| 1192 | |
| 1193 | switch { |
| 1194 | case i+2 < len(data) && data[i+1] == c && data[i+2] == c: |
| 1195 | // triple symbol found |
| 1196 | strong := NewNode(Strong) |
| 1197 | em := NewNode(Emph) |
| 1198 | strong.AppendChild(em) |
| 1199 | p.inline(em, data[:i]) |
| 1200 | return i + 3, strong |
| 1201 | case (i+1 < len(data) && data[i+1] == c): |
| 1202 | // double symbol found, hand over to emph1 |
| 1203 | length, node := helperEmphasis(p, origData[offset-2:], c) |
| 1204 | if length == 0 { |
| 1205 | return 0, nil |
| 1206 | } |
| 1207 | return length - 2, node |
| 1208 | default: |
| 1209 | // single symbol found, hand over to emph2 |
| 1210 | length, node := helperDoubleEmphasis(p, origData[offset-1:], c) |
| 1211 | if length == 0 { |
| 1212 | return 0, nil |
| 1213 | } |
| 1214 | return length - 1, node |
| 1215 | } |
| 1216 | } |
| 1217 | return 0, nil |
| 1218 | } |
| 1219 | |
| 1220 | func text(s []byte) *Node { |
| 1221 | node := NewNode(Text) |
no test coverage detected
searching dependent graphs…