Skip to content

Commit

Permalink
run: imageリポジトリの内容をstatic/imageにコピー
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jun 5, 2022
1 parent 187bfd5 commit ffe59b7
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
*.pyc
cpprefjp/site/
cpprefjp/image/
cpprefjp/cpprefjp.github.io/
cpprefjp/cpprefjp.relative/
boostjp/site/
boostjp/image/
boostjp/boostjp.github.io/
boostjp/boostjp.relative/
settings.*.cache
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ $ git submodule update -i

```bash
git clone https://github.com/cpprefjp/site.git cpprefjp/site
git clone https://github.com/cpprefjp/image.git cpprefjp/image

# kunai 用のデータを生成する
git clone https://github.com/cpprefjp/kunai.git
Expand Down Expand Up @@ -57,6 +58,7 @@ popd
```bash
# この辺は必要に応じて実行する
(cd cpprefjp/site && git pull)
(cd cpprefjp/image && git pull)
./crsearch.json/docker.sh run
./kunai/docker.sh run build

Expand All @@ -75,6 +77,7 @@ http://localhost:8000 を開けば `index.html` が表示されます。

```bash
git clone https://github.com/boostjp/site.git boostjp/site
git clone https://github.com/boostjp/image.git boostjp/image

# site_generator 用の docker イメージを生成する
./docker.sh build
Expand Down
1 change: 1 addition & 0 deletions cpprefjp/ghwebhook_on_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ cp crsearch.json/crsearch.json cpprefjp/static/static/crsearch/
# サイト生成
clone_and_fallback cpprefjp/cpprefjp.github.io [email protected]:cpprefjp/cpprefjp.github.io.git
clone_and_fallback cpprefjp/site [email protected]:cpprefjp/site.git
clone_and_fallback cpprefjp/image [email protected]:cpprefjp/image.git
./docker.sh build
./docker.sh run settings.cpprefjp "$@"

Expand Down
2 changes: 1 addition & 1 deletion markdown_to_html
9 changes: 9 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def md_to_html(md_data, path, hrefs=None, global_qualify_list=None):
'full_path': path + '.md',
'extension': '.html',
'use_relative_link': settings.USE_RELATIVE_LINK,
'image_repo': settings.IMAGE_REPO,
'use_static_image': settings.IMAGE_DIR is not None,
}
extension_configs['codehilite'] = {
'noclasses': False
Expand Down Expand Up @@ -601,6 +603,13 @@ def run(pageinfos):
# 静的ファイルをコピーする
subprocess.call(['cp', '-v', '-RL'] + glob.glob(os.path.join(settings.STATIC_DIR, '*')) + [settings.OUTPUT_DIR])

# 画像リポジトリ (image) の画像ファイル (*.png, *.jpg, *.svg) をコピーする
if settings.IMAGE_DIR is not None:
os.system("cd '%s' && find . -name '*.png' -or -name '*.jpg' -or -name '*.svg' | tee /dev/stderr | cpio -updmv '%s'" % (
settings.IMAGE_DIR,
os.path.relpath(os.path.join(settings.OUTPUT_DIR, 'static/image'), settings.IMAGE_DIR)
))


if __name__ == '__main__':
main()
4 changes: 4 additions & 0 deletions settings/boostjp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# 静的ファイルディレクトリ
STATIC_DIR = 'boostjp/static'

# 画像ファイルディレクトリ / GitHubリポジトリ
IMAGE_DIR = 'boostjp/image'
IMAGE_REPO = 'boostjp/image'

# 出力ディレクトリ
OUTPUT_DIR = 'boostjp/boostjp.github.io'

Expand Down
4 changes: 4 additions & 0 deletions settings/cpprefjp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
# 静的ファイルディレクトリ
STATIC_DIR = 'cpprefjp/static'

# 画像ファイルディレクトリ / GitHubリポジトリ
IMAGE_DIR = 'cpprefjp/image'
IMAGE_REPO = 'cpprefjp/image'

# 出力ディレクトリ
OUTPUT_DIR = 'cpprefjp/cpprefjp.github.io'

Expand Down

0 comments on commit ffe59b7

Please sign in to comment.