{# This is the main template of Simrofy theme. It doesn't explicitly import other templates, but it does borrow many ideas from following themes: * Sphinx' builtin [basic](https://github.com/sphinx-doc/sphinx/tree/3.x/sphinx/themes/basic) theme * Sphinx official website's [sphinx-doc (3.x)](https://github.com/sphinx-doc/sphinx/tree/3.x/doc) theme * Python official website's [python-docs-theme](https://github.com/python/python-docs-theme) theme * Read the Docs' Sphinx theme [sphinx-rtd-theme](https://github.com/readthedocs/sphinx_rtd_theme) And Simrofy direcly borrowed these macros from Sphinx basic/layout.html to ensure its extendability for most extensions. A small number of extensions (e.g. MathJax) have been confirmed to work under Simrofy properly, yet others may or may not. * css() * script() #} {%- block doctype -%} {# Borrow from basic/layout.html #} {%- if html5_doctype -%} {%- else -%} {%- endif -%} {%- endblock -%} {%- set simrofy_url = "https://github.com/wklchris/sphinx-simrofy-theme" %} {%- set simrofy_version = '0.4.1' %} {%- set titlesuffix = ' - ' + project %} {%- set url_mainsite = pathto(master_doc) %} {%- if theme_social_accounts %} {% from "socialmedia.html" import socials %} {%- endif %} {# --- MACROS --- #} {%- macro css() %} {%- for css in css_files %} {%- if css|attr("filename") %} {{ css_tag(css) }} {%- else %} {%- endif %} {%- endfor %} {%- endmacro %} {%- macro script() %} {%- for js in script_files %} {{ js_tag(js) }} {%- endfor %} {%- endmacro %} {%- macro print_unicode_icon(key) %} {%- set icons = { 'email': '✉', 'address': '🗪', 'phone': '☎' } -%} {%- if key in icons.keys() %} {{ icons.get(key) }} {%- endif %} {%- endmacro %} {%- macro pathto_static(filepath, subpath=none, static_build_path='_static/') -%} {# static_build_path is the static file path AFTER sphinx build. Usually it is '_static/' (attention the tailing slash). #} {%- if subpath %} {%- set fpath = static_build_path + subpath|trim('/') + '/' + filepath -%} {%- else %} {%- set fpath = static_build_path + filepath -%} {%- endif %} {{ pathto(fpath|e, 1) }} {%- endmacro %} {%- macro pathto_source(filepath, source_path='_sources/') -%} {{ pathto(source_path + filepath|e, 1) }} {%- endmacro %} {%- macro switch_lang(lang, builtfile) -%} {# The 'pagename' variable = [subfolder]/filename-without-ext. URL starts with '/' is relative to the website root. #} {{ pathto('/' + lang + '/' + builtfile) }} {%- endmacro %} {%- macro simrofy_headlinks() -%} {%- set tocstr = toctree(titles_only=true, includehidden=true) | replace("href=", ">") | replace("", ";;") | striptags -%} {%- set headlinks = ''.join(tocstr.split(':')[1:]).strip(';;').split(';;') -%} {%- for item in headlinks -%} {% set plink = item.split('>')[0] | trim | trim('"') %} {% set ptitle = item.split('>')[1] %} {%- if plink != "#" and (not theme_headbar_links) or plink|replace(".html", "") in theme_headbar_links %} {{ ptitle }} {%- endif %} {%- endfor -%} {%- endmacro -%} {%- macro simrofy_sidebar() %} {%- if theme_sidebar_position in ['right', 'left'] %}
{%- endif %} {% endmacro %} {%- macro simrofy_photos() -%} {% for group, people in theme_people.items() %}
|
{{ person|e }} {% for key, val in personinfo.items() if key != 'photo' %}{{- print_unicode_icon(key) }} {{- val|e if key != 'email' else val|replace('@', ':at:')|e }} {% endfor %} |
{%- if loop.index is divisibleby(2) or loop.last %}