From acd8b842b6d83dc7d4906705bc4c82c792e4d0de Mon Sep 17 00:00:00 2001 From: linchen2chris Date: Tue, 21 Feb 2023 18:48:17 +0800 Subject: [PATCH 1/4] make it possible to customize style for status/priority/tag --- org/html_writer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org/html_writer.go b/org/html_writer.go index e763aa7..4738151 100644 --- a/org/html_writer.go +++ b/org/html_writer.go @@ -293,17 +293,17 @@ func (w *HTMLWriter) WriteHeadline(h Headline) { w.WriteString(fmt.Sprintf(`
`, h.ID(), level) + "\n") w.WriteString(fmt.Sprintf(``, level, h.ID()) + "\n") if w.document.GetOption("todo") != "nil" && h.Status != "" { - w.WriteString(fmt.Sprintf(`%s`, h.Status) + "\n") + w.WriteString(fmt.Sprintf(`%s`, h.Status, h.Status) + "\n") } if w.document.GetOption("pri") != "nil" && h.Priority != "" { - w.WriteString(fmt.Sprintf(`[%s]`, h.Priority) + "\n") + w.WriteString(fmt.Sprintf(`[%s]`, h.Priority, h.Priority) + "\n") } WriteNodes(w, h.Title...) if w.document.GetOption("tags") != "nil" && len(h.Tags) != 0 { tags := make([]string, len(h.Tags)) for i, tag := range h.Tags { - tags[i] = fmt.Sprintf(`%s`, tag) + tags[i] = fmt.Sprintf(`%s`, tag, tag) } w.WriteString("   ") w.WriteString(fmt.Sprintf(`%s`, strings.Join(tags, " "))) From 1dcadee27eebb9b64e9e9435fe572ca57c0510ca Mon Sep 17 00:00:00 2001 From: linchen2chris Date: Tue, 21 Feb 2023 19:10:11 +0800 Subject: [PATCH 2/4] make tag support other language --- org/headline.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org/headline.go b/org/headline.go index 88e317b..c306aec 100644 --- a/org/headline.go +++ b/org/headline.go @@ -31,7 +31,7 @@ type Headline struct { } var headlineRegexp = regexp.MustCompile(`^([*]+)\s+(.*)`) -var tagRegexp = regexp.MustCompile(`(.*?)\s+(:[A-Za-z0-9_@#%:]+:\s*$)`) +var tagRegexp = regexp.MustCompile(`(.*?)\s+(:[\p{L}0-9_@#%:]+:\s*$)`) func lexHeadline(line string) (token, bool) { if m := headlineRegexp.FindStringSubmatch(line); m != nil { From 538fa3b3c5422ad102b719960fac08c5e28691c1 Mon Sep 17 00:00:00 2001 From: linchen2chris Date: Thu, 2 Mar 2023 17:54:06 +0800 Subject: [PATCH 3/4] make classname with priority and lowercase --- org/html_writer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org/html_writer.go b/org/html_writer.go index 4738151..fa458be 100644 --- a/org/html_writer.go +++ b/org/html_writer.go @@ -293,17 +293,17 @@ func (w *HTMLWriter) WriteHeadline(h Headline) { w.WriteString(fmt.Sprintf(`
`, h.ID(), level) + "\n") w.WriteString(fmt.Sprintf(``, level, h.ID()) + "\n") if w.document.GetOption("todo") != "nil" && h.Status != "" { - w.WriteString(fmt.Sprintf(`%s`, h.Status, h.Status) + "\n") + w.WriteString(fmt.Sprintf(`%s`, strings.ToLower(h.Status), h.Status) + "\n") } if w.document.GetOption("pri") != "nil" && h.Priority != "" { - w.WriteString(fmt.Sprintf(`[%s]`, h.Priority, h.Priority) + "\n") + w.WriteString(fmt.Sprintf(`[%s]`, strings.ToLower(h.Priority), h.Priority) + "\n") } WriteNodes(w, h.Title...) if w.document.GetOption("tags") != "nil" && len(h.Tags) != 0 { tags := make([]string, len(h.Tags)) for i, tag := range h.Tags { - tags[i] = fmt.Sprintf(`%s`, tag, tag) + tags[i] = fmt.Sprintf(`%s`, strings.ToLower(tag), tag) } w.WriteString("   ") w.WriteString(fmt.Sprintf(`%s`, strings.Join(tags, " "))) From 29e77a0555ebbf66e673f7fb4d14c0239eb40e61 Mon Sep 17 00:00:00 2001 From: linchen2chris Date: Thu, 2 Mar 2023 17:56:27 +0800 Subject: [PATCH 4/4] update the fixtures --- org/testdata/headlines.html | 12 ++++++------ org/testdata/misc.html | 38 ++++++++++++++++++------------------- org/testdata/options.html | 6 +++--- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/org/testdata/headlines.html b/org/testdata/headlines.html index 1c72f22..e598777 100644 --- a/org/testdata/headlines.html +++ b/org/testdata/headlines.html @@ -32,14 +32,14 @@ not just where they are actually meant to be - even here >

-TODO -[B] +TODO +[B] Headline with todo status & priority

-DONE +DONE Headline with TODO status

@@ -49,8 +49,8 @@ we can link to headlines that define a custom_id:

-[A] -Headline with tags & priority   foo bar +[A] +Headline with tags & priority   foo bar

Still outside the drawer

@@ -60,7 +60,7 @@ Headline with tags & priority   foo<

-CUSTOM +CUSTOM headline with custom status

diff --git a/org/testdata/misc.html b/org/testdata/misc.html index 8043e23..66639ac 100644 --- a/org/testdata/misc.html +++ b/org/testdata/misc.html @@ -90,7 +90,7 @@ issues from goorgeous (free test cases, yay!)

-DONE +DONE #19: Support #+HTML

@@ -99,7 +99,7 @@ issues from goorgeous (free test cases, yay!)

-DONE +DONE #29: Support verse block

@@ -116,7 +116,7 @@ crazy ain't it?

-DONE +DONE #30: Support #+SETUPFILE

@@ -125,7 +125,7 @@ crazy ain't it?

-DONE +DONE #31: Support #+INCLUDE

@@ -240,7 +240,7 @@ jobs:

-DONE +DONE #33: Wrong output when mixing html with Org mode

@@ -262,13 +262,13 @@ jobs:

-DONE +DONE #41: Support Table Of Contents

-DONE +DONE #46: Support for symbols like ndash and mdash

@@ -283,7 +283,7 @@ jobs:

-DONE +DONE #47: Consecutive code wrapped text gets joined

@@ -294,7 +294,7 @@ or that foo.

-DONE +DONE #50: LineBreaks in lists are preserved

@@ -317,7 +317,7 @@ lists

-DONE +DONE #68: Quote block with inline markup

@@ -328,7 +328,7 @@ lists

-DONE +DONE #72: Support for #+ATTR_HTML

@@ -337,7 +337,7 @@ lists

-DONE +DONE #75: Not parsing nested lists correctly

@@ -353,13 +353,13 @@ lists

-DONE +DONE #77: Recognize code— as code plus dash

-DONE +DONE #78: Emphasis at beginning of line

@@ -371,7 +371,7 @@ Text

-DONE +DONE #82: Crash on empty headline

@@ -387,7 +387,7 @@ Text

-DONE +DONE #84: Paragraphs that are not followed by an empty line are not parsed correctly

@@ -411,7 +411,7 @@ Bar

-DONE +DONE #86: Multiple hyphens not converted to dashes

@@ -445,7 +445,7 @@ Bar

-DONE +DONE #87: Markup in footnotes is rendered literally

@@ -454,7 +454,7 @@ Bar

-DONE +DONE #92: src blocks only render in caps

diff --git a/org/testdata/options.html b/org/testdata/options.html index 7c04165..dac68ce 100644 --- a/org/testdata/options.html +++ b/org/testdata/options.html @@ -1,8 +1,8 @@

-DONE -[A] -#+OPTIONS: toggles supported by go-org   tag1 tag2 +DONE +[A] +#+OPTIONS: toggles supported by go-org   tag1 tag2

go-org supports multiple export toggles as described in the export settings section of the Org mode manual.