From 4caa83828cf4ed1dcfa4907c515767e2bccbcd40 Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Tue, 27 Aug 2024 14:39:55 +0200 Subject: [PATCH 01/13] Add partial support for sections properties --- epub.go | 50 ++++++++++++++++++++++++++++++++++++++++++++------ write.go | 2 +- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/epub.go b/epub.go index 35d4a43..c55f109 100644 --- a/epub.go +++ b/epub.go @@ -31,6 +31,8 @@ Basic usage: package epub import ( + "bytes" + "encoding/xml" "fmt" "io/fs" "log" @@ -156,9 +158,10 @@ type epubCover struct { } type epubSection struct { - filename string - xhtml *xhtml - children []*epubSection + filename string + xhtml *xhtml + children []*epubSection + properties string } // NewEpub returns a new Epub. @@ -377,9 +380,10 @@ func (e *Epub) addSection(parentFilename string, body string, sectionTitle strin } s := &epubSection{ - filename: internalFilename, - xhtml: x, - children: nil, + filename: internalFilename, + xhtml: x, + children: nil, + properties: propertiesFromBody(body), } // section have parentIndex -1 and subsection have parrentindex != -1 @@ -397,6 +401,40 @@ func (e *Epub) addSection(parentFilename string, body string, sectionTitle strin return internalFilename, nil } +// supports mathml, svg, scripted (partially) +// does not support remote-sources, switch (deprecated) +func propertiesFromBody(body string) string { + prop := map[string]bool{} + + decoder := xml.NewDecoder(bytes.NewBufferString(body)) + for { + t, _ := decoder.Token() + if t == nil { + break + } + switch se := t.(type) { + case xml.StartElement: + switch strings.ToUpper(se.Name.Local) { + case "SVG": + prop["svg"] = true + case "MATHML": + prop["mathml"] = true + case "SCRIPT": + prop["scripted"] = true + case "FORM": + prop["scripted"] = true + } + default: + } + } + + ret := []string{} + for k := range prop { + ret = append(ret, k) + } + return strings.Join(ret, " ") +} + // Author returns the author of the EPUB. func (e *Epub) Author() string { return e.author diff --git a/write.go b/write.go index eb9b0a0..637c406 100644 --- a/write.go +++ b/write.go @@ -485,7 +485,7 @@ func writeSections(rootEpubDir string, e *Epub, sections []*epubSection, parentf if section.filename != e.cover.xhtmlFilename { e.pkg.addToSpine(section.filename) } - e.pkg.addToManifest(section.filename, relativePath, mediaTypeXhtml, "") + e.pkg.addToManifest(section.filename, relativePath, mediaTypeXhtml, section.properties) if parentfilename[section.filename] == "-1" && section.filename != e.cover.xhtmlFilename { j := filenamelist[section.filename] e.toc.addSubSection("-1", j, section.xhtml.Title(), relativePath) From f41567c38e1769dc556a2b960a7f4967a54666f6 Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Tue, 27 Aug 2024 15:00:36 +0200 Subject: [PATCH 02/13] Change import path --- epub_test.go | 2 +- example_test.go | 2 +- fs.go | 6 +++--- go.mod | 2 +- internal/storage/memory/fs.go | 2 +- internal/storage/osfs/fs.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/epub_test.go b/epub_test.go index f2ab888..817fb10 100644 --- a/epub_test.go +++ b/epub_test.go @@ -17,8 +17,8 @@ import ( "testing" "time" - "github.com/go-shiori/go-epub/internal/storage" "github.com/gofrs/uuid/v5" + "github.com/neclepsio/go-epub/internal/storage" ) const ( diff --git a/example_test.go b/example_test.go index 3cdaae2..8364a4a 100644 --- a/example_test.go +++ b/example_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/go-shiori/go-epub" + "github.com/neclepsio/go-epub" ) func ExampleEpub_AddCSS() { diff --git a/fs.go b/fs.go index eb898f8..2144922 100644 --- a/fs.go +++ b/fs.go @@ -4,9 +4,9 @@ import ( "fmt" "os" - "github.com/go-shiori/go-epub/internal/storage" - "github.com/go-shiori/go-epub/internal/storage/memory" - "github.com/go-shiori/go-epub/internal/storage/osfs" + "github.com/neclepsio/go-epub/internal/storage" + "github.com/neclepsio/go-epub/internal/storage/memory" + "github.com/neclepsio/go-epub/internal/storage/osfs" ) type FSType int diff --git a/go.mod b/go.mod index 2e487b4..e321c68 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/go-shiori/go-epub +module github.com/neclepsio/go-epub go 1.21 diff --git a/internal/storage/memory/fs.go b/internal/storage/memory/fs.go index d46beb4..0267c3e 100644 --- a/internal/storage/memory/fs.go +++ b/internal/storage/memory/fs.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/go-shiori/go-epub/internal/storage" + "github.com/neclepsio/go-epub/internal/storage" ) type Memory struct { diff --git a/internal/storage/osfs/fs.go b/internal/storage/osfs/fs.go index 1575359..a697830 100644 --- a/internal/storage/osfs/fs.go +++ b/internal/storage/osfs/fs.go @@ -7,7 +7,7 @@ import ( "os" "path/filepath" - "github.com/go-shiori/go-epub/internal/storage" + "github.com/neclepsio/go-epub/internal/storage" ) type OSFS struct { From d93069a3bf2ac661a5c25e0c9700aad561804dd9 Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Tue, 27 Aug 2024 19:04:21 +0200 Subject: [PATCH 03/13] Revert "Add partial support for sections properties" This reverts commit 4caa83828cf4ed1dcfa4907c515767e2bccbcd40. --- epub.go | 50 ++++++-------------------------------------------- write.go | 2 +- 2 files changed, 7 insertions(+), 45 deletions(-) diff --git a/epub.go b/epub.go index c55f109..35d4a43 100644 --- a/epub.go +++ b/epub.go @@ -31,8 +31,6 @@ Basic usage: package epub import ( - "bytes" - "encoding/xml" "fmt" "io/fs" "log" @@ -158,10 +156,9 @@ type epubCover struct { } type epubSection struct { - filename string - xhtml *xhtml - children []*epubSection - properties string + filename string + xhtml *xhtml + children []*epubSection } // NewEpub returns a new Epub. @@ -380,10 +377,9 @@ func (e *Epub) addSection(parentFilename string, body string, sectionTitle strin } s := &epubSection{ - filename: internalFilename, - xhtml: x, - children: nil, - properties: propertiesFromBody(body), + filename: internalFilename, + xhtml: x, + children: nil, } // section have parentIndex -1 and subsection have parrentindex != -1 @@ -401,40 +397,6 @@ func (e *Epub) addSection(parentFilename string, body string, sectionTitle strin return internalFilename, nil } -// supports mathml, svg, scripted (partially) -// does not support remote-sources, switch (deprecated) -func propertiesFromBody(body string) string { - prop := map[string]bool{} - - decoder := xml.NewDecoder(bytes.NewBufferString(body)) - for { - t, _ := decoder.Token() - if t == nil { - break - } - switch se := t.(type) { - case xml.StartElement: - switch strings.ToUpper(se.Name.Local) { - case "SVG": - prop["svg"] = true - case "MATHML": - prop["mathml"] = true - case "SCRIPT": - prop["scripted"] = true - case "FORM": - prop["scripted"] = true - } - default: - } - } - - ret := []string{} - for k := range prop { - ret = append(ret, k) - } - return strings.Join(ret, " ") -} - // Author returns the author of the EPUB. func (e *Epub) Author() string { return e.author diff --git a/write.go b/write.go index 637c406..eb9b0a0 100644 --- a/write.go +++ b/write.go @@ -485,7 +485,7 @@ func writeSections(rootEpubDir string, e *Epub, sections []*epubSection, parentf if section.filename != e.cover.xhtmlFilename { e.pkg.addToSpine(section.filename) } - e.pkg.addToManifest(section.filename, relativePath, mediaTypeXhtml, section.properties) + e.pkg.addToManifest(section.filename, relativePath, mediaTypeXhtml, "") if parentfilename[section.filename] == "-1" && section.filename != e.cover.xhtmlFilename { j := filenamelist[section.filename] e.toc.addSubSection("-1", j, section.xhtml.Title(), relativePath) From 2eb4c87ef9a229bc1a85365c2b262a4be1cf67c8 Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Tue, 27 Aug 2024 19:05:54 +0200 Subject: [PATCH 04/13] Reapply "Add partial support for sections properties" This reverts commit d93069a3bf2ac661a5c25e0c9700aad561804dd9. --- epub.go | 50 ++++++++++++++++++++++++++++++++++++++++++++------ write.go | 2 +- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/epub.go b/epub.go index 35d4a43..c55f109 100644 --- a/epub.go +++ b/epub.go @@ -31,6 +31,8 @@ Basic usage: package epub import ( + "bytes" + "encoding/xml" "fmt" "io/fs" "log" @@ -156,9 +158,10 @@ type epubCover struct { } type epubSection struct { - filename string - xhtml *xhtml - children []*epubSection + filename string + xhtml *xhtml + children []*epubSection + properties string } // NewEpub returns a new Epub. @@ -377,9 +380,10 @@ func (e *Epub) addSection(parentFilename string, body string, sectionTitle strin } s := &epubSection{ - filename: internalFilename, - xhtml: x, - children: nil, + filename: internalFilename, + xhtml: x, + children: nil, + properties: propertiesFromBody(body), } // section have parentIndex -1 and subsection have parrentindex != -1 @@ -397,6 +401,40 @@ func (e *Epub) addSection(parentFilename string, body string, sectionTitle strin return internalFilename, nil } +// supports mathml, svg, scripted (partially) +// does not support remote-sources, switch (deprecated) +func propertiesFromBody(body string) string { + prop := map[string]bool{} + + decoder := xml.NewDecoder(bytes.NewBufferString(body)) + for { + t, _ := decoder.Token() + if t == nil { + break + } + switch se := t.(type) { + case xml.StartElement: + switch strings.ToUpper(se.Name.Local) { + case "SVG": + prop["svg"] = true + case "MATHML": + prop["mathml"] = true + case "SCRIPT": + prop["scripted"] = true + case "FORM": + prop["scripted"] = true + } + default: + } + } + + ret := []string{} + for k := range prop { + ret = append(ret, k) + } + return strings.Join(ret, " ") +} + // Author returns the author of the EPUB. func (e *Epub) Author() string { return e.author diff --git a/write.go b/write.go index eb9b0a0..637c406 100644 --- a/write.go +++ b/write.go @@ -485,7 +485,7 @@ func writeSections(rootEpubDir string, e *Epub, sections []*epubSection, parentf if section.filename != e.cover.xhtmlFilename { e.pkg.addToSpine(section.filename) } - e.pkg.addToManifest(section.filename, relativePath, mediaTypeXhtml, "") + e.pkg.addToManifest(section.filename, relativePath, mediaTypeXhtml, section.properties) if parentfilename[section.filename] == "-1" && section.filename != e.cover.xhtmlFilename { j := filenamelist[section.filename] e.toc.addSubSection("-1", j, section.xhtml.Title(), relativePath) From fc4be966268d2ac12cabd8367eb47e35f4263da9 Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Tue, 27 Aug 2024 19:06:12 +0200 Subject: [PATCH 05/13] Revert "Change import path" This reverts commit f41567c38e1769dc556a2b960a7f4967a54666f6. --- epub_test.go | 2 +- example_test.go | 2 +- fs.go | 6 +++--- go.mod | 2 +- internal/storage/memory/fs.go | 2 +- internal/storage/osfs/fs.go | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/epub_test.go b/epub_test.go index 817fb10..f2ab888 100644 --- a/epub_test.go +++ b/epub_test.go @@ -17,8 +17,8 @@ import ( "testing" "time" + "github.com/go-shiori/go-epub/internal/storage" "github.com/gofrs/uuid/v5" - "github.com/neclepsio/go-epub/internal/storage" ) const ( diff --git a/example_test.go b/example_test.go index 8364a4a..3cdaae2 100644 --- a/example_test.go +++ b/example_test.go @@ -7,7 +7,7 @@ import ( "net/http/httptest" "testing" - "github.com/neclepsio/go-epub" + "github.com/go-shiori/go-epub" ) func ExampleEpub_AddCSS() { diff --git a/fs.go b/fs.go index 2144922..eb898f8 100644 --- a/fs.go +++ b/fs.go @@ -4,9 +4,9 @@ import ( "fmt" "os" - "github.com/neclepsio/go-epub/internal/storage" - "github.com/neclepsio/go-epub/internal/storage/memory" - "github.com/neclepsio/go-epub/internal/storage/osfs" + "github.com/go-shiori/go-epub/internal/storage" + "github.com/go-shiori/go-epub/internal/storage/memory" + "github.com/go-shiori/go-epub/internal/storage/osfs" ) type FSType int diff --git a/go.mod b/go.mod index e321c68..2e487b4 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/neclepsio/go-epub +module github.com/go-shiori/go-epub go 1.21 diff --git a/internal/storage/memory/fs.go b/internal/storage/memory/fs.go index 0267c3e..d46beb4 100644 --- a/internal/storage/memory/fs.go +++ b/internal/storage/memory/fs.go @@ -6,7 +6,7 @@ import ( "strings" "time" - "github.com/neclepsio/go-epub/internal/storage" + "github.com/go-shiori/go-epub/internal/storage" ) type Memory struct { diff --git a/internal/storage/osfs/fs.go b/internal/storage/osfs/fs.go index a697830..1575359 100644 --- a/internal/storage/osfs/fs.go +++ b/internal/storage/osfs/fs.go @@ -7,7 +7,7 @@ import ( "os" "path/filepath" - "github.com/neclepsio/go-epub/internal/storage" + "github.com/go-shiori/go-epub/internal/storage" ) type OSFS struct { From 1f06dc98564a033b6b0b4b279c37388b057093f4 Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Tue, 10 Sep 2024 10:54:28 +0200 Subject: [PATCH 06/13] Add test for properties --- epub.go | 13 +++++++----- epub_test.go | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 5 deletions(-) diff --git a/epub.go b/epub.go index c55f109..e1710a7 100644 --- a/epub.go +++ b/epub.go @@ -401,7 +401,7 @@ func (e *Epub) addSection(parentFilename string, body string, sectionTitle strin return internalFilename, nil } -// supports mathml, svg, scripted (partially) +// supports mathml, svg, scripted // does not support remote-sources, switch (deprecated) func propertiesFromBody(body string) string { prop := map[string]bool{} @@ -417,12 +417,15 @@ func propertiesFromBody(body string) string { switch strings.ToUpper(se.Name.Local) { case "SVG": prop["svg"] = true - case "MATHML": - prop["mathml"] = true + case "MATH": + if se.Name.Space == "http://www.w3.org/1998/Math/MathML" { + prop["mathml"] = true + } case "SCRIPT": prop["scripted"] = true - case "FORM": - prop["scripted"] = true + // See the comment in TestSectionProperties + //case "FORM": + // prop["scripted"] = true } default: } diff --git a/epub_test.go b/epub_test.go index f2ab888..fc09784 100644 --- a/epub_test.go +++ b/epub_test.go @@ -1480,3 +1480,61 @@ func TestAddSubSectionWithCustomFilename(t *testing.T) { cleanup(testEpubFilename, tempDir) } + +func TestSectionProperties(t *testing.T) { + e, err := NewEpub(testEpubTitle) + if err != nil { + t.Error(err) + } + + _, err = e.AddSection("

Section 1

", "Section 1", "section0001.xhtml", "") + if err != nil { + t.Errorf("Error adding section: %s", err) + } + + _, err = e.AddSection("

Section 2

", "Section 2", "section0002.xhtml", "") + if err != nil { + t.Errorf("Error adding section: %s", err) + } + + _, err = e.AddSection("

Section 3

", "Section 3", "section0003.xhtml", "") + if err != nil { + t.Errorf("Error adding section: %s", err) + } + + // https://www.w3.org/TR/epub-33/#sec-scripted says "scripted" should be added + // when there are form elements, but epubcheck disagrees. + // See also: https://github.com/w3c/epubcheck/blob/55aad60015ac644a04f7e2648d9969f80d5922b6/src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java#L349 + /* + _, err = e.AddSection(`

Section 4

`, "Section 4", "section0004.xhtml", "") + if err != nil { + t.Errorf("Error adding section: %s", err) + } + */ + + _, err = e.AddSection("

Section 5

", "Section 5", "section0005.xhtml", "") + if err != nil { + t.Errorf("Error adding section: %s", err) + } + + tempDir := writeAndExtractEpub(t, e, testEpubFilename) + + output, err := validateEpub(t, testEpubFilename) + if err != nil { + t.Errorf("EPUB validation failed") + } + + // Always print the output so we can see warnings as well + if output != nil { + fmt.Println(string(output)) + } + if doCleanup { + cleanup(testEpubFilename, tempDir) + } else { + // Always remove the files in tempDir; they can still be extracted from the test epub as needed + err := filesystem.RemoveAll(tempDir) + if err != nil { + log.Print("Error removing temp directory: %w", err) + } + } +} From ff60803667532316cd74eb75666ef45f08f1d27f Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Wed, 11 Sep 2024 17:20:58 +0200 Subject: [PATCH 07/13] Re-enable scripted property when there are form tags --- README.md | 4 ++-- epub.go | 5 +---- epub_test.go | 13 ++++--------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index dd5c934..e324b07 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ If EPUBCheck is installed locally, it will be run alongside the Go tests. To ins 1. Download and extract EPUBCheck in the root directory of this project, e.g. ``` - wget https://github.com/IDPF/epubcheck/releases/download/v4.2.5/epubcheck-4.2.5.zip - unzip epubcheck-4.2.5.zip + wget https://github.com/IDPF/epubcheck/releases/download/v4.2.5/epubcheck-5.1.0.zip + unzip epubcheck-5.1.0.zip ``` If you do not wish to install EPUBCheck locally, you can manually validate the EPUB: diff --git a/epub.go b/epub.go index e1710a7..95a3daa 100644 --- a/epub.go +++ b/epub.go @@ -421,11 +421,8 @@ func propertiesFromBody(body string) string { if se.Name.Space == "http://www.w3.org/1998/Math/MathML" { prop["mathml"] = true } - case "SCRIPT": + case "SCRIPT", "FORM": prop["scripted"] = true - // See the comment in TestSectionProperties - //case "FORM": - // prop["scripted"] = true } default: } diff --git a/epub_test.go b/epub_test.go index fc09784..0f25e85 100644 --- a/epub_test.go +++ b/epub_test.go @@ -1502,15 +1502,10 @@ func TestSectionProperties(t *testing.T) { t.Errorf("Error adding section: %s", err) } - // https://www.w3.org/TR/epub-33/#sec-scripted says "scripted" should be added - // when there are form elements, but epubcheck disagrees. - // See also: https://github.com/w3c/epubcheck/blob/55aad60015ac644a04f7e2648d9969f80d5922b6/src/main/java/com/adobe/epubcheck/ops/OPSHandler30.java#L349 - /* - _, err = e.AddSection(`

Section 4

`, "Section 4", "section0004.xhtml", "") - if err != nil { - t.Errorf("Error adding section: %s", err) - } - */ + _, err = e.AddSection(`

Section 4

`, "Section 4", "section0004.xhtml", "") + if err != nil { + t.Errorf("Error adding section: %s", err) + } _, err = e.AddSection("

Section 5

", "Section 5", "section0005.xhtml", "") if err != nil { From 8d96de00f1d8e9ccf350c463fdaaa61fe824298f Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Wed, 11 Sep 2024 17:40:47 +0200 Subject: [PATCH 08/13] Fix readme --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e324b07..e8f2adb 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,17 @@ If EPUBCheck is installed locally, it will be run alongside the Go tests. To ins 1. Download and extract EPUBCheck in the root directory of this project, e.g. ``` - wget https://github.com/IDPF/epubcheck/releases/download/v4.2.5/epubcheck-5.1.0.zip + wget https://github.com/IDPF/epubcheck/releases/download/v5.1.0/epubcheck-5.1.0.zip unzip epubcheck-5.1.0.zip ``` + You can use this command to download and extract the latest versions of EpubCheck. + + ``` + curl -s https://api.github.com/repos/w3c/epubcheck/releases/latest | awk -F': "' '/browser_download_url/ && /epubcheck/ {gsub(/"$/, "", $2); print $2}' | xargs curl -Lo epubcheck.zip + unzip epubcheck.zip + ``` + If you do not wish to install EPUBCheck locally, you can manually validate the EPUB: 1. Set `doCleanup = false` in epub_test.go From c6994f215d8cff21e6672e9350e90dc105520893 Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Wed, 11 Sep 2024 17:41:55 +0200 Subject: [PATCH 09/13] Fix readme --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e324b07..e8f2adb 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,17 @@ If EPUBCheck is installed locally, it will be run alongside the Go tests. To ins 1. Download and extract EPUBCheck in the root directory of this project, e.g. ``` - wget https://github.com/IDPF/epubcheck/releases/download/v4.2.5/epubcheck-5.1.0.zip + wget https://github.com/IDPF/epubcheck/releases/download/v5.1.0/epubcheck-5.1.0.zip unzip epubcheck-5.1.0.zip ``` + You can use this command to download and extract the latest versions of EpubCheck. + + ``` + curl -s https://api.github.com/repos/w3c/epubcheck/releases/latest | awk -F': "' '/browser_download_url/ && /epubcheck/ {gsub(/"$/, "", $2); print $2}' | xargs curl -Lo epubcheck.zip + unzip epubcheck.zip + ``` + If you do not wish to install EPUBCheck locally, you can manually validate the EPUB: 1. Set `doCleanup = false` in epub_test.go From 99648f1f6304c62f3acf0f7e1553e6787d01eea1 Mon Sep 17 00:00:00 2001 From: Ignazio Di Napoli Date: Wed, 11 Sep 2024 17:42:16 +0200 Subject: [PATCH 10/13] Fix readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e8f2adb..4c0d0bf 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ If EPUBCheck is installed locally, it will be run alongside the Go tests. To ins unzip epubcheck-5.1.0.zip ``` - You can use this command to download and extract the latest versions of EpubCheck. + You can use this command to download and extract the latest versions of EPUBCheck (recommended). ``` curl -s https://api.github.com/repos/w3c/epubcheck/releases/latest | awk -F': "' '/browser_download_url/ && /epubcheck/ {gsub(/"$/, "", $2); print $2}' | xargs curl -Lo epubcheck.zip From 88e12874bbf69034647959cb01e922dc5b7e0d2c Mon Sep 17 00:00:00 2001 From: neclepsio Date: Wed, 16 Oct 2024 11:55:40 +0200 Subject: [PATCH 11/13] Fix upstream #46 --- toc.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toc.go b/toc.go index 8371478..9e0acb5 100644 --- a/toc.go +++ b/toc.go @@ -4,6 +4,7 @@ import ( "encoding/xml" "fmt" "log" + "path" "path/filepath" "regexp" "strconv" @@ -174,7 +175,7 @@ func (t *toc) addSubSection(parent string, index int, title string, relativePath t.ncxXML.NavMap = append(t.ncxXML.NavMap, np) } else { - parentRelativePath := filepath.Join(xhtmlFolderName, parent) + parentRelativePath := path.Join(xhtmlFolderName, parent) l := &tocNavItem{ A: tocNavLink{ From 42492e2c3f49b82a28ec51b240ff125a3781a919 Mon Sep 17 00:00:00 2001 From: neclepsio Date: Wed, 16 Oct 2024 12:03:14 +0200 Subject: [PATCH 12/13] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 154bb90..61fc442 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/go-shiori/go-epub +module github.com/neclepsio/go-epub go 1.23.1 From 4ec2b790baf6eccdd63567504d293fbfe06d4434 Mon Sep 17 00:00:00 2001 From: neclepsio Date: Wed, 16 Oct 2024 12:11:41 +0200 Subject: [PATCH 13/13] Update go.mod --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 61fc442..154bb90 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/neclepsio/go-epub +module github.com/go-shiori/go-epub go 1.23.1