mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Show documentation revision in footer
This commit is contained in:
parent
de0e81b7b4
commit
8db2f90f78
@ -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,6 +250,7 @@ def build_redirects(args):
|
||||
def build_docs(args):
|
||||
tasks = []
|
||||
for lang in args.lang.split(','):
|
||||
if lang:
|
||||
tasks.append((lang, args,))
|
||||
util.run_function_in_parallel(build_for_lang, tasks, threads=False)
|
||||
build_redirects(args)
|
||||
@ -303,6 +307,9 @@ if __name__ == '__main__':
|
||||
|
||||
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 %}
|
||||
<span class="md-footer-copyright__highlight">Built from <a href="{{ config.extra.rev_url }}" rel="external nofollow">{{ config.extra.rev_short }}</a></span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
@ -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)
|
||||
|
@ -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>
|
||||
|
@ -8,6 +8,10 @@
|
||||
<loc>https://clickhouse.tech/benchmark.html</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://clickhouse.tech/benchmark_hardware.html</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
</url>
|
||||
<url>
|
||||
<loc>https://clickhouse.tech/tutorial.html</loc>
|
||||
<changefreq>daily</changefreq>
|
||||
|
Loading…
Reference in New Issue
Block a user