mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #9197 from blinkov/master
Show documentation revision in footer
This commit is contained in:
commit
b0785416bb
@ -68,7 +68,7 @@ def build_for_lang(lang, args):
|
||||
'search_index_only': False,
|
||||
'static_templates': ['404.html'],
|
||||
'extra': {
|
||||
'now': int(time.mktime(datetime.datetime.now().timetuple())) # TODO better way to avoid caching
|
||||
'now': int(time.mktime(datetime.datetime.now().timetuple())) # TODO better way to avoid caching
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ def build_for_lang(lang, args):
|
||||
site_dir = os.path.join(args.docs_output_dir, args.version_prefix, lang)
|
||||
else:
|
||||
site_dir = os.path.join(args.docs_output_dir, lang)
|
||||
|
||||
|
||||
cfg = config.load_config(
|
||||
config_file=config_path,
|
||||
site_name=site_names.get(lang, site_names['en']) % args.version_prefix,
|
||||
@ -98,7 +98,7 @@ def build_for_lang(lang, args):
|
||||
repo_name='ClickHouse/ClickHouse',
|
||||
repo_url='https://github.com/ClickHouse/ClickHouse/',
|
||||
edit_uri='edit/master/docs/%s' % lang,
|
||||
extra_css=['assets/stylesheets/custom.css'],
|
||||
extra_css=['assets/stylesheets/custom.css?%s' % args.rev_short],
|
||||
markdown_extensions=[
|
||||
'clickhouse',
|
||||
'admonition',
|
||||
@ -115,7 +115,10 @@ def build_for_lang(lang, args):
|
||||
plugins=[],
|
||||
extra={
|
||||
'stable_releases': args.stable_releases,
|
||||
'version_prefix': args.version_prefix
|
||||
'version_prefix': args.version_prefix,
|
||||
'rev': args.rev,
|
||||
'rev_short': args.rev_short,
|
||||
'rev_url': args.rev_url
|
||||
}
|
||||
)
|
||||
|
||||
@ -247,7 +250,8 @@ def build_redirects(args):
|
||||
def build_docs(args):
|
||||
tasks = []
|
||||
for lang in args.lang.split(','):
|
||||
tasks.append((lang, args,))
|
||||
if lang:
|
||||
tasks.append((lang, args,))
|
||||
util.run_function_in_parallel(build_for_lang, tasks, threads=False)
|
||||
build_redirects(args)
|
||||
|
||||
@ -260,7 +264,7 @@ def build(args):
|
||||
build_website(args)
|
||||
|
||||
build_docs(args)
|
||||
|
||||
|
||||
from github import build_releases
|
||||
build_releases(args, build_docs)
|
||||
|
||||
@ -281,7 +285,7 @@ def build(args):
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.chdir(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
|
||||
arg_parser = argparse.ArgumentParser()
|
||||
arg_parser.add_argument('--lang', default='en,ru,zh,ja,fa')
|
||||
arg_parser.add_argument('--docs-dir', default='.')
|
||||
@ -300,9 +304,12 @@ if __name__ == '__main__':
|
||||
|
||||
args = arg_parser.parse_args()
|
||||
args.docs_output_dir = os.path.join(os.path.abspath(args.output_dir), 'docs')
|
||||
|
||||
|
||||
from github import choose_latest_releases
|
||||
args.stable_releases = choose_latest_releases() if args.enable_stable_releases else []
|
||||
args.rev = subprocess.check_output('git rev-parse HEAD', shell=True).strip()
|
||||
args.rev_short = subprocess.check_output('git rev-parse --short HEAD', shell=True).strip()
|
||||
args.rev_url = 'https://github.com/ClickHouse/ClickHouse/commit/%s' % args.rev
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG if args.verbose else logging.INFO,
|
||||
|
@ -1,9 +1,3 @@
|
||||
{% if config.extra.social %}
|
||||
<div class="md-footer-social">
|
||||
{% set path = "ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" %}
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/{{ path }}">
|
||||
{% for social in config.extra.social %}
|
||||
<a href="{{ social.link }}" class="md-footer-social__link fa fa-{{ social.type }}"></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="md-footer-social">
|
||||
<span class="md-footer-copyright__highlight">Built from <a href="{{ config.extra.rev_url }}" rel="external nofollow">{{ config.extra.rev_short }}</a></span>
|
||||
</div>
|
||||
|
@ -4,10 +4,16 @@ import shutil
|
||||
|
||||
import cssmin
|
||||
import htmlmin
|
||||
import jinja2
|
||||
import jsmin
|
||||
|
||||
|
||||
def build_website(args):
|
||||
logging.info('Building website')
|
||||
env = jinja2.Environment(
|
||||
loader=args.output_dir
|
||||
)
|
||||
|
||||
shutil.copytree(
|
||||
args.website_dir,
|
||||
args.output_dir,
|
||||
@ -21,9 +27,25 @@ def build_website(args):
|
||||
)
|
||||
)
|
||||
|
||||
for root, _, filenames in os.walk(args.output_dir):
|
||||
for filename in filenames:
|
||||
path = os.path.join(root, filename)
|
||||
if not filename.endswith('.html'):
|
||||
continue
|
||||
logging.info('Processing %s', path)
|
||||
with open(path, 'rb') as f:
|
||||
content = f.read().decode('utf-8')
|
||||
|
||||
template = env.from_string(content)
|
||||
content = template.render(args.__dict__)
|
||||
|
||||
with open(path, 'wb') as f:
|
||||
f.write(content.encode('utf-8'))
|
||||
|
||||
|
||||
def minify_website(args):
|
||||
if args.minify:
|
||||
logging.info('Minifying website')
|
||||
for root, _, filenames in os.walk(args.output_dir):
|
||||
for filename in filenames:
|
||||
path = os.path.join(root, filename)
|
||||
@ -33,7 +55,7 @@ def minify_website(args):
|
||||
filename.endswith('.js')
|
||||
):
|
||||
continue
|
||||
|
||||
|
||||
logging.info('Minifying %s', path)
|
||||
with open(path, 'rb') as f:
|
||||
content = f.read().decode('utf-8')
|
||||
|
@ -23,7 +23,7 @@
|
||||
<meta name="keywords"
|
||||
content="ClickHouse, DBMS, OLAP, relational, analytics, analytical, big data, open-source, SQL, web-analytics" />
|
||||
|
||||
<link href="index.css" media="all" rel="stylesheet" />
|
||||
<link href="index.css?{{ rev_short }}" media="all" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="navbar">
|
||||
@ -47,7 +47,7 @@
|
||||
<path class="orange" d="M8,3.25 h1 v1.5 h-1 z"></path>
|
||||
</svg>
|
||||
|
||||
<img id="logo-text" src="images/clickhouse-black.svg" alt="ClickHouse" />
|
||||
<img id="logo-text" src="images/clickhouse-black.svg?{{ rev_short }}" alt="ClickHouse" />
|
||||
</h1>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -1,23 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://clickhouse.tech/</loc>
|
||||
<loc>https://clickhouse.tech/</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://clickhouse.tech/benchmark.html</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
<loc>https://clickhouse.tech/benchmark.html</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://clickhouse.tech/tutorial.html</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
<loc>https://clickhouse.tech/benchmark_hardware.html</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://clickhouse.tech/blog/en</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
<loc>https://clickhouse.tech/tutorial.html</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://clickhouse.tech/blog/ru</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
</urlset>
|
||||
<loc>https://clickhouse.tech/blog/en</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://clickhouse.tech/blog/ru</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
</urlset>
|
||||
|
Loading…
Reference in New Issue
Block a user