diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml new file mode 100644 index 0000000..769842c --- /dev/null +++ b/.github/workflows/github-actions-demo.yml @@ -0,0 +1,19 @@ +name: GitHub Actions Demo +run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 +on: [push] +jobs: + Explore-GitHub-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v4 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + - run: echo "🖥️ The workflow is now ready to test your code on the runner." + - name: List files in the repository + run: | + ls ${{ github.workspace }} + - run: echo "🍏 This job's status is ${{ job.status }}." + diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..925866c --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,28 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... diff --git a/.gitignore b/.gitignore index b28aef6..b5a5eaa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /tmp mdict_parser .DS_Store +.luarc.json diff --git a/config.go b/config.go index bd55b8f..69d8944 100644 --- a/config.go +++ b/config.go @@ -26,7 +26,8 @@ func loadConfig() error { // TODO: more configurations, such as default engine. if len(c.Dicts) == 0 { return nil } - ldoceMdx = c.Dicts[0] + ".json" - log.Printf("get dicts: %v", ldoceMdx) + globalDict.mdxFile = c.Dicts[0] + ".json" + globalDict.mdxCss = c.Dicts[0] + ".css" + log.Printf("get global dicts: %v", globalDict) return nil } diff --git a/index.html b/index.html index a38a372..364f19d 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@

-
+
diff --git a/main.go b/main.go index 999daf6..8146503 100644 --- a/main.go +++ b/main.go @@ -81,7 +81,7 @@ func main() { } if *interactive { - ldoceDict = loadDecodedMdx(filepath.Join(dataPath, "dicts", ldoceMdx)) // TODO(ch): lazy loading for performance? + globalDict.Load() // TODO(ch): lazy loading for performance? startLoop() return } @@ -106,7 +106,7 @@ func main() { } } log.Printf("start a new server: %s/%s/%s/%s", network, addr, *render, *engine) - ldoceDict = loadDecodedMdx(filepath.Join(dataPath, "dicts", ldoceMdx)) // TODO(ch): lazy loading for performance? + globalDict.Load() l, err := net.Listen(network, addr) if err != nil { log.Fatal("bad Listen: ", err) @@ -208,7 +208,7 @@ func main() { if *engine == "mdx" { // io.Copy(os.Stdout, fd) - ldoceDict = loadDecodedMdx(filepath.Join(dataPath, "dicts", ldoceMdx)) // TODO(ch): lazy loading for performance? + globalDict.Load() fmt.Println(queryMDX(*word, *render)) return } diff --git a/mdx.go b/mdx.go index 7220cd1..6656ebe 100644 --- a/mdx.go +++ b/mdx.go @@ -6,26 +6,42 @@ import ( "io" "log" "os" + "path/filepath" "strings" "golang.org/x/net/html" ) -var ( - // ldoceMdx = "Longman Dictionary of Contemporary English" + ".json" - // ldoceMdx = "ODE_zh" + ".json" - ldoceMdx = "oald9" + ".json" - ldoceDict map[string]string -) +type MdxDict struct { + // For personal usage, "oald9.json", or "Longman Dictionary of Contemporary English" + mdxFile string + // Only match the mdx with the same mdxFile name + mdxCss string + mdxDict map[string]string +} + +func (g *MdxDict) Load() error { + g.mdxDict = loadDecodedMdx(filepath.Join(dataPath, "dicts", g.mdxFile)) + if contents, err := os.ReadFile((filepath.Join(dataPath, "dicts", g.mdxCss))); err == nil { + g.mdxCss = string(contents) + } else { + g.mdxCss = "" + log.Printf("load dicts[%v] css err: %v", g.mdxFile, err) + } + return nil +} + +// TODO: support multiple mdx lib at the same time. +var globalDict MdxDict var gbold = "**" var gitalic = "*" func queryMDX(word string, f string) string { if f == "html" { - return ldoceDict[word] + return globalDict.mdxDict[word] } - fd := strings.NewReader(ldoceDict[word]) // TODO: find a "close" one when missing? + fd := strings.NewReader(globalDict.mdxDict[word]) // TODO: find a "close" one when missing? return parseMDX(fd, f) } diff --git a/mdx_test.go b/mdx_test.go index 9b317fa..3fb2511 100644 --- a/mdx_test.go +++ b/mdx_test.go @@ -26,7 +26,7 @@ func Test_GetWords(t *testing.T) { dfs(c, level+1, n) } } - fd, err := os.Open("./tmp/ldoce5.html") + fd, err := os.Open("./testdata/ldoce5.html") if err != nil { log.Fatal(err) } @@ -41,8 +41,8 @@ func Test_GetWords(t *testing.T) { } func Test_MDXParser(t *testing.T) { - // fd, err := os.Open("./tmp/test.html") - fd, err := os.Open("./tmp/doctor_mdx.html") + // fd, err := os.Open("./testdata/test.html") + fd, err := os.Open("./testdata/doctor_mdx.html") if err != nil { log.Fatal(err) } @@ -52,5 +52,5 @@ func Test_MDXParser(t *testing.T) { log.Fatal(err) } // log.Printf("result: %v", readText(doc)) - t.Logf("res: %v", format([]string{f(doc, 0, nil)})) + t.Logf("res: %v", format([]string{f(doc, 0, nil, "md")})) } diff --git a/server.go b/server.go index a2ea538..57ce878 100644 --- a/server.go +++ b/server.go @@ -23,7 +23,7 @@ func (s *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { s.timeout.Reset(*idleTimeout) } log.Printf("query HTTP path: %v", r.URL.Path) - if r.URL.Path == "/dict" { + if strings.HasSuffix(r.URL.Path, "/dict") { q := r.URL.Query() word := q.Get("query") e := q.Get("engine") @@ -34,7 +34,7 @@ func (s *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") w.Write([]byte(res)) if f == "html" { - w.Write([]byte("")) + w.Write([]byte("")) } // w.Write([]byte("")) // w.Write([]byte(fmt.Sprintf(``))) @@ -48,732 +48,6 @@ func (s *proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) { http.FileServer(http.Dir(".")).ServeHTTP(w, r) } -const odecss = ` -@font-face { - font-family: "ODECondensed"; - src: url("fonts/opensanscondensed-light.ttf"); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: "ODESans"; - src: url("fonts/opensans-regular.ttf"); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: "ODESans"; - src: url("fonts/opensans-bold.ttf"); - font-weight: bold; - font-style: normal; -} - -@font-face { - font-family: "ODESans"; - src: url("fonts/opensans-italic.ttf"); - font-weight: normal; - font-style: italic; -} - -@font-face { - font-family: "ODESans"; - src: url("fonts/opensans-bolditalic.ttf"); - font-weight: bold; - font-style: italic; -} - -@font-face { - font-family: "ODESerif"; - src: url("fonts/lora-regular.ttf"); - font-weight: normal; - font-style: normal; -} - -@font-face { - font-family: "ODESerif"; - src: url("fonts/lora-bold.ttf"); - font-weight: bold; - font-style: normal; -} - -@font-face { - font-family: "ODESerif"; - src: url("fonts/lora-italic.ttf"); - font-weight: normal; - font-style: italic; -} - -@font-face { - font-family: "ODESerif"; - src: url("fonts/lora-bolditalic.ttf"); - font-weight: bold; - font-style: italic; -} - -@font-face { - font-family: SansPhon; - src: url('fonts/gentiumplus-r.ttf') format('truetype'); -} - -.Od3 { - /* font-family: Open Sans, ODESans, sans-serif; */ - font-size: 117%; - line-height: 112%; - /* color: azure; */ - /* font-weight: bold; */ -} - -.Od3 h2, .Od3 h4, .Od3 ul, .Od3 li, .Od3 p { - font-style: normal; - margin: 0; - padding: 0; - border: none; - font-size: 100%; - line-height: 110%; -} - -.Od3 ul { - list-style-type: none -} - -.Od3 li { - list-style: none -} - -.Od3 em { - font-style: italic; - /*font-family: Lora, ODESerif, serif;*/ -} - -.Od3 a { - color: inherit; - text-decoration: none; - border-bottom: 1px dotted; -} - -.dwy a { - border-bottom: none; -} - -/*.Od3 .xv4 a{color:#003fd2;text-decoration:none}*/ - -.Od3 a:hover { - text-decoration: none; - color: #6DBAEE -} - -.k0i+.k0i { - margin-top: 40px; -} - -.b6i h4 { - margin-bottom: 1em -} - -.h1s { - border-top: 1px solid #00bdf2; - border-bottom: 1px solid #00bdf2; - padding: 10px 0; - line-height: 150%; - position: relative; -} - -h2.z2h, h2.hxy, .b6i h4 { - display: inline-block; - font-size: 1.5em; - color: #1681c2; - font-weight: bold; - margin: 0; -} - -h1s:first-child h2.hxy, h1s:first-child h2.z2h { - margin-top: 0; -} - -.tfr:before { - content: "|" -} - -.nah:before { - content: "\0A6" -} - -.sih:before { - content: "\0B7" -} - -.f0t .ysl { - display: inline-block -} - -.f0t .pxt { - font-size: 90% -} - -.f0t .b6i h4 { - font-size: 100%; - color: black; - margin-bottom: 0 -} - -.f0t .b6i:before { - content: "-"; - color: black; - padding-right: 2px; - position: absolute; - left: -1em -} - -.f0t .b6i { - position: relative; - margin-left: 1em -} - -.f0t .b6i h4:after { - content: ","; - color: black; - font-weight: normal; - font-size: 90% -} - -h2.z2h span, h2.hxy span { - font-weight: normal; - font-size: 95% -} - -.pxt, .p2h { - font-family: Gentium Plus, SansPhon, noto sans, arial, sans-serif; - color: black; - white-space: nowrap -} - -.a8e { - cursor: pointer; - height: 1em; - vertical-align: middle; - position: relative; -} - -h2.z2h .lx6, h2.hxy .lx6 { - font-size: 50%; - font-weight: normal; - position: relative; - vertical-align: super; - padding-left: 2px -} - -.k0z+.k0z { - margin-top: 0.6em -} - -h2.nvt { - display: inline-block; - font-weight: normal -} - -.xno { - display: inline-block; - color: #f15a24; - font-style: italic; -} - -.nvt .xno { - text-transform: uppercase; - font-style: normal; - font-weight: bold; -} - -.cw6, .mbw a { - font-weight: bold -} - -.nvt { - display: block; - margin: 10px 0 5px 0; -} - -.xno+.pzg { - padding-left: 0.3em -} - -.pzg { - color: #333; -} - -.rlx { - font-style: normal; - font-size: 100%; - /* font-weight: bold; */ -} - -.iko { - color: black; - font-size: 100%; - font-weight: bold; -} - -em.tb0 { - font-style: normal; - color: #4b7aad; - font-weight: bold; - font-style: italic; - /* font-family: Gentium Plus, SansPhon, Lora, ODESerif, serif; */ -} - -.u2n, .Od3 .se2 .u2n { - margin: 0.2em 0 0 1em; - position: relative -} - -.Od3 .se2 { - margin: 0 0 1em 0; -} - -.ewq { - margin: 0.5em 0 0 1em; - position: relative; - padding-left: 1.5em; -} - -.ulk {} - - - -.ld9 {} - -.eh8 {} - -.p9h {} - -.dwy {} - -.ld9+.aw5, .pzw+.aw5 { - display: block; -} - -em.xv4, li.lmn, .uxu em { - font-style: italic; - color: black; - font-family: Lora, ODESerif, serif; -} - -em.xv4, uxu em {} - -li.lmn+li.lmn { - font-size: 102%; - rder-top: 1px solid black; -} - -em.xv4 b, .uxu em b { - /*font-size:100%*/ -} - -.eh8 em.xv4::before, .eh8 em.xv4::after { - content: "'"; - font-size: 1rem; -} - -.sdh { - display: inline-block; - cursor: pointer; -} - -.sdh::before { - content: "SYNONYMS"; - font-weight: bold; - background: lightblue; - color: white; -} - -.sdh[show]::before { - content: "SYNONYMS"; -} - -.x3z { - display: inline-block; - margin-right: 0.5em; - cursor: pointer; -} - -.xxn+.x3z::before { - content: "+ examples"; -} - -.x3z::before { - content: "+ examples"; -} - -.x3z::before::before { - content: ""; - display: block; -} - -.x3z+.ld9, .x3z+ul.rpz, .sdh+.pzw { - display: none; -} - -.xxn+.x3z[show]::before { - content: "+ examples"; -} - -.x3z[show]::before { - content: "+ examples"; -} - -.x3z[show]+.ld9, .x3z[show]+ul.rpz, .sdh[show]+.pzw { - display: block; -} - -.x3z::before, .sdh::before { - display: inline-block; - padding: 0 0.5em; - border: 1px solid #2196F3; - border-radius: 99em; - /* text-decoration-line: underline; */ - /* background: #ffc10775; */ - /* color: #f15a24; */ - font-size: 85%; - font-style: italic; - /* font-weight: bold; */ - /* font-style: italic; */ -} - -.x3z[show]::before, .sdh[show]::before { - color: white; - background: #00bdf2; - border: #666; - /* content: "SYNONYMS"; */ - /* content: "+ examples"; */ -} - -.xxn, li.lmn { - /* display: block; */ - position: relative; - padding: 0.2em 0 0.2em 1em; - font-size: 102%; -} - -.xxn:before, .lmn:before { - content: "•"; - display: inline-block; - width: 1em; - margin-left: -1em; - text-align: center; - color: #888; - font-family: Open Sans, ODESans, sans-serif; -} - -.pzw { - padding-left: 1em; - /* margin-left: 0.3em; */ - font-size: 100%; - text-indent: -1em; - /* line-height: 115%; */ - font-style: italic; - /* border-left: 3px solid #dbdee2; */ -} - -ul.dhk, ul.rpz, .pzw { - display: block; - /*border-left: 3px solid #DDD;*/ -} - -.rnr, em.u0f, .cvq, .ix9, .m7g em { - font-style: normal; - color: #27a058; - font-size: 100%; - font-weight: bold; - font-style: italic; - font-family: Lora, ODESerif, serif; -} - -.rnr { - color: #e3533a; -} - -/*.pzg .rnr, .pzg em.u0f, .pzg .cvq{font-size:90%}*/ - -.vkq { - display: inline-block; - color: black; - min-width: 1em; - text-align: right; - margin-left: -1.5em; - margin-right: 0.5em; - font-size: 0.95em; -} - -.ewq .vkq { - font-size: 0.8em; - min-width: 1.2em; - text-align: left; - display: inline-block; - margin-right: 0.3em; - margin-left: -2em; - font-family: Open Sans Condensed Light, ODECondensed, sans-serif -} - -.qbl { - color: black; - font-size: 100% -} - -.b9e { - /*color:#930;*/ -} - -.b9e:after { - content: "." -} - -div.uxu div.ysl p b.b9e~b.b9e::before { - content: ""; - display: block; - height: 0.5em; -} - -.e8l .q5j, .pdj { - color: black; - font-weight: bold; -} - -.s0c, .f0t, .m7g, .uxu, .e8l { - margin-top: 0.5em; - clear: both -} - -.tki { - font-weight: bold; - color: #6DBAEE; - font-size: 1.1em; -} - -.s0c h2, .f0t h2, .m7g h2, .uxu h2, .e8l h2 { - border-top: 1px solid #00bdf2; - margin-bottom: .3em; - margin-top: 1em; -} - -.sgx { - font-variant: small-caps; - font-size: 100% -} - -.s0c p:before, .n3h:before, .mbw:before { - content: "\021E8\020" -} - -.rqo { - color: black; - font-size: 90%; - font-weight: normal -} - -h2.z2h .l6p, h2.hxy .l6p, h4 .l6p, .rqo .l6p { - color: black; - font-size: 110%; - font-weight: bold -} - -.f0t .l6p { - color: black -} - -.n3h, .mbw { - display: block; - padding-top: 0.8em -} - -.aej, .yuq { - float: right; - width: 13px; - height: 6px; - cursor: pointer; - position: relative; - top: 1px; - padding: .3em .1em .3em .3em -} - -.yuq { - transform: scaleY(-1); - -webkit-transform: scaleY(-1); - filter: FlipV -} - -.dzg, .ynx, .eju, ul.s6x, .e8l .dhk { - color: #555; - border-left: 3px solid #00bdf2; - margin: 0.5em 0 0.3em; - padding-left: .5em -} - -.dzg, .ynx { - display: block; - margin-left: 1em -} - -.e8l .dhk { - display: block -} - -.j02, .g4p { - margin: 0 1ex 1ex 1ex; - position: relative; - z-index: 999; - float: right; - clear: right; -} - -.j02 { - width: 40%!important; - height: auto; -} - -.g4p { - width: 99%; - height: auto; -} - -.Od3 img[onclick] { - cursor: pointer -} - -.s0c p:before { - content: "•"; - color: #555; - font-family: Lora, ODESerif, serif; - margin-right: 0.5em; -} - -.s0c p { - display: block; - position: relative; - margin-left: 0.2em; -} - -.mla { - clear: both -} - -.h1s .pxt { - position: relative; - z-index: 2; - display: inline-block; -} - -.h1s .pxt::before { - content: ''; - height: 1.5rem; - display: inline-block; -} - -.cn_def { - /* font-family: Open Sans, ODESans, sans-serif; */ - font-size: 90%; - display: block; - padding: 0 0 0 .5em; - /* font-weight: bold; */ -} -.aw5+.cn_def { - display: inline; -} -p.cn { - /* font-style: italic; */ - color: #888; - font-style: normal; - font-size: 70%; - display: inline; - position: relative; - padding: 0 0 0 0.5em; -} -.pxt a{ -border-bottom: none; -} -` - -const oald9css = `@font-face{font-family:'oalecd9';src:url("oalecd9.ttf");font-weight:400;font-style:normal} -body{background-color:#fffefe;font-family:'oalecd9';counter-reset:sn_blk_counter} -.cixing_part{counter-reset:sn_blk_counter} -.cixing_tiaozhuan_part{display:inline;color:#c70000} -.cixing_tiaozhuan_part a:link{text-decoration:none;font-weight:600} -.cixing_tiaozhuan_part a{color:#c70000} -h{font-weight:600;color:#323270;font-size:22px} -boxtag{font-size:13px;font-weight:600;border-style:solid;color:#fff;background-color:blue;border-color:blue;border-width:1px;margin-top:2px;padding-left:2px;padding-right:2px;border-radius:10px} -boxtag[type="awl"]{font-size:9px;font-weight:600;color:#fff;border-style:solid;border-width:1px;background-color:#000;border-color:#000;padding-left:1px;padding-right:1px;border-top:0;border-bottom:0} -vp-gs{display:none} -pron-g-blk{display:inline} -top-g{display:block} -pron-g-blk brelabel{padding-left:4px;font-size:14px} -pron-g-blk namelabel{padding-left:4px;font-size:14px} -pos xhtml\:a{display:table;color:#fff;font-weight:600;padding-left:2px;padding-right:2px;border-style:solid;border-width:1px;border-radius:5px;border-top:0;border-bottom:0;border-color:#c70000;background-color:#c70000} -vpform{color:#9b9b9b;font-style:italic} -vp-g{display:block;padding-left:12px} -sn-blk{display:block} -:not(idm-g) sn-gs sn-blk::before{padding-right:4px;counter-increment:sn_blk_counter;content:counter(sn_blk_counter)} -:not(id-g) sn-gs sn-blk::before{padding-right:4px;counter-increment:sn_blk_counter;content:counter(sn_blk_counter)} -def{font-weight:600} -xsymb{display:none} -xhtml\:br{} -x-g-blk{display:block;border-left:3px solid #dbdbdb;margin-left:8px;padding-left:10px} -x-g-blk x::before{content:'•'} -x-g-blk x{font-style:italic;color:#3784dd} -x-g-blk x chn{padding-left:13px;font-style:normal;color:#8d8d8d} -top-g xhtml\:br{display:none} -cf-blk{font-style:italic;font-weight:600;color:#2b7dca;padding-right:4px} -xr-gs{display:block} -xr-g-blk a:link{text-decoration:none;color:#a52a2a;font-weight:600} -def+x-gs cf-blk{font-style:italic;font-weight:600;color:#2b7dca;display:block} -shcut-blk{margin-top:14px;display:block;border-bottom:1px solid #a0a0a0;padding-bottom:5px} -gram-g{font-weight:600;color:#04b92b} -unbox{margin-top:16px;margin-bottom:16px;display:block;padding-left:5px;padding-right:15px;padding-top:10px;border:1px solid red;border-radius:12px} -unbox title{display:none} -unbox inlinelist{display:inline} -unbox inlinelist und{font-weight:600;color:#03648a} -unbox unsyn{display:block;font-weight:600;color:#1a4781} -unbox x-g-blk{display:block} -unbox x-g-blk x::before{content:'•';padding-right:6px} -unbox h3{color:#36866a;margin-bottom:4px;margin-top:6px} -unbox eb{font-weight:600} -pron-g-blk a:link{text-decoration:none} -audio-gbs-liju,audio-gb-liju,audio-brs-liju,audio-gb{padding-right:4px;color:blue;opacity:.8;display:none} -audio-uss-liju,audio-ams-liju,audio-us-liju,audio-us{padding-right:4px;color:#af0404;opacity:.8;display:none} -a:link{text-decoration:none} -eb{font-weight:600} -idm-gs un{display:block;color:#7c7070} -idm-blk idm{padding-top:12px;display:block;font-weight:600;color:#010102} -idm-g def{font-weight:500} -idm-g sn-blk::before{color:#6f49c7;content:'★'} -pv-g def{font-weight:500} -label-g-blk{color:#797979;font-style:italic} -pv-blk pv{padding-top:12px;display:block;font-weight:600;color:#1881e4} -unbox ul li{list-style-type:square} -unbox x-gs{display:block;margin-left:8px;padding-left:10px} -unbox x-gs chn{} -img{display:block;max-width:100%} -.big_pic{display:none;max-width:100%} -.switch_ec{display:none} -if-gs-blk{display:inline} -if-gs-blk form{display:inline} -unbox[type=wordfinder] xr-gs{display:inline} -unbox[type=wordfinder]::before{border:1px solid;border-radius:6px;position:relative;top:-24px;font-size:18px;color:#af1919;font-weight:600;content:'WordFinder';background-color:#fff;padding:5px 7px} -unbox[type=colloc]::before{border:1px solid;border-radius:6px;position:relative;top:-24px;left:18px;font-size:18px;color:#af1919;font-weight:600;content:'Collocations 词语搭配';background-color:#fff;padding:5px 7px} -unbox[type=wordfamily]{display:block;float:right} -unbox[type=wordfamily] wfw-g{display:block} -unbox[type=wordfamily] wfw-g wfw-blk{color:#101095;font-weight:600} -unbox[type=wordfamily] wfw-g wfo{font-weight:600} -unbox[type=wordfamily] wfw-g wfp-blk wfp{font-style:italic;color:#971717;font-weight:500} -unbox[type=wordfamily]::before{border:1px solid;border-radius:6px;position:relative;top:-24px;left:18px;font-size:18px;color:#af1919;font-weight:600;content:'WORD FAMILY';background-color:#fff;padding:5px 7px} -unbox[type=grammar]::before{border:1px solid;border-radius:6px;position:relative;top:-24px;left:18px;font-size:18px;color:#af1919;font-weight:600;content:'GRAMMAR 语法';background-color:#fff;padding:5px 7px} -unbox[type=grammar]{margin-top:36px} -unbox[type=grammar] x-gs{padding-left:0;margin-left:0} -unbox ul{margin-top:4px} -use-blk{color:#0b8a0b} -dis-g xr-gs{display:inline} -xr-gs[firstinblock="n"]{display:inline} -` - func ParseAddr(listen string) (network string, address string) { // Allow passing just -remote=auto, as a shorthand for using automatic remote // resolution. diff --git a/static/Longman Dictionary of Contemporary English.css b/static/Longman Dictionary of Contemporary English.css new file mode 100644 index 0000000..e69de29 diff --git a/static/ODE_zh.css b/static/ODE_zh.css new file mode 100644 index 0000000..d84b72e --- /dev/null +++ b/static/ODE_zh.css @@ -0,0 +1,642 @@ +@font-face { + font-family: "ODECondensed"; + src: url("fonts/opensanscondensed-light.ttf"); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "ODESans"; + src: url("fonts/opensans-regular.ttf"); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "ODESans"; + src: url("fonts/opensans-bold.ttf"); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: "ODESans"; + src: url("fonts/opensans-italic.ttf"); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: "ODESans"; + src: url("fonts/opensans-bolditalic.ttf"); + font-weight: bold; + font-style: italic; +} + +@font-face { + font-family: "ODESerif"; + src: url("fonts/lora-regular.ttf"); + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: "ODESerif"; + src: url("fonts/lora-bold.ttf"); + font-weight: bold; + font-style: normal; +} + +@font-face { + font-family: "ODESerif"; + src: url("fonts/lora-italic.ttf"); + font-weight: normal; + font-style: italic; +} + +@font-face { + font-family: "ODESerif"; + src: url("fonts/lora-bolditalic.ttf"); + font-weight: bold; + font-style: italic; +} + +@font-face { + font-family: SansPhon; + src: url('fonts/gentiumplus-r.ttf') format('truetype'); +} + +.Od3 { + /* font-family: Open Sans, ODESans, sans-serif; */ + font-size: 117%; + line-height: 112%; + /* color: azure; */ + /* font-weight: bold; */ +} + +.Od3 h2, .Od3 h4, .Od3 ul, .Od3 li, .Od3 p { + font-style: normal; + margin: 0; + padding: 0; + border: none; + font-size: 100%; + line-height: 110%; +} + +.Od3 ul { + list-style-type: none +} + +.Od3 li { + list-style: none +} + +.Od3 em { + font-style: italic; + /*font-family: Lora, ODESerif, serif;*/ +} + +.Od3 a { + color: inherit; + text-decoration: none; + border-bottom: 1px dotted; +} + +.dwy a { + border-bottom: none; +} + +/*.Od3 .xv4 a{color:#003fd2;text-decoration:none}*/ + +.Od3 a:hover { + text-decoration: none; + color: #6DBAEE +} + +.k0i+.k0i { + margin-top: 40px; +} + +.b6i h4 { + margin-bottom: 1em +} + +.h1s { + border-top: 1px solid #00bdf2; + border-bottom: 1px solid #00bdf2; + padding: 10px 0; + line-height: 150%; + position: relative; +} + +h2.z2h, h2.hxy, .b6i h4 { + display: inline-block; + font-size: 1.5em; + color: #1681c2; + font-weight: bold; + margin: 0; +} + +h1s:first-child h2.hxy, h1s:first-child h2.z2h { + margin-top: 0; +} + +.tfr:before { + content: "|" +} + +.nah:before { + content: "\0A6" +} + +.sih:before { + content: "\0B7" +} + +.f0t .ysl { + display: inline-block +} + +.f0t .pxt { + font-size: 90% +} + +.f0t .b6i h4 { + font-size: 100%; + color: black; + margin-bottom: 0 +} + +.f0t .b6i:before { + content: "-"; + color: black; + padding-right: 2px; + position: absolute; + left: -1em +} + +.f0t .b6i { + position: relative; + margin-left: 1em +} + +.f0t .b6i h4:after { + content: ","; + color: black; + font-weight: normal; + font-size: 90% +} + +h2.z2h span, h2.hxy span { + font-weight: normal; + font-size: 95% +} + +.pxt, .p2h { + font-family: Gentium Plus, SansPhon, noto sans, arial, sans-serif; + color: black; + white-space: nowrap +} + +.a8e { + cursor: pointer; + height: 1em; + vertical-align: middle; + position: relative; +} + +h2.z2h .lx6, h2.hxy .lx6 { + font-size: 50%; + font-weight: normal; + position: relative; + vertical-align: super; + padding-left: 2px +} + +.k0z+.k0z { + margin-top: 0.6em +} + +h2.nvt { + display: inline-block; + font-weight: normal +} + +.xno { + display: inline-block; + color: #f15a24; + font-style: italic; +} + +.nvt .xno { + text-transform: uppercase; + font-style: normal; + font-weight: bold; +} + +.cw6, .mbw a { + font-weight: bold +} + +.nvt { + display: block; + margin: 10px 0 5px 0; +} + +.xno+.pzg { + padding-left: 0.3em +} + +.pzg { + color: #333; +} + +.rlx { + font-style: normal; + font-size: 100%; + /* font-weight: bold; */ +} + +.iko { + color: black; + font-size: 100%; + font-weight: bold; +} + +em.tb0 { + font-style: normal; + color: #4b7aad; + font-weight: bold; + font-style: italic; + /* font-family: Gentium Plus, SansPhon, Lora, ODESerif, serif; */ +} + +.u2n, .Od3 .se2 .u2n { + margin: 0.2em 0 0 1em; + position: relative +} + +.Od3 .se2 { + margin: 0 0 1em 0; +} + +.ewq { + margin: 0.5em 0 0 1em; + position: relative; + padding-left: 1.5em; +} + +.ulk {} + + + +.ld9 {} + +.eh8 {} + +.p9h {} + +.dwy {} + +.ld9+.aw5, .pzw+.aw5 { + display: block; +} + +em.xv4, li.lmn, .uxu em { + font-style: italic; + color: black; + font-family: Lora, ODESerif, serif; +} + +em.xv4, uxu em {} + +li.lmn+li.lmn { + font-size: 102%; + rder-top: 1px solid black; +} + +em.xv4 b, .uxu em b { + /*font-size:100%*/ +} + +.eh8 em.xv4::before, .eh8 em.xv4::after { + content: "'"; + font-size: 1rem; +} + +.sdh { + display: inline-block; + cursor: pointer; +} + +.sdh::before { + content: "SYNONYMS"; + font-weight: bold; + background: lightblue; + color: white; +} + +.sdh[show]::before { + content: "SYNONYMS"; +} + +.x3z { + display: inline-block; + margin-right: 0.5em; + cursor: pointer; +} + +.xxn+.x3z::before { + content: "+ examples"; +} + +.x3z::before { + content: "+ examples"; +} + +.x3z::before::before { + content: ""; + display: block; +} + +.x3z+.ld9, .x3z+ul.rpz, .sdh+.pzw { + display: none; +} + +.xxn+.x3z[show]::before { + content: "+ examples"; +} + +.x3z[show]::before { + content: "+ examples"; +} + +.x3z[show]+.ld9, .x3z[show]+ul.rpz, .sdh[show]+.pzw { + display: block; +} + +.x3z::before, .sdh::before { + display: inline-block; + padding: 0 0.5em; + border: 1px solid #2196F3; + border-radius: 99em; + /* text-decoration-line: underline; */ + /* background: #ffc10775; */ + /* color: #f15a24; */ + font-size: 85%; + font-style: italic; + /* font-weight: bold; */ + /* font-style: italic; */ +} + +.x3z[show]::before, .sdh[show]::before { + color: white; + background: #00bdf2; + border: #666; + /* content: "SYNONYMS"; */ + /* content: "+ examples"; */ +} + +.xxn, li.lmn { + /* display: block; */ + position: relative; + padding: 0.2em 0 0.2em 1em; + font-size: 102%; +} + +.xxn:before, .lmn:before { + content: "•"; + display: inline-block; + width: 1em; + margin-left: -1em; + text-align: center; + color: #888; + font-family: Open Sans, ODESans, sans-serif; +} + +.pzw { + padding-left: 1em; + /* margin-left: 0.3em; */ + font-size: 100%; + text-indent: -1em; + /* line-height: 115%; */ + font-style: italic; + /* border-left: 3px solid #dbdee2; */ +} + +ul.dhk, ul.rpz, .pzw { + display: block; + /*border-left: 3px solid #DDD;*/ +} + +.rnr, em.u0f, .cvq, .ix9, .m7g em { + font-style: normal; + color: #27a058; + font-size: 100%; + font-weight: bold; + font-style: italic; + font-family: Lora, ODESerif, serif; +} + +.rnr { + color: #e3533a; +} + +/*.pzg .rnr, .pzg em.u0f, .pzg .cvq{font-size:90%}*/ + +.vkq { + display: inline-block; + color: black; + min-width: 1em; + text-align: right; + margin-left: -1.5em; + margin-right: 0.5em; + font-size: 0.95em; +} + +.ewq .vkq { + font-size: 0.8em; + min-width: 1.2em; + text-align: left; + display: inline-block; + margin-right: 0.3em; + margin-left: -2em; + font-family: Open Sans Condensed Light, ODECondensed, sans-serif +} + +.qbl { + color: black; + font-size: 100% +} + +.b9e { + /*color:#930;*/ +} + +.b9e:after { + content: "." +} + +div.uxu div.ysl p b.b9e~b.b9e::before { + content: ""; + display: block; + height: 0.5em; +} + +.e8l .q5j, .pdj { + color: black; + font-weight: bold; +} + +.s0c, .f0t, .m7g, .uxu, .e8l { + margin-top: 0.5em; + clear: both +} + +.tki { + font-weight: bold; + color: #6DBAEE; + font-size: 1.1em; +} + +.s0c h2, .f0t h2, .m7g h2, .uxu h2, .e8l h2 { + border-top: 1px solid #00bdf2; + margin-bottom: .3em; + margin-top: 1em; +} + +.sgx { + font-variant: small-caps; + font-size: 100% +} + +.s0c p:before, .n3h:before, .mbw:before { + content: "\021E8\020" +} + +.rqo { + color: black; + font-size: 90%; + font-weight: normal +} + +h2.z2h .l6p, h2.hxy .l6p, h4 .l6p, .rqo .l6p { + color: black; + font-size: 110%; + font-weight: bold +} + +.f0t .l6p { + color: black +} + +.n3h, .mbw { + display: block; + padding-top: 0.8em +} + +.aej, .yuq { + float: right; + width: 13px; + height: 6px; + cursor: pointer; + position: relative; + top: 1px; + padding: .3em .1em .3em .3em +} + +.yuq { + transform: scaleY(-1); + -webkit-transform: scaleY(-1); + filter: FlipV +} + +.dzg, .ynx, .eju, ul.s6x, .e8l .dhk { + color: #555; + border-left: 3px solid #00bdf2; + margin: 0.5em 0 0.3em; + padding-left: .5em +} + +.dzg, .ynx { + display: block; + margin-left: 1em +} + +.e8l .dhk { + display: block +} + +.j02, .g4p { + margin: 0 1ex 1ex 1ex; + position: relative; + z-index: 999; + float: right; + clear: right; +} + +.j02 { + width: 40%!important; + height: auto; +} + +.g4p { + width: 99%; + height: auto; +} + +.Od3 img[onclick] { + cursor: pointer +} + +.s0c p:before { + content: "•"; + color: #555; + font-family: Lora, ODESerif, serif; + margin-right: 0.5em; +} + +.s0c p { + display: block; + position: relative; + margin-left: 0.2em; +} + +.mla { + clear: both +} + +.h1s .pxt { + position: relative; + z-index: 2; + display: inline-block; +} + +.h1s .pxt::before { + content: ''; + height: 1.5rem; + display: inline-block; +} + +.cn_def { + /* font-family: Open Sans, ODESans, sans-serif; */ + font-size: 90%; + display: block; + padding: 0 0 0 .5em; + /* font-weight: bold; */ +} +.aw5+.cn_def { + display: inline; +} +p.cn { + /* font-style: italic; */ + color: #888; + font-style: normal; + font-size: 70%; + display: inline; + position: relative; + padding: 0 0 0 0.5em; +} +.pxt a{ +border-bottom: none; +} \ No newline at end of file diff --git a/static/oald9.css b/static/oald9.css new file mode 100644 index 0000000..cf3dd14 --- /dev/null +++ b/static/oald9.css @@ -0,0 +1,79 @@ +@font-face{font-family:'oalecd9';src:url("oalecd9.ttf");font-weight:400;font-style:normal} +body{background-color:#fffefe;font-family:'oalecd9';counter-reset:sn_blk_counter} +.cixing_part{counter-reset:sn_blk_counter} +.cixing_tiaozhuan_part{display:inline;color:#c70000} +.cixing_tiaozhuan_part a:link{text-decoration:none;font-weight:600} +.cixing_tiaozhuan_part a{color:#c70000} +h{font-weight:600;color:#323270;font-size:22px} +boxtag{font-size:13px;font-weight:600;border-style:solid;color:#fff;background-color:blue;border-color:blue;border-width:1px;margin-top:2px;padding-left:2px;padding-right:2px;border-radius:10px} +boxtag[type="awl"]{font-size:9px;font-weight:600;color:#fff;border-style:solid;border-width:1px;background-color:#000;border-color:#000;padding-left:1px;padding-right:1px;border-top:0;border-bottom:0} +vp-gs{display:none} +pron-g-blk{display:inline} +top-g{display:block} +pron-g-blk brelabel{padding-left:4px;font-size:14px} +pron-g-blk namelabel{padding-left:4px;font-size:14px} +pos xhtml\:a{display:table;color:#fff;font-weight:600;padding-left:2px;padding-right:2px;border-style:solid;border-width:1px;border-radius:5px;border-top:0;border-bottom:0;border-color:#c70000;background-color:#c70000} +vpform{color:#9b9b9b;font-style:italic} +vp-g{display:block;padding-left:12px} +sn-blk{display:block} +:not(idm-g) sn-gs sn-blk::before{padding-right:4px;counter-increment:sn_blk_counter;content:counter(sn_blk_counter)} +:not(id-g) sn-gs sn-blk::before{padding-right:4px;counter-increment:sn_blk_counter;content:counter(sn_blk_counter)} +def{font-weight:600} +xsymb{display:none} +xhtml\:br{} +x-g-blk{display:block;border-left:3px solid #dbdbdb;margin-left:8px;padding-left:10px} +x-g-blk x::before{content:'•'} +x-g-blk x{font-style:italic;color:#3784dd} +x-g-blk x chn{padding-left:13px;font-style:normal;color:#8d8d8d} +top-g xhtml\:br{display:none} +cf-blk{font-style:italic;font-weight:600;color:#2b7dca;padding-right:4px} +xr-gs{display:block} +xr-g-blk a:link{text-decoration:none;color:#a52a2a;font-weight:600} +def+x-gs cf-blk{font-style:italic;font-weight:600;color:#2b7dca;display:block} +shcut-blk{margin-top:14px;display:block;border-bottom:1px solid #a0a0a0;padding-bottom:5px} +gram-g{font-weight:600;color:#04b92b} +unbox{margin-top:16px;margin-bottom:16px;display:block;padding-left:5px;padding-right:15px;padding-top:10px;border:1px solid red;border-radius:12px} +unbox title{display:none} +unbox inlinelist{display:inline} +unbox inlinelist und{font-weight:600;color:#03648a} +unbox unsyn{display:block;font-weight:600;color:#1a4781} +unbox x-g-blk{display:block} +unbox x-g-blk x::before{content:'•';padding-right:6px} +unbox h3{color:#36866a;margin-bottom:4px;margin-top:6px} +unbox eb{font-weight:600} +pron-g-blk a:link{text-decoration:none} +audio-gbs-liju,audio-gb-liju,audio-brs-liju,audio-gb{padding-right:4px;color:blue;opacity:.8;display:none} +audio-uss-liju,audio-ams-liju,audio-us-liju,audio-us{padding-right:4px;color:#af0404;opacity:.8;display:none} +a:link{text-decoration:none} +eb{font-weight:600} +idm-gs un{display:block;color:#7c7070} +idm-blk idm{padding-top:12px;display:block;font-weight:600;color:#010102} +idm-g def{font-weight:500} +idm-g sn-blk::before{color:#6f49c7;content:'★'} +pv-g def{font-weight:500} +label-g-blk{color:#797979;font-style:italic} +pv-blk pv{padding-top:12px;display:block;font-weight:600;color:#1881e4} +unbox ul li{list-style-type:square} +unbox x-gs{display:block;margin-left:8px;padding-left:10px} +unbox x-gs chn{} +img{display:block;max-width:100%} +.big_pic{display:none;max-width:100%} +.switch_ec{display:none} +if-gs-blk{display:inline} +if-gs-blk form{display:inline} +unbox[type=wordfinder] xr-gs{display:inline} +unbox[type=wordfinder]::before{border:1px solid;border-radius:6px;position:relative;top:-24px;font-size:18px;color:#af1919;font-weight:600;content:'WordFinder';background-color:#fff;padding:5px 7px} +unbox[type=colloc]::before{border:1px solid;border-radius:6px;position:relative;top:-24px;left:18px;font-size:18px;color:#af1919;font-weight:600;content:'Collocations 词语搭配';background-color:#fff;padding:5px 7px} +unbox[type=wordfamily]{display:block;float:right} +unbox[type=wordfamily] wfw-g{display:block} +unbox[type=wordfamily] wfw-g wfw-blk{color:#101095;font-weight:600} +unbox[type=wordfamily] wfw-g wfo{font-weight:600} +unbox[type=wordfamily] wfw-g wfp-blk wfp{font-style:italic;color:#971717;font-weight:500} +unbox[type=wordfamily]::before{border:1px solid;border-radius:6px;position:relative;top:-24px;left:18px;font-size:18px;color:#af1919;font-weight:600;content:'WORD FAMILY';background-color:#fff;padding:5px 7px} +unbox[type=grammar]::before{border:1px solid;border-radius:6px;position:relative;top:-24px;left:18px;font-size:18px;color:#af1919;font-weight:600;content:'GRAMMAR 语法';background-color:#fff;padding:5px 7px} +unbox[type=grammar]{margin-top:36px} +unbox[type=grammar] x-gs{padding-left:0;margin-left:0} +unbox ul{margin-top:4px} +use-blk{color:#0b8a0b} +dis-g xr-gs{display:inline} +xr-gs[firstinblock="n"]{display:inline} diff --git a/testdata/doctor_ldoce.html b/testdata/doctor_ldoce.html new file mode 100644 index 0000000..45de5b9 --- /dev/null +++ b/testdata/doctor_ldoce.html @@ -0,0 +1,502 @@ + + + + + + + + + + + doctor | meaning of doctor in Longman Dictionary of Contemporary English | LDOCE + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ +
+
+ +
+
+
+
+
+
+ + +
+
+
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

doctor

From Longman Dictionary of Contemporary EnglishRelated topics: Nurses, doctors, etc, Collegedoctordoc‧tor1 /ˈdɒktə $ ˈdɑːktər/ ●●● S1 W1 noun [countable] +   +  1 MN (written abbreviation Dr) someone who is trained to treat people who are illGP +  She was treated by her local doctor. +  I’d like to make an appointment to see Dr Pugh.the doctor’s informal (=the place where your doctor works) +  ‘Where’s Sandy today?’ ‘I think she’s at the doctor’s.’2 SECsomeone who holds the highest level of degree given by a universitydoctoral +  a Doctor of Law3 be just what the doctor ordered COLLOCATIONSverbsgo to the doctorI’d been having bad headaches so I went to the doctor.see a doctor (also visit a doctor American English) (=go to the doctor)Have you seen a doctor about it yet?ask a doctor (also consult a doctor formal)If you have any of these symptoms, you should consult a doctor.call a doctor (=telephone one, especially to ask them to come to you)His mother was very worried and called the doctor.get a doctor (=arrange for one to come to you)In the middle of the night we decided to get the doctor.a doctor examines somebodyThe doctor examined her and said she had a chest infection.a doctor prescribes something (=writes an order for medicine for someone)My doctor prescribed a course of antibiotics.a doctor diagnoses flu/depression etc (=says what illness someone has)The doctor diagnosed malaria.ADJECTIVES/NOUN + doctora family doctor (=who treats all the members of a family)We’ve had the same family doctor for fifteen years.somebody’s local doctor (=working near where you live)You should go and see your local doctor.a hospital doctor British English (=working in a hospital)Junior hospital doctors have to work very long hours. + + + THESAURUSdoctor someone who treats people who are ill, who has completed a long course of study at medical schoolIf you have bad chest pains, you should see a doctor.GP British English a doctor who is trained in general medicine and who treats the people who live in a local areaMy GP told me that I must lose weight.physician /fəˈzɪʃən/ formal especially American English a doctorthe American physician, Dr James Tyler Kentquack informal someone who pretends to be a doctorMy father felt that people practicing alternative medicine were just a bunch of quacks. the medical profession doctors and nurses considered as a groupThis view is widely accepted among the medical profession.surgeon /ˈsɜːdʒən $ ˈsɜːr-/ a doctor who does operations in a hospitalOne of the world’s top heart surgeons performed the operation.specialist a doctor with special knowledge about a particular illness, part of the body, or type of treatmentThe new drug is being tested by cancer specialists.an eye specialistconsultant British English a very senior doctor in a hospital, with a lot of knowledge about a particular area of medicineThe consultant said that he did not think it was cancer.paramedic someone who has been trained to treat sick or injured people, especially at the scene of an accidentParamedics treated him for shock. vet (also veterinarian especially American English) a doctor who treats animalsWe took the cat to the vet.paediatrician British English, pediatrician American English a doctor who treats children who are sickgynaecologist British English, gynecologist American English a doctor who treats medical conditions and illnesses that affect women’s bodiesobstetrician a doctor who deals with the birth of childrenradiographer someone whose job is to take X-rays or to treat people using an X-ray machinea doctor who treats mental illnesspsychiatrist /saɪˈkaɪətrɪst $ sə-/ a doctor who is trained to treat people with mental illnessesIn order to become a psychiatrist, you first need a medical degree.psychologist /saɪˈkɒlədʒɪst $ -ˈkɑː-/ a scientist who studies and is trained in psychology (=the study of the mind)Many psychologists believe that aggression is a learned behaviour.shrink informal a humorous word for a psychiatristtherapist a trained person whose job is to help people with their emotional problems, especially by talking to them and asking them to talk about their feelingssomeone who is studying to be a doctormedical student a student who is studying medicine in order to be a doctorJames is a medical student at Edinburgh university.intern American English a student who has almost finished studying to be a doctor, and who is working in a hospital + + + Examples from the CorpusdoctorDoctor, I keep getting a pain in my throat.Tracy is interested in journalism, but Sarah wants to be a doctor.She looks very ill - you'd better call a doctor.One of the Peckhams' sons is a poet, another is an environmental consultant, and the third is a doctor.A partnership needs to be established between doctors and management with both controlling resources so that they are interdependent.The program has been hailed by doctors as a model for other developing countries, where few can afford expensive treatment.She further offended doctors by clinging to patently wrong ideas.This is a particularly cruel irony because as the 1911 census revealed doctors had the smallest families of all categories of occupations.I'd like to make an appointment to see Doctor Patel some time this morning."Where's Karen?" "She's at the doctor's."I went to see the doctor about my cough but she said there was nothing wrong with me.I made an appointment with Doctor Sangha for next Monday. Related topics: Hospitaldoctordoctor2 verb [transitive] +   +  1 TRICK/DECEIVEto dishonestly change something in order to gain an advantage +  He had doctored his passport to pass her off as his daughter. +  There are concerns that some players have been doctoring the ball. + + + 2 INJUREto add something harmful to food or drink +  Paul suspected that his drink had been doctored.3 MHHBAto remove part of the sex organs of an animal to prevent it from having babies SYN neuter +  You should have your cat doctored.4 to give someone medical treatment, especially when you are not a doctor +  Bill doctored the horses with a strong-smelling ointment. → See Verb tableExamples from the CorpusdoctorPhotographs can easily be doctored.Gina gently doctored Clint's injured hand.Their liquor has been nicely doctored - gave them an extra ration of ale to celebrate my arrival!Nancy likes to doctor her coffee with a shot of whisky.Two other writers were brought in to doctor the script before they finally returned to finish their task.From Longman Business Dictionarydoctordoc‧tor1 /ˈdɒktəˈdɑːktər/ noun [countable]1someone who is trained to treat sick or injured people company doctor2someone who has a DOCTORATE from a universitydoctordoctor2 verb [transitive] to change something, especially in order to deceive peoplePolice uncovered 43 cars for sale with doctored mileage readings.→ See Verb tableOrigin doctor1 (1300-1400) Old French doctour, from Latin doctor teacher, from docere to teach + + + +
+
+ +
+
+
+ + + +
+
+ Pictures of the day +
+
+ What are these? +
+ Image of mixer + Image of blender +
+ Click on the pictures to check. +
+
+ + +
+

Explore topics

+ + See all topics +
+ + + +
+
+ + + +
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/testdata/doctor_mdx.html b/testdata/doctor_mdx.html new file mode 100644 index 0000000..d5b6281 --- /dev/null +++ b/testdata/doctor_mdx.html @@ -0,0 +1,8 @@ +doctor +doctor
I
doctor1 S1 W1 /ˈdɒktə $ ˈdɑːktər/ noun [countable]
 Date: 1300-1400
 Language: Old French
 Origin: doctour, from Latin doctor 'teacher', from docere 'to teach'

1. (written abbreviation Dr) someone who is trained to treat people who are ill ⇨ GP:
    She was treated by her local doctor.
    I’d like to make an appointment to see Dr Pugh.
    the doctor’s informal (=the place where your doctor works)
    ‘Where’s Sandy today?’ ‘I think she’s at the doctor’s.’
2. someone who holds the highest level of degree given by a university ⇨ doctoral:
    a Doctor of Law
3. be just what the doctor ordered informal to be exactly what someone needs or wants:
    A 2–0 victory is just what the doctor ordered.
     
COLLOCATIONS
■ verbs
    go to the doctor I’d been having bad headaches so I went to the doctor.
    see a doctor (also visit a doctor American English) (=go to the doctor) Have you seen a doctor about it yet?
    ask a doctor (also consult a doctor formal) If you have any of these symptoms, you should consult a doctor.
    call a doctor (=telephone one, especially to ask them to come to you) His mother was very worried and called the doctor.
    get a doctor (=arrange for one to come to you) In the middle of the night we decided to get the doctor.
    a doctor examines somebody The doctor examined her and said she had a chest infection.
    a doctor prescribes something (=writes an order for medicine for someone) My doctor prescribed a course of antibiotics.
    a doctor diagnoses flu/depression etc (=says what illness someone has) The doctor diagnosed malaria.
■ ADJECTIVES/NOUN + doctor
    a family doctor (=who treats all the members of a family) We’ve had the same family doctor for fifteen years.
    sb’s local doctor (=working near where you live) You should go and see your local doctor.
    a hospital doctor British English (=working in a hospital) Junior hospital doctors have to work very long hours.
     
THESAURUS
    doctor someone who treats people who are ill, who has completed a long course of study at medical school: If you have bad chest pains, you should see a doctor.
    GP British English a doctor who is trained in general medicine and who treats the people who live in a local area: My GP told me that I must lose weight.
    physician /fəˈzɪʃən, fɪˈzɪʃən/ formal especially American English a doctor: the American physician, Dr James Tyler Kent
    quack informal someone who pretends to be a doctor: My father felt that people practicing alternative medicine were just a bunch of quacks.
    the medical profession doctors and nurses considered as a group: This view is widely accepted among the medical profession.
    surgeon /ˈsɜːdʒən $ ˈsɜːr-/ a doctor who does operations in a hospital: One of the world’s top heart surgeons performed the operation.
    specialist a doctor with special knowledge about a particular illness, part of the body, or type of treatment: The new drug is being tested by cancer specialists. | an eye specialist
    consultant British English a very senior doctor in a hospital, with a lot of knowledge about a particular area of medicine: The consultant said that he did not think it was cancer.
    paramedic someone who has been trained to treat sick or injured people, especially at the scene of an accident: Paramedics treated him for shock.
    vet (also veterinarian especially American English) a doctor who treats animals: We took the cat to the vet.
    paediatrician British English, pediatrician American English a doctor who treats children who are sick
    gynaecologist British English, gynecologist American English a doctor who treats medical conditions and illnesses that affect women’s bodies
    obstetrician a doctor who deals with the birth of children
    radiographer someone whose job is to take X-rays or to treat people using an X-ray machine
■ a doctor who treats mental illness
    psychiatrist /saɪˈkaɪətrəst, saɪˈkaɪətrɪst $ sə-/ a doctor who is trained to treat people with mental illnesses: In order to become a psychiatrist, you first need a medical degree.
    psychologist /saɪˈkɒlədʒəst, saɪˈkɒlədʒɪst $ -ˈkɑː-/ a scientist who studies and is trained in psychology (=the study of the mind): Many psychologists believe that aggression is a learned behaviour.
    shrink informal a humorous word for a psychiatrist
    therapist a trained person whose job is to help people with their emotional problems, especially by talking to them and asking them to talk about their feelings
■ someone who is studying to be a doctor
    medical student a student who is studying medicine in order to be a doctor: James is a medical student at Edinburgh university.
    intern American English a student who has almost finished studying to be a doctor, and who is working in a hospital

II
doctor2 verb [transitive]
1. to dishonestly change something in order to gain an advantage:
    He had doctored his passport to pass her off as his daughter.
    There are concerns that some players have been doctoring the ball.
2. to add something harmful to food or drink:
    Paul suspected that his drink had been doctored.
3. to remove part of the sex organs of an animal to prevent it from having babies
   SYN  neuter:
    You should have your cat doctored.
4. to give someone medical treatment, especially when you are not a doctor:
    Bill doctored the horses with a strong-smelling ointment. + + + + + + diff --git a/testdata/ldoce5.html b/testdata/ldoce5.html new file mode 100644 index 0000000..d4a4227 --- /dev/null +++ b/testdata/ldoce5.html @@ -0,0 +1,14 @@ +shitxx +000
000 number
the telephone number you use in Australia to call the police, the fire service, or an ambulance when there is an emergency + + + + + +shityy +1
1
used in text messages instead of 'one', for example SUM1 (= someone) + + + + + diff --git a/testdata/test.html b/testdata/test.html new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/testdata/test.html @@ -0,0 +1 @@ +test diff --git a/todo.md b/todo.md index 660416b..5e59495 100644 --- a/todo.md +++ b/todo.md @@ -10,16 +10,20 @@ - [x] Kill the server with a timeout. - [x] Format: basic indents and blank lines, make display more compact. - [x] Offline support? Not going to do that recently... I just use it myself. -- [ ] Dictionary locations? +- [x] Dictionary locations? -> \$XDG_CONFIG_HOME/ondict aka "~/.config/ondict" - [x] Serve on a TCP connection and can query from a "real" remote server, rather than local UDS. - [x] Serve the "offline mode" on a website, for better display, html format, single static pages (mime things)? - [x] nested queries (the windows are overlapped now) - [ ] A system for reviewing, e.g. simple ANKI? - [ ] Online mode: more information such as collocations/corpus/..... - [ ] A guessing/fallback algorithm for words missing (especially for offline dicts) -- [ ] Add an en-cn online/offline dictionary for quick enquiry. +- [x] Add an en-cn online/offline dictionary for quick enquiry -> oald9. +- [x] Bind an MDX with a potential CSS file for html mode, for display effects. +- [ ] Support multiple mdx libs at the same time and provide a . +- [ ] Appropriate module abstraction, and unit testing automation. --- +The following are less important things that I want to finish. - [ ] A more decent web page. - [ ] Other online dict parsing engines if I have the motivation? - [ ] Automate the dict generating process, registering, and lazy-loading.