mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 17:27:39 +02:00
Update GA tags
Also auto gen docs if running publish only for website
This commit is contained in:
19
publish.py
19
publish.py
@@ -68,14 +68,15 @@ def run_html(args: Any) -> None:
|
|||||||
|
|
||||||
def add_analytics() -> None:
|
def add_analytics() -> None:
|
||||||
analytics = '''
|
analytics = '''
|
||||||
<!-- Google Analytics -->
|
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||||
|
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-20736318-2"></script>
|
||||||
<script>
|
<script>
|
||||||
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
window.dataLayer = window.dataLayer || [];
|
||||||
ga('create', 'UA-20736318-2', 'auto');
|
function gtag(){dataLayer.push(arguments);}
|
||||||
ga('send', 'pageview');
|
gtag('js', new Date());
|
||||||
|
|
||||||
|
gtag('config', 'UA-20736318-2');
|
||||||
</script>
|
</script>
|
||||||
<script async="async" src='https://www.google-analytics.com/analytics.js'></script>
|
|
||||||
<!-- End Google Analytics -->\
|
|
||||||
'''
|
'''
|
||||||
for dirpath, firnames, filenames in os.walk(publish_dir):
|
for dirpath, firnames, filenames in os.walk(publish_dir):
|
||||||
for fname in filenames:
|
for fname in filenames:
|
||||||
@@ -87,6 +88,10 @@ ga('send', 'pageview');
|
|||||||
f.write(html.encode('utf-8'))
|
f.write(html.encode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
|
def run_docs(args: Any) -> None:
|
||||||
|
subprocess.check_call(['make', 'docs'])
|
||||||
|
|
||||||
|
|
||||||
def run_website(args: Any) -> None:
|
def run_website(args: Any) -> None:
|
||||||
if os.path.exists(publish_dir):
|
if os.path.exists(publish_dir):
|
||||||
shutil.rmtree(publish_dir)
|
shutil.rmtree(publish_dir)
|
||||||
@@ -384,6 +389,8 @@ def main() -> None:
|
|||||||
ans = 'n'
|
ans = 'n'
|
||||||
if ans.lower() != 'y':
|
if ans.lower() != 'y':
|
||||||
return
|
return
|
||||||
|
if actions == ['website']:
|
||||||
|
actions.insert(0, 'docs')
|
||||||
for action in actions:
|
for action in actions:
|
||||||
print('Running', action)
|
print('Running', action)
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
|
|||||||
Reference in New Issue
Block a user