File tree Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Expand file tree Collapse file tree 5 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,10 @@ module github.com/kjanat/articulate-parser
22
33go 1.24.0
44
5- require github.com/fumiama/go-docx v0.0.0-20250506085032-0c30fd09304b
5+ require (
6+ github.com/fumiama/go-docx v0.0.0-20250506085032-0c30fd09304b
7+ golang.org/x/text v0.30.0
8+ )
69
710require (
811 github.com/fumiama/imgsz v0.0.4 // indirect
Original file line number Diff line number Diff line change @@ -4,3 +4,5 @@ github.com/fumiama/imgsz v0.0.4 h1:Lsasu2hdSSFS+vnD+nvR1UkiRMK7hcpyYCC0FzgSMFI=
44github.com/fumiama/imgsz v0.0.4 /go.mod h1:bISOQVTlw9sRytPwe8ir7tAaEmyz9hSNj9n8mXMBG0E =
55golang.org/x/image v0.32.0 h1:6lZQWq75h7L5IWNk0r+SCpUJ6tUVd3v4ZHnbRKLkUDQ =
66golang.org/x/image v0.32.0 /go.mod h1:/R37rrQmKXtO6tYXAjtDLwQgFLHmhW+V6ayXlxzP2Pc =
7+ golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k =
8+ golang.org/x/text v0.30.0 /go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM =
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import (
1111 "github.com/kjanat/articulate-parser/internal/interfaces"
1212 "github.com/kjanat/articulate-parser/internal/models"
1313 "github.com/kjanat/articulate-parser/internal/services"
14+ "golang.org/x/text/cases"
15+ "golang.org/x/text/language"
1416)
1517
1618// DocxExporter implements the Exporter interface for DOCX format.
@@ -119,7 +121,8 @@ func (e *DocxExporter) exportItem(doc *docx.Docx, item *models.Item) {
119121 // Add item type as heading
120122 if item .Type != "" {
121123 itemPara := doc .AddParagraph ()
122- itemPara .AddText (strings .Title (item .Type )).Size ("24" ).Bold ()
124+ caser := cases .Title (language .English )
125+ itemPara .AddText (caser .String (item .Type )).Size ("24" ).Bold ()
123126 }
124127
125128 // Add sub-items
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import (
1212 "github.com/kjanat/articulate-parser/internal/interfaces"
1313 "github.com/kjanat/articulate-parser/internal/models"
1414 "github.com/kjanat/articulate-parser/internal/services"
15+ "golang.org/x/text/cases"
16+ "golang.org/x/text/language"
1517)
1618
1719// HTMLExporter implements the Exporter interface for HTML format.
@@ -441,7 +443,8 @@ func (e *HTMLExporter) processDividerItem(buf *bytes.Buffer) {
441443func (e * HTMLExporter ) processUnknownItem (buf * bytes.Buffer , item models.Item ) {
442444 if len (item .Items ) > 0 {
443445 buf .WriteString (" <div class=\" item unknown-item\" >\n " )
444- buf .WriteString (fmt .Sprintf (" <h4>%s Content</h4>\n " , strings .Title (item .Type )))
446+ caser := cases .Title (language .English )
447+ buf .WriteString (fmt .Sprintf (" <h4>%s Content</h4>\n " , caser .String (item .Type )))
445448 for _ , subItem := range item .Items {
446449 e .processGenericSubItem (buf , subItem )
447450 }
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ import (
1111 "github.com/kjanat/articulate-parser/internal/interfaces"
1212 "github.com/kjanat/articulate-parser/internal/models"
1313 "github.com/kjanat/articulate-parser/internal/services"
14+ "golang.org/x/text/cases"
15+ "golang.org/x/text/language"
1416)
1517
1618// MarkdownExporter implements the Exporter interface for Markdown format.
@@ -269,7 +271,8 @@ func (e *MarkdownExporter) processDividerItem(buf *bytes.Buffer) {
269271// processUnknownItem handles unknown or unsupported item types
270272func (e * MarkdownExporter ) processUnknownItem (buf * bytes.Buffer , item models.Item , headingPrefix string ) {
271273 if len (item .Items ) > 0 {
272- buf .WriteString (fmt .Sprintf ("%s %s Content\n \n " , headingPrefix , strings .Title (item .Type )))
274+ caser := cases .Title (language .English )
275+ buf .WriteString (fmt .Sprintf ("%s %s Content\n \n " , headingPrefix , caser .String (item .Type )))
273276 for _ , subItem := range item .Items {
274277 e .processGenericSubItem (buf , subItem )
275278 }
You can’t perform that action at this time.
0 commit comments