add line number support and support for text files

This commit is contained in:
2025-10-15 21:42:07 +02:00
parent ff9035f85f
commit 9c200de774
5 changed files with 66 additions and 19 deletions

View File

@@ -3,9 +3,19 @@ package epub
import (
"encoding/xml"
"fmt"
"regexp"
"strings"
)
var (
cleantitle = regexp.MustCompile(`(?s)<head>.*</head>`)
cleanmarkup = regexp.MustCompile(`<[^<>]+>`)
cleanentities = regexp.MustCompile(`&.+;`)
cleancomments = regexp.MustCompile(`/*.*/`)
cleanspace = regexp.MustCompile(`^\s*`)
cleanh1 = regexp.MustCompile(`<h[1-6].*</h[1-6]>`)
)
// Content nav-point content
type Content struct {
Src string `xml:"src,attr" json:"src"`