diff --git a/.github/workflows/vimhelpdeploy.yml b/.github/workflows/vimhelpdeploy.yml index fc1ce01..0eafe3f 100644 --- a/.github/workflows/vimhelpdeploy.yml +++ b/.github/workflows/vimhelpdeploy.yml @@ -14,6 +14,8 @@ jobs: uses: tsuyoshicho/action-vimhelp-html-generate@master env: FOLDER: build + BACKGROUND: light + COLORSCHEME: github - name: deploy gh-pages uses: JamesIves/github-pages-deploy-action@releases/v2 env: diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..59defc4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "tools/github"] + path = tools/github + url = https://github.com/cormacrelf/vim-colors-github.git diff --git a/Dockerfile b/Dockerfile index 2b38b69..efba519 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,17 @@ -FROM thinca/vim:v8.1.2248 +FROM thinca/vim:v8.2.0640 -RUN apk --update add tree && \ +RUN apk --update add tree git && \ rm -rf /var/lib/apt/lists/* && \ rm /var/cache/apk/* -ADD tools/ /tools/ +WORKDIR /root +RUN git clone https://github.com/tsuyoshicho/action-vimhelp-html-generate.git cloned +WORKDIR /root/cloned + +RUN git submodule sync --recursive && \ + git submodule update --init --recursive + +COPY tools/ /tools/ COPY entrypoint.sh /entrypoint.sh diff --git a/README.md b/README.md index 67e2a75..4c02337 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ jobs: uses: tsuyoshicho/action-vimhelp-html-generate@v1 env: FOLDER: build + BACKGROUND: light + COLORSCHEME: github - name: deploy gh-pages uses: JamesIves/github-pages-deploy-action@releases/v2 env: diff --git a/action.yml b/action.yml index a3218c4..4e042ca 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,15 @@ inputs: FOLDER: description: "Build work directory" default: 'build' + required: false + BACKGROUND: + description: "HTML background type(light and dark)" + default: 'light' + required: false + COLORSCHEME: + description: "HTML colorscheme type(as vim built-ins' and github)" + default: 'github' + required: false runs: using: 'docker' image: 'Dockerfile' diff --git a/tools/buildhtml.vim b/tools/buildhtml.vim index 47dffcc..7ddc8ef 100644 --- a/tools/buildhtml.vim +++ b/tools/buildhtml.vim @@ -1,11 +1,11 @@ +" force Vim setting set nocompatible set nomore +" base setting set encoding=utf-8 set fileencodings=utf-8 syntax on -colorscheme delek -let g:html_no_progress = 1 -set background=light +" options set wrap set ambiwidth=double set modeline @@ -23,8 +23,36 @@ function! s:main() " for the lastest help syntax let &runtimepath = s:tools_dir . ',' . &runtimepath " for ja custom syntax - " let &runtimepath .= ',' . s:proj_dir let &runtimepath = s:proj_dir . ',' . &runtimepath + + " additinal plugin/colorscheme + for name in ['github'] + let &runtimepath = s:tools_dir . '/' . name . ',' . &runtimepath + endfor + + " colorscheme set + let bg = getenv('BACKGROUND') + if bg == v:null || (bg isnot? 'light' && bg isnot? 'dark') + let bg = 'light' + else + let bg = tolower(bg) + endif + let scheme = getenv('COLORSCHEME') + if scheme == v:null + let scheme = 'delek' + if isdirectory(expand(s:tools_dir . '/github')) + let scheme = 'github' + endif + else + let scheme = tolower(scheme) + endif + + let &background = bg + execute 'colorscheme' scheme + + " 2html option + let g:html_no_progress = 1 + call s:BuildHtml() endfunction @@ -44,6 +72,8 @@ function! s:BuildHtml() " set foldlevel=1000 call MakeHtmlAll() + + " old additional style " add header and footer " tabnew " " XXX: modeline may cause error. @@ -53,29 +83,29 @@ function! s:BuildHtml() " silent argdo call s:PostEdit() | update! endfunction -function! s:PostEdit() - set fileformat=unix - call s:ToJekyll() -endfunction - -function! s:ToJekyll() - let helpname = expand('%:t:r') - if helpname == 'index' - let helpname = 'help' - endif - " remove header - silent 1,/^