Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
*.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

/crsearch.json/crsearch.json
/crsearch.json/crsearch.js
/cpprefjp/static/static/kunai
/cpprefjp/static/static/crsearch/*

Expand Down
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ $ 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 All @@ -46,7 +45,6 @@ popd
mkdir -p cpprefjp/static/static/crsearch
pushd cpprefjp/static/static/crsearch
ln -s ../../../../crsearch.json/crsearch.json crsearch.json
ln -s ../../../../crsearch.json/crsearch.js crsearch.js # Optional (ローカル file:///... で閲覧する場合に必要)
popd

# site_generator 用の docker イメージを生成する
Expand All @@ -58,7 +56,6 @@ popd
```bash
# この辺は必要に応じて実行する
(cd cpprefjp/site && git pull)
(cd cpprefjp/image && git pull)
./crsearch.json/docker.sh run
./kunai/docker.sh run build

Expand All @@ -77,7 +74,6 @@ 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
18 changes: 9 additions & 9 deletions boostjp/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

{% block rss %}{% endblock %}

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ relative_base }}/static/pygments/default.css">
<!-- <link rel="stylesheet" href="{{ relative_base }}/static/css/root.css"> -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/pygments/default.css">
<!-- <link rel="stylesheet" href="/static/css/root.css"> -->

<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- <script src="https://platform.twitter.com/widgets.js"></script> -->
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- <script src="//platform.twitter.com/widgets.js"></script> -->

<!-- <script src="{{ relative_base }}/static/js/root.js"></script> -->
<!-- <script src="/static/js/root.js"></script> -->

{% block mathjax %}{% endblock %}

Expand Down Expand Up @@ -254,7 +254,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ relative_index }}">
<a class="navbar-brand" href="/">
<div class="title-wrapper clearfix">
<div class="title">{% block brand %}{% endblock %}</div>
</div>
Expand Down Expand Up @@ -326,7 +326,7 @@
</body>
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6. chromium.org/developers/how-tos/chrome-frame-getting-started -->
<!--[if lt IE 7 ]>
<script src="https://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<script>
window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})
</script>
Expand Down
6 changes: 3 additions & 3 deletions boostjp/templates/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<li {{ 'style="display: none"' if not parent_opened }} class="parent_li {{ 'active' if child.opened }}">
<span class="treespan" onclick="tree_onclick.call(this, event)"><i class="glyphicon {{ 'glyphicon-minus' if child.opened else 'glyphicon-plus' }}"></i></span>
{% if child.href %}
<a href="{{ relative_base }}{{ child.href }}">{{ child.title|e }}</a>{{ child.encoded_cpp_meta }}
<a href="{{ child.href }}">{{ child.title|e }}</a>{{ child.encoded_cpp_meta }}
{% else %}
{{ child.title|e }}{{ child.encoded_cpp_meta }}
{% endif %}
Expand All @@ -26,7 +26,7 @@
{% else %}
<li {{ 'style="display: none"' if not parent_opened }}>
{% if child.href %}
<a href="{{ relative_base }}{{ child.href }}">{{ child.title|e }}</a>{{ child.encoded_cpp_meta }}
<a href="{{ child.href }}">{{ child.title|e }}</a>{{ child.encoded_cpp_meta }}
{% else %}
{{ child.title|e }}{{ child.encoded_cpp_meta }}
{% endif %}
Expand All @@ -49,7 +49,7 @@
<li {{ 'class="active"' if header.is_active }} itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<span>
{% if not header.is_active and header.href %}
<a href="{{ relative_base }}{{ header.href }}" itemprop="url">
<a href="{{ header.href }}" itemprop="url">
{% if loop.index == 1 %}
<i class="glyphicon glyphicon-home"></i>
{% else %}
Expand Down
1 change: 0 additions & 1 deletion cpprefjp/ghwebhook_on_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ cp crsearch.json/crsearch.json cpprefjp/static/static/crsearch/
# サイト生成
clone_and_fallback cpprefjp/cpprefjp.github.io git@github.com:cpprefjp/cpprefjp.github.io.git
clone_and_fallback cpprefjp/site git@github.com:cpprefjp/site.git
clone_and_fallback cpprefjp/image git@github.com:cpprefjp/image.git
./docker.sh build
./docker.sh run settings.cpprefjp "$@"

Expand Down
28 changes: 14 additions & 14 deletions cpprefjp/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@

{% block rss %}{% endblock %}

<link rel="apple-touch-icon" sizes="180x180" href="{{ relative_base }}/static/favicons/apple-touch-icon.png{{ cachebust }}">
<link rel="icon" type="image/png" sizes="32x32" href="{{ relative_base }}/static/favicons/favicon-32x32.png{{ cachebust }}">
<link rel="icon" type="image/png" sizes="16x16" href="{{ relative_base }}/static/favicons/favicon-16x16.png{{ cachebust }}">
<link rel="manifest" href="{{ relative_base }}/manifest.json{{ cachebust }}">
<link rel="mask-icon" href="{{ relative_base }}/static/favicons/safari-pinned-tab.svg{{ cachebust }}" color="#f5f8fc">
<link rel="apple-touch-icon" sizes="180x180" href="/static/favicons/apple-touch-icon.png{{ cachebust }}">
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicons/favicon-32x32.png{{ cachebust }}">
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicons/favicon-16x16.png{{ cachebust }}">
<link rel="manifest" href="/static/favicons/manifest.json{{ cachebust }}">
<link rel="mask-icon" href="/static/favicons/safari-pinned-tab.svg{{ cachebust }}" color="#f5f8fc">
<meta name="theme-color" content="#f5f8fc">

<link rel="stylesheet" href="{{ relative_base }}/static/pygments/default.css{{ cachebust }}">
<!-- <link rel="stylesheet" href="{{ relative_base }}/static/css/root.css"> -->
<link rel="stylesheet" href="/static/pygments/default.css{{ cachebust }}">
<!-- <link rel="stylesheet" href="/static/css/root.css"> -->

{% block mathjax %}{% endblock %}

<link href="{{ relative_base }}/static/kunai/css/kunai-stage-0.css{{ cachebust }}" rel="stylesheet">
<link href="{{ relative_base }}/static/kunai/css/kunai-stage-1.css{{ cachebust }}" rel="stylesheet">
<link href="{{ relative_base }}/static/kunai/css/kunai-stage-2.css{{ cachebust }}" rel="stylesheet">
<link href="{{ relative_base }}/static/kunai/css/kunai-stage-3.css{{ cachebust }}" rel="stylesheet">
<link href="/static/kunai/css/kunai-stage-0.css{{ cachebust }}" rel="stylesheet">
<link href="/static/kunai/css/kunai-stage-1.css{{ cachebust }}" rel="stylesheet">
<link href="/static/kunai/css/kunai-stage-2.css{{ cachebust }}" rel="stylesheet">
<link href="/static/kunai/css/kunai-stage-3.css{{ cachebust }}" rel="stylesheet">

<script type="text/javascript" src="{{ relative_base }}/static/kunai/js/kunai-vendor.js{{ cachebust }}"></script>
<script type="text/javascript" src="{{ relative_base }}/static/kunai/js/kunai.js{{ cachebust }}"></script>
<script type="text/javascript" src="/static/kunai/js/kunai-vendor.js{{ cachebust }}"></script>
<script type="text/javascript" src="/static/kunai/js/kunai.js{{ cachebust }}"></script>

<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
Expand All @@ -61,7 +61,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ relative_index }}">
<a class="navbar-brand" href="/">
<div class="title-wrapper clearfix">
<div class="title">{% block brand %}{% endblock %}</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions cpprefjp/templates/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<li class="parent_li {{ 'active' if child.opened }}">
<span class="treespan"></span>
{% if child.href %}
<a href="{{ relative_base }}{{ child.href }}">{{ child.title|e }}</a>{{ child.encoded_cpp_meta }}
<a href="{{ child.href }}">{{ child.title|e }}</a>{{ child.encoded_cpp_meta }}
{% else %}
{{ child.title|e }}{{ child.encoded_cpp_meta }}
{% endif %}
Expand All @@ -28,7 +28,7 @@
{% else %}
<li>
{% if child.href %}
<a href="{{ relative_base }}{{ child.href }}">{{ child.title|e }}</a>{{ child.encoded_cpp_meta }}
<a href="{{ child.href }}">{{ child.title|e }}</a>{{ child.encoded_cpp_meta }}
{% else %}
{{ child.title|e }}{{ child.encoded_cpp_meta }}
{% endif %}
Expand Down Expand Up @@ -58,7 +58,7 @@
<li {{ 'class="active"' if header.is_active }} itemscope itemtype="http://www.schema.org/SiteNavigationElement">
<span>
{% if not header.is_active and header.href %}
<a href="{{ relative_base }}{{ header.href }}" itemprop="url">
<a href="{{ header.href }}" itemprop="url">
{% if loop.index == 1 %}
<i class="fa fa-fw fa-home"></i>
{% else %}
Expand Down
5 changes: 1 addition & 4 deletions crsearch.json/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,8 @@ def main():
paths = chain.from_iterable([get_files(d) for d in _KNOWN_DIRS])
all_paths = list(get_files('site'))
result = Generator().generate('site', paths, all_paths)
crsearch_json = json.dumps(result, separators=(',', ':'), ensure_ascii=False, sort_keys=True)
with open('crsearch.json', 'wb') as f:
f.write(crsearch_json.encode('utf-8'))
with open('crsearch.js', 'wb') as f:
f.write(('callback(%s)' % crsearch_json).encode('utf-8'))
f.write(json.dumps(result, separators=(',', ':'), ensure_ascii=False, sort_keys=True).encode('utf-8'))


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion markdown_to_html
28 changes: 3 additions & 25 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import importlib
import json
import os
import posixpath
import re
import subprocess
import sys
Expand Down Expand Up @@ -70,9 +69,6 @@ def md_to_html(md_data, path, hrefs=None, global_qualify_list=None):
'base_path': '/'.join(paths[:-1]),
'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 @@ -505,11 +501,11 @@ def convert_pageinfo(pageinfo, sidebar, sidebar_index, template, hrefs, global_q
sidebar.set_active(pageinfo['paths'])

content_header = ContentHeader(pageinfo['paths'], sidebar, sidebar_index)
context = {
convert(pageinfo['path'], template, {
'title': (
pageinfo['title'] if pageinfo['is_index'] else
pageinfo['title'] + settings.TITLE_SUFFIX),
'url': settings.BASE_URL + pageinfo['href'],
'url': settings.BASE_URL + '/' + pageinfo['href'],
'description': pageinfo['description'],
'cachebust': _CACHEBUST,
'disable_sidebar': settings.DISABLE_SIDEBAR,
Expand All @@ -525,18 +521,7 @@ def convert_pageinfo(pageinfo, sidebar, sidebar_index, template, hrefs, global_q
'project_name': settings.PROJECT_NAME,
'latest_commit_info': latest_commit_info,
'keywords': settings.META_KEYWORDS,
'relative_base': '',
'relative_index': '/'
}
if settings.USE_RELATIVE_LINK:
url_current_dir = posixpath.dirname(context['url'])
context['relative_base'] = posixpath.relpath(settings.BASE_URL, url_current_dir)
# Note: ローカル (file:///) で閲覧時にディレクトリを開いてしまわないように "/" で終わらず "index.html"も明示する。
context['relative_index'] = posixpath.relpath(settings.BASE_URL, url_current_dir) + '/index.html'
# Note: 以下は <meta /> で埋め込む情報なので敢えて相対パスにはしない。
# context['url'] = posixpath.relpath(context['url'], url_current_dir)
# context['rss'] = posixpath.relpath(context['rss'], url_current_dir)
convert(pageinfo['path'], template, context, hrefs, global_qualify_list)
}, hrefs, global_qualify_list)


def main():
Expand Down Expand Up @@ -606,13 +591,6 @@ 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()
5 changes: 0 additions & 5 deletions settings/boostjp.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
# 静的ファイルディレクトリ
STATIC_DIR = 'boostjp/static'

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

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

Expand Down Expand Up @@ -85,7 +81,6 @@
# 'git' => CACHEBUST_DIR のディレクトリの git rev-parse HEAD の結果を使う
CACHEBUST_TYPE = 'time'

USE_RELATIVE_LINK = False

# 並び替えルール
def get_order_priority(name):
Expand Down
13 changes: 0 additions & 13 deletions settings/boostjp_relative.py

This file was deleted.

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

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

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

Expand Down Expand Up @@ -85,8 +81,6 @@
CACHEBUST_TYPE = 'git'
CACHEBUST_DIR = 'kunai'

USE_RELATIVE_LINK = False

# 並び替えルール
ORDER_PRIORITY_LIST = [
'op_constructor',
Expand Down
11 changes: 0 additions & 11 deletions settings/cpprefjp_relative.py

This file was deleted.