Skip to content

Commit

Permalink
fix: some todo (#9)
Browse files Browse the repository at this point in the history
close #8
  • Loading branch information
tsuyoshicho committed Apr 27, 2020
1 parent 231376d commit 2ac128b
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 36 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/vimhelpdeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tools/github"]
path = tools/github
url = https://github.com/cormacrelf/vim-colors-github.git
13 changes: 10 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
86 changes: 58 additions & 28 deletions tools/buildhtml.vim
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand All @@ -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.
Expand All @@ -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,/^<hr>/delete _
" remove footer
silent /^<hr>/,$delete _
" escape jekyll tags
silent %s/{\{2,}\|{%/{{ "\0" }}/ge
" YAML front matter
call append(0, [
\ '---',
\ 'layout: vimdoc',
\ printf("helpname: '%s'", helpname),
\ '---',
\ ])
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,/^<hr>/delete _
" " remove footer
" silent /^<hr>/,$delete _
" " escape jekyll tags
" silent %s/{\{2,}\|{%/{{ "\0" }}/ge
" " YAML front matter
" call append(0, [
" \ '---',
" \ 'layout: vimdoc',
" \ printf("helpname: '%s'", helpname),
" \ '---',
" \ ])
" endfunction

call s:main()
1 change: 1 addition & 0 deletions tools/github
Submodule github added at acb712
15 changes: 10 additions & 5 deletions tools/makehtml.vim
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,20 @@ function! MakeHtml2(src, dst, conceal)
silent new `=a:src`

" 2html options
let g:html_expand_tabs = 1

let g:html_ignore_conceal = 1

let g:html_ignore_folding = 1
let g:html_line_ids = 1
let g:html_no_pre = 0
let g:html_number_lines = 1
let g:html_use_css = 1
let g:html_hover_unfold = 1

let g:html_number_lines = 0
let g:html_line_ids = 0

let g:html_pre_wrap = 0
let g:html_expand_tabs = 1
let g:html_no_pre = 0

let g:html_use_css = 1
let g:html_use_xhtml = 0

" set dumy highlight to keep syntax identity
Expand Down

0 comments on commit 2ac128b

Please sign in to comment.