====== 開發 DokuWiki popup plugin ======
緣起:{{page>..:..:syntax:popup#自助&footer}}
===== 目標 =====
- 簡單的輸入語法
- popup 內使用一般 DW markup 而非 HTML
- 從 ''getElementById'' 變為 ''getElementByClassName''?
===== 參考 =====
* 開發 DW plugin 一般要點:
* [[doku>devel:plugins]]
* [[doku>devel:plugin_file_structure]]
* [[doku>devel:plugin_programming_tips]]
* pseudo-plugin
===== 實做 =====
/^20200321^/ 準備開始。
----
/^20200322^/ 把最基本的 CSS + JS 做成 pseudo-plugin,++++搭配類似像這裡面的 HTML 標記碼(而非 DokuWiki 自身語法)|
++++
→ 最粗略的 v0.1 [[https://github.com/GJRobert/dokuwiki-plugin-popup/releases/tag/v0.1|Release Original basic method, working · GJRobert/dokuwiki-plugin-popup]]
然後開始實做 syntax:拿 [[doku>plugin:ruby]] 的 syntax.php 來改,目前想先用 ''[按鈕]^^泡泡內容^^'' 這樣的語法。
----
/^20200323^/ [[https://github.com/GJRobert/dokuwiki-plugin-popup/commit/5cd1c31d15b6cef09c349f4c3e37a61b0562c728|這個 commit 初步成功]],但有多個要修改的問題,而且目前想用的語法似乎會和連結語法 ''%%[[...]]%%'' 衝突,可能需要改。
++++插曲:一次自動新增多個 GitHub issue|
找到 [[https://github.com/Ricky54326/Github-Auto-Issue-Creator|Ricky54326/Github-Auto-Issue-Creator: An automatic issue creator for Github, written in Python. It'll go through your entire git repo, look for any lines that start with TODO: and add them as issues to your repo.]]
下載來用,卻看到
Traceback (most recent call last):
File "./autoissue.py", line 207, in
少了 Python ''requests'' 模組,變成還得再想辦法安裝
執行了 ''$ which -a python python2 python2.7 python3 python3.6''(([[https://stackoverflow.com/questions/33175827/what-version-of-python-is-on-my-mac|macos - What version of Python is on my Mac? - Stack Overflow]])),發現我有:
/usr/bin/python
/usr/bin/python2.7
/usr/local/bin/python3
3 份 Python
[[https://stackoverflow.com/questions/54484536/installing-requests-python-library-on-macos/54484665|這裡]]有人建議不要在 macOS 隨附的 Python 中安裝 requests 模組,而且 macOS 的 Python 2.7.10 很誇張,沒有 pip,也沒有 easty_install ∴我決定改用 Python 3↓
$ pip3 install requests
但接下來 Python 3 執行那個腳本,卻又語法錯誤 :(
$ python3 ./autoissue.py -i -p /Volumes/SD/Dropbox/projects/dokuwiki-plugin-popup/ -s 'FIXME'
File "./autoissue.py", line 37
except IOError as (eno, strerror):
^
SyntaxError: invalid syntax
所幸有 Python3 的腳本:[[https://github.com/Ricky54326/Github-Auto-Issue-Creator/tree/python3|Ricky54326/Github-Auto-Issue-Creator at python3]]
→ 執行了卻找不到任何 issue :(
↑放棄上面的腳本,結果透過 Zapier,順利把記錄在 Google Spreadsheet 上的 issue,自動加到 GitHub 去了。還是要靠專業的來啊!🆗🔚
++++
----
3/23 晚上,改成了 ''%%[^按鈕文字^]^^泡泡內容^^%%''
然後又改用 ''%%[^按鈕文字^](^泡泡內容^)%%'',暫時可能會先用這個,再來可能要先處理別的問題了 ☞ [[https://github.com/GJRobert/dokuwiki-plugin-popup/issues|Issues · GJRobert/dokuwiki-plugin-popup]],我可能要想辦法做個表把這些 issue 排個優先順序
----
/^20200324^/ 來研究 [[doku>plugin:folded]] 的 /syntax,並參考 [[doku>devel:syntax_plugins]]
* 看來 ''getType()'' 應該用 ''formatting'' 或 ''container'' 的
----
/^20200325^/
* 先把按鈕的 div 改為 span 試試 → inline ✅(GitHub 自動把 [[https://github.com/GJRobert/dokuwiki-plugin-popup/issues/5|Issue #5]] close 掉了!真神奇 :o)
* 如果變 inline 的話,就一定需要適當的 style 來顯示 button 了
* 突然想到,以前 TiddlyWiki 的 popup,可以設成只需 hover、不需 click ∴這次我可能也可以考慮是否要調整成不一樣的行為;樣式方面,如果只要 hover 的話,可能不一定要做成有陰影的按鈕
* → 開了一個 branch「ohhover」來修改。但是隨即發現,不是叫 ''onhover'',而是 ''oumouseover'' 糗 XD(([[https://stackoverflow.com/questions/15486376/javascript-function-onhover-in-div|JavaScript function onhover in