karmapa / AdarshaIos

📱 Tibetan sutra reader iOS app
GNU General Public License v3.0
5 stars 2 forks source link

從樹狀圖和進階搜尋 進入內文後的經名顯示,要和進內文前點選的經名一致 #53

Closed chiehan1 closed 8 years ago

chiehan1 commented 8 years ago

以樹狀目錄為例 選樹狀目錄的 第10個 寶積部 --> 第4個 ང --> 第2個 འཕགས་པ་གང་པོས་ཞུས་པ་ཞེས་བྱ་བ་ཐེག་པ་ཆེན་པོའི་མདོ། (就是圖一的經名,綠框) 但進到內文顯示的經名是上一個經名འཕགས་པ་ཡབ་དང་སྲས་མཇལ་བ་ཞེས་བྱ་བ་ཐེག་པ་ཆེན་པོའི་མདོ། (圖一和圖二的橘框) 希望進到內文顯示的經名也是當初點選的經名,也就是綠框的經名

造成此問題的原因是有些經的經名 tag 在 pb 段落的中間,此 pb 段落的內文前半屬於上一部經,後半才屬於點選的經。

解決方法可能可以去抓該 pb 段落的第一個 tag,從這個 tag 去找經名。 或是直接代入在樹狀目錄或進階搜尋結果所點選的經名, 或其他更好的方式。

圖一 img_0124

圖二 img_0125

chiehan1 commented 8 years ago

這個 issue 要和一個 pb 段落內含多經名的 issue 配合, 需等討論完再確定

一個 pb 段落內含多經名,目前往下滑是抓 pb 段落內的最後一個經名, 如果改成抓 pb 段落內的第一個經名, 在過了這個 pb 段落到了下一個沒有經名 (head1 tag) 的 pb 段落或只有一個經名 (head1 tag) 的 pb 段落前半段,不知經名是否顯示多 pb 段落的最後一個經名?

chiehan1 commented 8 years ago

詢問法海師後, 進到內文後,顯示的經名, 如果 pb 段落裡有 tag,就用 pb 段落內第一個 head1 tag 的經名, 如果 pb 段落沒有 tag,就用該段落所在的經名。

chiehan1 commented 8 years ago

但從樹狀圖和進階搜尋進入內文後的 pb 段落有多個經名,以上規則會有瑕疵

kmsheng commented 8 years ago

@chiehan1 目前程式已改成都是由內文頁裡面偵測到的經文為主, 請看看目前版本還需要改什麼 ?

chiehan1 commented 8 years ago

改成由內文頁裡面偵測到的經文為主的話

以這個 issue 提到的例子 選樹狀目錄的 第10個 寶積部 --> 第4個 ང --> 第2個 འཕགས་པ་གང་པོས་ཞུས་པ་ཞེས་བྱ་བ་ཐེག་པ་ཆེན་པོའི་མདོ། (就是圖一的經名,綠框) 但進到內文顯示的經名仍然是上一個經名འཕགས་པ་ཡབ་དང་སྲས་མཇལ་བ་ཞེས་བྱ་བ་ཐེག་པ་ཆེན་པོའི་མདོ།

原本是往下滑會顯示 pb id 下半部經文的經名,往上滑會顯示 pb id上半部經文的經名 但法海師的意思是希望直接去抓該 pb id 裡面的經名 tag(如果這個 pb id 有經名 tag 的話) ,就不會顯示成pb id 上半部經文的經名了

chiehan1 commented 8 years ago

更新以後 照例子點進去以後一樣是顯示成上一個經名 འཕགས་པ་ཡབ་དང་སྲས་མཇལ་བ་ཞེས་བྱ་བ་ཐེག་པ་ཆེན་པོའི་མདོ།

而不是預期的在樹狀目錄點選的經名 འཕགས་པ་གང་པོས་ཞུས་པ་ཞེས་བྱ་བ་ཐེག་པ་ཆེན་པོའི་མདོ།

kmsheng commented 8 years ago

screen shot 2016-01-15 at 10 22 57 pm

kmsheng commented 8 years ago

@yapcheahshen 請問 function toc 餵 81.188a 是否有 return 正確的經名 ?

kmsheng commented 8 years ago

@yapcheahshen 哈囉? 有看到這個 issue 問的問題嗎 ?

kmsheng commented 8 years ago

@yapcheahshen 現在抓第一篇的經名都會抓到上一篇的經名, 而不是這篇的

yapcheahshen commented 8 years ago

要用vpos_end (fetch 會返回 data[0].vpos, data[0].vpos_end),而不能用 vpos 去取經名。 vpos_end 表示是這頁尾的vpos

因為 這一頁的pb 標記(vpos) 比 head 先出現。

regards, yap

2016-01-18 19:52 GMT+08:00 kmsheng notifications@github.com:

@yapcheahshen https://github.com/yapcheahshen 現在抓第一篇的經名都會抓到上一篇的經名, 而不是這篇的

— Reply to this email directly or view it on GitHub https://github.com/karmapa/AdarshaIos/issues/53#issuecomment-172508066.

kmsheng commented 8 years ago

@yapcheahshen 我是照你上次說的做法去抓的, 原本是 ksa.toc({uti: uti}), 然後取 breadcrumb[3].t , 請問現在要怎麼抓經名 ?

yapcheahshen commented 8 years ago

要改用 ksa.toc({vpos:vpos_end})

因為sutra 剛好在 該頁,所以會抓到上一經的經名。 大部份的時候,如果uti是經文的中間,就沒問題。

2016-01-18 20:04 GMT+08:00 kmsheng notifications@github.com:

@yapcheahshen https://github.com/yapcheahshen 我是照你上次說的做法去抓的, 原本是 ksa.toc({uti: uti}), 然後取 breadcrumb[3].t , 請問現在要怎麼抓經名 ?

— Reply to this email directly or view it on GitHub https://github.com/karmapa/AdarshaIos/issues/53#issuecomment-172510818.

kmsheng commented 8 years ago

@yapcheahshen 可是我 fetch 出來的 row 都沒有 vpos_end 這個屬性耶 ?

yapcheahshen commented 8 years ago

https://github.com/ksanaforge/ksana-simple-api/blob/master/index.js#L287

前幾個commit才加的。

yap

2016-01-18 20:23 GMT+08:00 kmsheng notifications@github.com:

@yapcheahshen https://github.com/yapcheahshen 可是我 fetch 出來的 row 都沒有 vpos_end 這個屬性耶 ?

— Reply to this email directly or view it on GitHub https://github.com/karmapa/AdarshaIos/issues/53#issuecomment-172514059.

kmsheng commented 8 years ago

@chiehan1 已在 v1.0.50 (3) 修正

chiehan1 commented 8 years ago

test ok! thank you