M document_parser.go => document_parser.go +4 -7
@@ 601,7 601,7 @@ func (docp *documentParser) parseBlock(parent *element, term int) {
continue
case elKindBlockImage:
- var lineImage = bytes.TrimRight(line[7:], " \t")
+ var lineImage = line[7:]
if el.parseBlockImage(docp.doc, lineImage) {
el.kind = docp.kind
line = nil
@@ 1606,8 1606,6 @@ func (docp *documentParser) skipCommentAndEmptyLine() (line []byte, ok bool) {
func (docp *documentParser) whatKindOfLine(line []byte) (spaces, got []byte) {
docp.kind = lineKindText
- line = bytes.TrimRight(line, " \f\n\r\t\v")
-
// All of the comparison MUST be in order.
if len(line) == 0 {
@@ 1725,16 1723,15 @@ func (docp *documentParser) whatKindOfLine(line []byte) (spaces, got []byte) {
docp.kind = lineKindAttribute
case '[':
var (
- newline = bytes.TrimRight(line, " \t")
- l = len(newline)
+ l = len(line)
)
- if newline[l-1] != ']' {
+ if line[l-1] != ']' {
return nil, line
}
if l >= 5 {
// [[x]]
- if newline[1] == '[' && newline[l-2] == ']' {
+ if line[1] == '[' && line[l-2] == ']' {
docp.kind = lineKindID
return nil, line
}
M element.go => element.go +2 -5
@@ 276,7 276,7 @@ func (el *element) lastSuccessor() (last *element) {
}
func (el *element) parseBlockAudio(doc *Document, line []byte) bool {
- line = bytes.TrimRight(line[7:], " \t")
+ line = line[7:]
var attrBegin = bytes.IndexByte(line, '[')
if attrBegin < 0 {
@@ 620,7 620,7 @@ func (el *element) parseStyleClass(line []byte) {
}
func (el *element) parseBlockVideo(doc *Document, line []byte) bool {
- line = bytes.TrimRight(line[7:], " \t")
+ line = line[7:]
var (
attrBegin = bytes.IndexByte(line, '[')
@@ 783,9 783,6 @@ func (el *element) removeLastIfEmpty() {
}
if c.prev != nil {
c.prev.next = nil
- if c.prev.kind == elKindText {
- el.raw = bytes.TrimRight(el.raw, " \t")
- }
} else if c.parent != nil {
c.parent.child = nil
}