-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: added layout.html, added basic file structure
- Loading branch information
Showing
24 changed files
with
223 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ docs/_build | |
|
||
.env | ||
.astro/ | ||
package-lock.json | ||
node_modules/ | ||
npm-debug.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
|
||
project = "Shibuya" | ||
copyright = "2023, Hsiaoming Yang" | ||
author = "Hsiaoming Yang" | ||
|
||
html_theme = "shibuya" | ||
html_baseurl = "https://shibuya.lepture.com" | ||
html_logo = "https://typlog.com/assets/logo-black.svg" | ||
|
||
html_theme_options = { | ||
"logo_target": "/", | ||
"light_logo": "https://typlog.com/assets/logo-black.svg", | ||
"dark_logo": "https://typlog.com/assets/logo-white.svg", | ||
|
||
"head_links": [ | ||
{ | ||
"name": "Documentation", | ||
"url": "/" | ||
}, | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
Shibuya for Sphinx | ||
================== | ||
|
||
haha |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
{ | ||
"name": "shibuya", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"build": "esbuild static/index.js --bundle --outfile=shibuya/theme/shibuya/static/shibuya.js", | ||
"dev": "npm run build -- --watch" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "^0.17.6", | ||
"tailwindcss": "^3.2.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from livereload import Server, shell | ||
|
||
app = Server() | ||
app.watch("sphinx_shibuya/src", shell("make build-docs")) | ||
app.watch("src", shell("make build-docs")) | ||
app.watch("docs", shell("make build-docs")) | ||
app.serve(root="build/_html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from setuptools import setup | ||
|
||
# for pip install -e | ||
setup() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from typing import Dict, Any | ||
from pathlib import Path | ||
from sphinx.builders.html import StandaloneHTMLBuilder | ||
from .context import ( | ||
BASE_CSS_VARIABLES, | ||
LIGHT_CSS_VARIABLES, | ||
DARK_CSS_VARIABLES, | ||
css_to_dict, | ||
) | ||
|
||
__version__ = '1.0.0' | ||
|
||
THEME_PATH = (Path(__file__).parent / "theme" / "shibuya").resolve() | ||
|
||
|
||
def _html_page_context(app, pagename: str, templatename: str, context: Dict[str, Any], doctree): | ||
assert isinstance(app.builder, StandaloneHTMLBuilder) | ||
context["shibuya_base_css_variables"] = css_to_dict(BASE_CSS_VARIABLES) | ||
context["shibuya_light_css_variables"] = css_to_dict(LIGHT_CSS_VARIABLES) | ||
context["shibuya_dark_css_variables"] = css_to_dict(DARK_CSS_VARIABLES) | ||
|
||
|
||
def setup(app): | ||
"""Entry point for sphinx theming.""" | ||
app.add_html_theme("shibuya", str(THEME_PATH)) | ||
app.connect("html-page-context", _html_page_context) | ||
return { | ||
"parallel_read_safe": True, | ||
"parallel_write_safe": True, | ||
"version": __version__, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
BASE_CSS_VARIABLES = """ | ||
--sy-f-sys: -apple-system, BlinkMacSystemFont, Segoe UI, Oxygen, Ubuntu, Droid Sans, Helvetica Neue; | ||
--sy-f-latin: Inter, var(--sy-f-sys); | ||
--sy-f-cjk: PingFang SC, Hiragino Sans GB, Droid Sans Fallback, Microsoft YaHei; | ||
--sy-f-heading: var(--sy-f-latin), var(--sy-f-cjk), sans-serif; | ||
--sy-f-text: var(--sy-f-latin), var(--sy-f-cjk), sans-serif; | ||
--sy-c-text: rgba(var(--sy-rc-text), 0.86); | ||
--sy-c-divider: var(--sy-rc-text, 0.1); | ||
""" | ||
|
||
LIGHT_CSS_VARIABLES = """ | ||
--sy-rc-bg: 255, 255, 255; | ||
--sy-rc-text: 0, 0, 0; | ||
--sy-c-bg: #fff; | ||
--sy-c-bg-weak: #f9f9f9; | ||
""" | ||
|
||
DARK_CSS_VARIABLES = """ | ||
--sy-rc-bg: 18, 18, 18; | ||
--sy-rc-text: 255, 255, 255; | ||
--sy-c-bg: rgba(var(--sy-rc-bg), 0.86); | ||
""" | ||
|
||
def css_to_dict(text: str): | ||
css_vars = {} | ||
for line in text.strip().splitlines(): | ||
if not line: | ||
continue | ||
line = line.rstrip(";") | ||
key, value = line.split(':') | ||
css_vars[key.strip()] = value.strip() | ||
return css_vars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{%- macro declare_css_vars(sys_vars, user_vars) -%} | ||
{%- if user_vars -%} | ||
{%- for name in sys_vars -%} | ||
{%- if name in user_vars -%} | ||
{{ name }}:{{user_vars[name]}}; | ||
{%- else -%} | ||
{{ name }}:{{sys_vars[name]}}; | ||
{%- endif -%} | ||
{%- endfor -%} | ||
{%- else -%} | ||
{%- for name in sys_vars -%} | ||
{{ name }}:{{sys_vars[name]}}; | ||
{%- endfor -%} | ||
{%- endif -%} | ||
{%- endmacro -%} | ||
|
||
<style> | ||
:root { | ||
{{ declare_css_vars(shibuya_base_css_variables, theme_base_css_variables) }} | ||
{{ declare_css_vars(shibuya_light_css_variables, theme_light_css_variables) }} | ||
} | ||
@media not print { | ||
@media (prefers-color-scheme: dark) { | ||
{{ declare_css_vars(shibuya_dark_css_variables, theme_light_css_variables) }} | ||
} | ||
html[data-theme="light"] { | ||
{{ declare_css_vars(shibuya_light_css_variables, theme_light_css_variables) }} | ||
} | ||
html[data-theme="dark"] { | ||
{{ declare_css_vars(shibuya_dark_css_variables, theme_light_css_variables) }} | ||
} | ||
} | ||
</style> |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!DOCTYPE html> | ||
<html {% if language is not none %} lang="{{ language }}"{% endif %}> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
{%- block htmltitle -%} | ||
<title>{{ title|striptags|e }}{{ titlesuffix }}</title> | ||
{% endblock %} | ||
{%- block linktags %} | ||
{%- if hasdoc('about') -%} | ||
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" /> | ||
{%- endif -%} | ||
{%- if hasdoc('genindex') -%} | ||
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" /> | ||
{%- endif -%} | ||
{%- if hasdoc('search') -%} | ||
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" /> | ||
{%- endif -%} | ||
{%- if hasdoc('copyright') -%} | ||
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" /> | ||
{%- endif -%} | ||
{%- if next -%} | ||
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" /> | ||
{%- endif -%} | ||
{%- if prev -%} | ||
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" /> | ||
{%- endif -%} | ||
{%- if pageurl %} | ||
<link rel="canonical" href="{{ pageurl|e }}" /> | ||
{%- endif %} | ||
{%- endblock linktags %} | ||
{%- if favicon_url -%} | ||
<link rel="shortcut icon" href="{{ favicon_url|e }}"/> | ||
{%- endif %} | ||
|
||
{%- block styles -%} | ||
{%- for css in css_files -%} | ||
{% if css|attr("filename") -%} | ||
{{ css_tag(css) }} | ||
{%- else -%} | ||
<link rel="stylesheet" href="{{ pathto(css, 1)|e }}" type="text/css" /> | ||
{%- endif %} | ||
{% endfor -%} | ||
{% include "components/css_variables.html" with context %} | ||
{% block theme_styles %}{% endblock %} | ||
{%- endblock -%} | ||
{% block extrahead %}{% endblock %} | ||
{% include "partials/meta_head.html" %} | ||
</head> | ||
<body> | ||
<div class="document"> | ||
{%- block header -%} | ||
{% include "components/site_header.html" with context %} | ||
{%- endblock -%} | ||
|
||
{% block body %}{% endblock %} | ||
|
||
{%- block footer -%} | ||
{% include "components/site_footer.html" with context %} | ||
{%- endblock -%} | ||
</div> | ||
|
||
{%- block scripts -%} | ||
{%- for js in script_files %} | ||
{{ js_tag(js) }} | ||
{%- endfor %} | ||
{% block theme_scripts %}{% endblock %} | ||
{%- endblock %} | ||
</body> | ||
</html> |
File renamed without changes.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
(() => { | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[theme] | ||
inherit = basic | ||
|
||
[options] | ||
logo_target = | ||
light_logo = | ||
dark_logo = | ||
|
||
base_css_variables = | ||
light_css_variables = | ||
dark_css_variables = | ||
|
||
head_links = |
Empty file.