Commit 749e2d0f authored by Siong-Ui Te's avatar Siong-Ui Te

roman to thai script (experimental)

parent 2aecfab9
......@@ -13,44 +13,16 @@ addons:
- make
- git
- gettext
# https://docs.travis-ci.com/user/build-matrix/
jobs:
include:
# for dictionary.online-dhamma.net
- env: TARGET_WEBSITE=dhamma
install:
- cd dictionary/
- make install
script:
- make make-dhamma
after_success:
- make custom_dhamma_deploy
# for dictionary.sutta.org
- env: TARGET_WEBSITE=sutta
install:
- cd dictionary/
- make install
script:
- make make-sutta
after_success:
- make custom_sutta_deploy
# dpl v2 (not working for lots of symlinks)
#deploy:
# - provider: pages:git
# repo: siongui/dictionary.sutta.org
# keep_history: false
# token: $GITHUB_TOKEN
# local_dir: website
# on:
# branch: master
# edge: true
# verbose: true
# dpl v1 (not working for lots of symlinks)
#deploy:
# - provider: pages
# repo: siongui/dictionary.sutta.org
# skip_cleanup: true
# github_token: $GITHUB_TOKEN
# local_dir: website
# on:
# branch: master
install:
- cd tipitaka/
- make install
script:
- make make-sutta
deploy:
- provider: pages
repo: siongui/tipitaka.sutta.org
skip_cleanup: true
github_token: $GITHUB_TOKEN
local_dir: tipitaka/website
on:
branch: master
......@@ -262,7 +262,7 @@ po2mo:
###################
install: lib_pali lib_gtmpl lib_gopherjs_input_suggest lib_gopherjs
lib_pali:
lib_pali: lib_palitrans
@echo "\033[92mInstalling common lib used in this project ...\033[0m"
go get -u github.com/siongui/gopalilib/dicutil
go get -u github.com/siongui/gopaliwordvfs
......@@ -271,6 +271,10 @@ lib_pali:
go get -u github.com/siongui/gopalilib/libfrontend
go get -u github.com/siongui/pali-transliteration
lib_palitrans:
@echo "\033[92mInstalling Go Pāli Transliteration ...\033[0m"
go get -u github.com/siongui/pali-transliteration
lib_gtmpl:
@echo "\033[92mInstalling Go html/template with gettext support ...\033[0m"
go get -u github.com/siongui/gtmpl
......
......@@ -98,7 +98,7 @@ embed_data: fmt clone_tpk_xml clone_pali_data
###################
install: lib_pali lib_gtmpl lib_godom lib_gopherjs lib_goef
lib_pali:
lib_pali: lib_palitrans
@echo "\033[92mInstalling common lib used in this project ...\033[0m"
go get -u github.com/siongui/gopalilib/dicutil
go get -u github.com/siongui/gopalilib/lib/tipitaka
......@@ -109,6 +109,10 @@ lib_pali:
go get -u github.com/siongui/gopalilib/libfrontend/velthuis
go get -u github.com/siongui/gopalilib/libfrontend/setting
lib_palitrans:
@echo "\033[92mInstalling Go Pāli Transliteration ...\033[0m"
go get -u github.com/siongui/pali-transliteration
lib_gtmpl:
@echo "\033[92mInstalling Go html/template with gettext support ...\033[0m"
go get -u github.com/siongui/gtmpl
......
......@@ -2,6 +2,7 @@ package main
import (
"encoding/json"
"strings"
. "github.com/siongui/godom"
"github.com/siongui/gopalilib/lib"
......@@ -11,8 +12,18 @@ import (
"github.com/siongui/gopalilib/libfrontend/treeview"
"github.com/siongui/gopalilib/libfrontend/velthuis"
"github.com/siongui/gopalilib/libfrontend/xslt"
palitrans "github.com/siongui/pali-transliteration"
)
func toThai() {
mainview := Document.GetElementById("mainview")
spans := mainview.QuerySelectorAll("span[class=\"paliword\"]")
for _, span := range spans {
word := strings.ToLower(span.InnerHTML())
span.SetInnerHTML(palitrans.RomanToThai(word))
}
}
func xmlAction(t lib.Tree) {
// FIXME: show loading not working on Chromium
ShowIsLoadingXML(t.Text)
......@@ -29,6 +40,12 @@ func xmlAction(t lib.Tree) {
fragment := xslt.GetXSLTProcessor().TransformToFragment(xmlDoc, Document)
mainview.QuerySelector("div.content").RemoveAllChildNodes()
r2t := Document.CreateElement("div")
r2t.SetInnerHTML("To Thai Script (experimental)")
r2t.AddEventListener("click", func(e Event) {
toThai()
})
mainview.QuerySelector("div.content").AppendChild(r2t)
mainview.QuerySelector("div.content").AppendChild(fragment)
everyword.MarkEveryWord("#mainview > div.content", wordClickedHandler)
......
......@@ -16,6 +16,12 @@ func CopyTreeToToCTree(t lib.Tree, toc *ToCTree) {
toc.Src = t.Src
toc.Action = t.Action
/*
if t.Text != "" && t.Src == "" && t.Action == "" {
println(t.Text)
}
*/
if subpath := tipitaka.TrimTreeText2(t.Text); subpath != "" {
if subpath == "tipiṭaka (mūla)" {
subpath = "canon"
......@@ -30,7 +36,7 @@ func CopyTreeToToCTree(t lib.Tree, toc *ToCTree) {
}
toc.UrlPath += "/"
println(toc.UrlPath)
//println(toc.UrlPath)
}
func SetupTipitakaUrl(tree lib.Tree) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment