automatically ignore known forwarded addresses, fixes #64

This commit is contained in:
Aine
2023-09-18 12:35:37 +03:00
parent e90925eceb
commit 60b4386dd8
187 changed files with 4070 additions and 2667 deletions

View File

@@ -12,7 +12,7 @@ import (
var attrNameID = []byte("id")
var attrNameClass = []byte("class")
// An Attribute is an attribute of the markdown elements
// An Attribute is an attribute of the markdown elements.
type Attribute struct {
Name []byte
Value interface{}
@@ -93,7 +93,8 @@ func parseAttribute(reader text.Reader) (Attribute, bool) {
// CommonMark is basically defined for XHTML(even though it is legacy).
// So we restrict id characters.
for ; i < len(line) && !util.IsSpace(line[i]) &&
(!util.IsPunct(line[i]) || line[i] == '_' || line[i] == '-' || line[i] == ':' || line[i] == '.'); i++ {
(!util.IsPunct(line[i]) || line[i] == '_' ||
line[i] == '-' || line[i] == ':' || line[i] == '.'); i++ {
}
name := attrNameClass
if c == '#' {
@@ -145,7 +146,7 @@ func parseAttributeValue(reader text.Reader) (interface{}, bool) {
reader.SkipSpaces()
c := reader.Peek()
var value interface{}
ok := false
var ok bool
switch c {
case text.EOF:
return Attribute{}, false
@@ -244,7 +245,7 @@ func scanAttributeDecimal(reader text.Reader, w io.ByteWriter) {
for {
c := reader.Peek()
if util.IsNumeric(c) {
w.WriteByte(c)
_ = w.WriteByte(c)
} else {
return
}
@@ -286,7 +287,7 @@ func parseAttributeNumber(reader text.Reader) (float64, bool) {
}
scanAttributeDecimal(reader, &buf)
}
f, err := strconv.ParseFloat(buf.String(), 10)
f, err := strconv.ParseFloat(buf.String(), 64)
if err != nil {
return 0, false
}