Function
unescapeText
(ob *bytes.Buffer, src []byte)
Source from the content-addressed store, hash-verified
| 678 | } |
| 679 | |
| 680 | func unescapeText(ob *bytes.Buffer, src []byte) { |
| 681 | i := 0 |
| 682 | for i < len(src) { |
| 683 | org := i |
| 684 | for i < len(src) && src[i] != '\\' { |
| 685 | i++ |
| 686 | } |
| 687 | |
| 688 | if i > org { |
| 689 | ob.Write(src[org:i]) |
| 690 | } |
| 691 | |
| 692 | if i+1 >= len(src) { |
| 693 | break |
| 694 | } |
| 695 | |
| 696 | ob.WriteByte(src[i+1]) |
| 697 | i += 2 |
| 698 | } |
| 699 | } |
| 700 | |
| 701 | // '&' escaped when it doesn't belong to an entity |
| 702 | // valid entities are assumed to be anything matching &#?[A-Za-z0-9]+; |
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…