Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion db/db_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const GetBookDataById = `
const GetNotesHighlightsById = `
select
a.ZAEANNOTATION.ZANNOTATIONSELECTEDTEXT,
a.ZAEANNOTATION.ZANNOTATIONNOTE
a.ZAEANNOTATION.ZANNOTATIONNOTE,
a.ZAEANNOTATION.ZANNOTATIONSTYLE
from
a.ZAEANNOTATION
where
Expand Down
1 change: 1 addition & 0 deletions db/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type SingleBook struct {
type SingleHighlightNote struct {
HightLight string
Note sql.NullString
Style int
}

type SingleBookInList struct {
Expand Down
26 changes: 24 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ func exportNotesAndHighlights(cCtx *cli.Context) error {

var singleHightLightNote dbThings.SingleHighlightNote
for rows.Next() {
err := rows.Scan(&singleHightLightNote.HightLight, &singleHightLightNote.Note)
err := rows.Scan(&singleHightLightNote.HightLight, &singleHightLightNote.Note, &singleHightLightNote.Style)
if err != nil {
log.Fatal(err)
}

fmt.Println(fmt.Sprintf("> %s", strings.Replace(singleHightLightNote.HightLight, "\n", "", -1)))
fmt.Println(fmt.Sprintf("> <span style='background-color:%s;color:black'>%s</span>",styleToColor(singleHightLightNote.Style),strings.Replace(singleHightLightNote.HightLight, "\n", "", -1)))

if singleHightLightNote.Note.Valid {
fmt.Println(fmt.Sprintf("\n%s", strings.Replace(singleHightLightNote.Note.String, "\n", "", -1)))
Expand All @@ -195,3 +195,25 @@ func exportNotesAndHighlights(cCtx *cli.Context) error {

return nil
}

func styleToColor(style int) string {
switch style {
case 1:
// green
return "#a8e196"
case 2:
// blue
return "#a5c3ff"
case 3:
// yellow
return "#fde15c"
case 4:
// pink
return "#ffaabf"
case 5:
// purple
return "#cdbbfb"
default:
return ""
}
}