refactor(parser): translate comments from Italian to English
This commit is contained in:
@@ -65,7 +65,7 @@ var (
|
|||||||
completedHead = regexp.MustCompile(`^x\s+`)
|
completedHead = regexp.MustCompile(`^x\s+`)
|
||||||
spaceRe = regexp.MustCompile(`\s+`)
|
spaceRe = regexp.MustCompile(`\s+`)
|
||||||
dateLayout = "2006-01-02"
|
dateLayout = "2006-01-02"
|
||||||
// Protocols da escludere come chiave dei metadati
|
// Protocols to exclude as metadata keys
|
||||||
protocols = map[string]struct{}{
|
protocols = map[string]struct{}{
|
||||||
"http": {},
|
"http": {},
|
||||||
"https": {},
|
"https": {},
|
||||||
@@ -74,7 +74,7 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// isProtocolKey controlla se la chiave è un protocollo standard.
|
// isProtocolKey checks if the key is a standard protocol.
|
||||||
func isProtocolKey(k string) bool {
|
func isProtocolKey(k string) bool {
|
||||||
_, found := protocols[strings.ToLower(k)]
|
_, found := protocols[strings.ToLower(k)]
|
||||||
return found
|
return found
|
||||||
@@ -165,13 +165,12 @@ func ParseLine(line string) (Task, error) {
|
|||||||
t.Contexts = append(t.Contexts, tok[1:])
|
t.Contexts = append(t.Contexts, tok[1:])
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// Nuova logica per metadati: nessuno spazio, almeno un ':', chiave non protocollo
|
|
||||||
if !strings.ContainsAny(tok, " \t") && strings.Contains(tok, ":") {
|
if !strings.ContainsAny(tok, " \t") && strings.Contains(tok, ":") {
|
||||||
parts := strings.SplitN(tok, ":", 2)
|
parts := strings.SplitN(tok, ":", 2)
|
||||||
k, v := parts[0], parts[1]
|
k, v := parts[0], parts[1]
|
||||||
if k != "" && v != "" && !isProtocolKey(k) {
|
if k != "" && v != "" && !isProtocolKey(k) {
|
||||||
t.Metadata[k] = v
|
t.Metadata[k] = v
|
||||||
// Se il campo è due:YYYY-MM-DD, parsalo anche come DueDate
|
// If the field is due:YYYY-MM-DD, also parse it as DueDate
|
||||||
if k == "due" && dateRe.MatchString(v) {
|
if k == "due" && dateRe.MatchString(v) {
|
||||||
if dt, err := time.Parse(dateLayout, v); err == nil {
|
if dt, err := time.Parse(dateLayout, v); err == nil {
|
||||||
t.DueDate = &dt
|
t.DueDate = &dt
|
||||||
|
|||||||
Reference in New Issue
Block a user