Skip to content

Commit

Permalink
静态文件写死在目录里
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengshanshan committed May 29, 2024
1 parent 4f35cd3 commit af08b10
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v3

- name: Install Requirements.
run: pip3 install sphinx==5.3.0 sphinx_multiversion sphinx_rtd_theme myst-parser
run: pip3 install sphinx==5.3.0 sphinx_multiversion sphinxcontrib-mermaid myst-parser

- name: Build
run: |
Expand Down
18 changes: 2 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ SPHINXBUILD ?= sphinx-build
SPHINXMULTIVERSION ?= sphinx-multiversion
SOURCEDIR = source
BUILDDIR = build
WEB_DOCS_BUILDER_URL ?= https://ai.b-bug.org/~zhengshanshan/web-docs-builder

# Put it first so that "make" without argument is like "make help".
help:
Expand All @@ -20,25 +19,12 @@ help:

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile $(SOURCEDIR)/_templates/versionsFlex.html $(SOURCEDIR)/_static/topbar.css $(SOURCEDIR)/_static/custom-theme.css $(SOURCEDIR)/_static/init_mermaid.js
%:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

mhtml: Makefile $(SOURCEDIR)/_templates/versionsFlex.html $(SOURCEDIR)/_static/topbar.css $(SOURCEDIR)/_static/custom-theme.css $(SOURCEDIR)/_static/init_mermaid.js
mhtml:
@$(SPHINXMULTIVERSION) "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

_templates:
mkdir -p $(SOURCEDIR)/_templates

$(SOURCEDIR)/_templates/versionsFlex.html:
wget $(WEB_DOCS_BUILDER_URL)/_templates/$(@F) -O $@

$(SOURCEDIR)/_static/topbar.css:
wget $(WEB_DOCS_BUILDER_URL)/_static/$(@F) -O $@

$(SOURCEDIR)/_static/custom-theme.css:
wget $(WEB_DOCS_BUILDER_URL)/_static/$(@F) -O $@

$(SOURCEDIR)/_static/init_mermaid.js:
wget $(WEB_DOCS_BUILDER_URL)/_static/$(@F) -O $@


52 changes: 52 additions & 0 deletions source/_static/custom-theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
nav.bd-links li>a:active, .logo__title:hover, nav.bd-links li>a:hover {
text-decoration: none;
}
html[data-theme=light] {
--pst-color-primary: #4d8eef;
--pst-color-primary-highlight: #2d0ef1;
--sd-color-primary: var(--pst-color-primary);
--sd-color-primary-text: var(--pst-color-primary-text);
--sd-color-primary-highlight: var(--pst-color-primary-highlight);
--sd-color-primary-bg: #547fca;
--sd-color-primary-bg-text: #14181e;

--pst-color-secondary: #4d8eef;
--pst-color-secondary-highlight: #2d0ef1;
--sd-color-secondary: var(--pst-color-secondary);
--sd-color-secondary-text: var(--pst-color-secondary-text);
--sd-color-secondary-highlight: var(--pst-color-secondary-highlight);
--sd-color-secondary-bg: #547fca;
--pst-color-primary-bg: #84baf4;
--pst-color-secondary-bg: #547fca;
--pst-color-accent: #4d8eef;
--pst-color-accent-bg: #92abd0;
}
.bd-sidebar-primary {
/* 使元素可滚动 */
overflow-y: scroll; /* 垂直滚动条 */
overflow-x: hidden; /* 隐藏水平滚动条,如果不需要的话 */

/* 隐藏滚动条但保持滚动功能 */
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* Internet Explorer 和 Edge */
}

.bd-sidebar-primary::-webkit-scrollbar {
display: none; /* 隐藏滚动条 */
}
.bd-sidebar-primary label.toctree-toggle {
height: 20px;
width: 20px;
opacity: 0.8;
}
.navbar-brand:hover:hover, .navbar-brand:visited:hover:hover {
text-decoration: none !important;
}
.bd-sidebar-primary label.toctree-toggle {
height: 20px;
width: 20px;
}
cite {
font-style: normal;
}

70 changes: 0 additions & 70 deletions source/_static/custom.css

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<style>
.rst-versions {
position: fixed;
bottom: 0px;
left: 0;
color: #100e0e;
background: #eaebec;
font-family: Lato, proxima-nova, Helvetica Neue, Arial, sans-serif;
z-index: 400;
width: 100%;
}
.rst-versions.shift-up {
height: auto;
Expand Down Expand Up @@ -97,16 +95,6 @@
</div>
{%- endif %}
<script>
var bdconLeft = document.querySelector('.bd-container__inner').offsetLeft;
var parentWidth = document.querySelector('.bd-sidebar').offsetWidth;
document.querySelector('.rst-versions').style.width = parentWidth + 'px';
document.querySelector('.rst-versions').style.left = bdconLeft + 'px';
window.addEventListener('resize', function() {
var bdconLeft = document.querySelector('.bd-container__inner').offsetLeft;
var parentWidth = document.querySelector('.bd-sidebar').offsetWidth;
document.querySelector('.rst-versions').style.width = parentWidth + 'px';
document.querySelector('.rst-versions').style.left = bdconLeft + 'px';
});
document.querySelector('.rst-versions').addEventListener('click', function() {
var details = document.querySelector('.rst-versions');
details.classList.toggle('shift-up');
Expand Down

0 comments on commit af08b10

Please sign in to comment.