Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/QuantumBFS/Yao.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo committed Jun 28, 2021
2 parents 64a5f56 + f3cd54f commit 9144626
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
version:
- '1.5'
- '1'
- 'nightly'
os:
- ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ docs/build/
docs/site/
docs/Manifest.toml
docs/src/examples/*.md
docs/src/assets/themes/indigo.css

*.ipynb_checkpoints
**/*.ipynb_checkpoints
Expand All @@ -17,4 +18,4 @@ _*.dat
*.swp
__pycache__/

Manifest.toml
Manifest.toml
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ YaoSym = "3b27209a-d3d6-11e9-3c0f-41eb92b2cb9d"

[compat]
BitBasis = "0.7"
Reexport = "0.2, 1.0"
Reexport = "1"
YaoArrayRegister = "0.7"
YaoBase = "0.14"
YaoBlocks = "0.11"
Expand Down
134 changes: 52 additions & 82 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,82 +7,9 @@ using YaoBlocks: Optimise
using Documenter.Writers.HTMLWriter
using Documenter.Utilities.DOM
using Documenter.Utilities.DOM: Tag, @tags
# Evil Prirate

const base_url = raw"https://yaoquantum.org"

const top_nav = """
<div id="top" class="navbar-wrapper">
<nav class="navbar fixed-top navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="$base_url">
<img src="$base_url/assets/images/logo-light.png">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="$base_url/tutorials/dev">Tutorial</a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">Documentation<span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="$base_url/benchmark">Benchmark</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://yaoquantum.org/soc">SoC</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://yaoquantum.org/research">Research</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/QuantumBFS/Yao.jl">GitHub</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/QuantumBFS/Yao.jl/blob/master/CONTRIBUTING.md">Contribute</a>
</li>
</ul>
</div>
</nav>
</div>
"""

function HTMLWriter.render_html(
ctx,
navnode,
head,
sidebar,
navbar,
article,
footer,
scripts::Vector{DOM.Node} = DOM.Node[],
)
@tags html body div
DOM.HTMLDocument(
html[:lang=>"en"](
head,
body(
Tag(Symbol("#RAW#"))(top_nav),
div[".documenter-wrapper#documenter"](
sidebar,
div[".docs-main"](navbar, article, footer),
HTMLWriter.render_settings(ctx),
),
),
scripts...,
),
)
end
#Venerable Inventor :)

download("yaoquantum.org/assets/logo-light.png", "docs/src/assets/logo.png")

const PAGES = [
"Home" => "index.md",
Expand All @@ -107,12 +34,8 @@ makedocs(
prettyurls = ("deploy" in ARGS),
canonical = ("deploy" in ARGS) ? "https://docs.yaoquantum.org/" : nothing,
assets = [
"assets/main.css",
asset("https://yaoquantum.org/assets/main.css"),
asset("http://yaoquantum.org/favicon.ico"),
asset(
"https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css",
),
"assets/themes/indigo.css",
asset("https://yaoquantum.org/assets/favicon-light.ico", class = :ico),
],
),
doctest = ("doctest=true" in ARGS),
Expand All @@ -122,4 +45,51 @@ makedocs(
pages = PAGES,
)

deploydocs(repo = "github.com/QuantumBFS/Yao.jl.git", target = "build")
x = []
for (root, dirs, files) in walkdir("docs/build")
global x = [x; joinpath.(root, files)] # files is a Vector{String}, can be empty
end

for i in x
if (endswith(i, ".html"))
y = read(i, String)
y = replace(
y,
"""<body><div id="documenter">""" =>
"""<body><div id="documenter"><div class="js-toc" style="right: 0;height: 0px;min-width: 25rem;z-index: 10;display: block;position: fixed; top: 0"></div>""",
)
y = replace(
y,
"""</head>""" =>
"""<link href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.11.1/tocbot.css" rel="stylesheet" type="text/css"/><style> .toc-list { padding-left: 20px; } @media only screen and (min-width: 1841px) { .docs-main { margin-left: 40rem !important } } @media only screen and (max-width: 1589px) { .js-toc { display: none !important; } } </style></head>""",
)
y = replace(
y,
"""</body>""" =>
"""<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.11.1/tocbot.min.js"></script><script>
tocbot.init({
// Where to render the table of contents.
tocSelector: '.js-toc',
// Where to grab the headings to build the table of contents.
contentSelector: '.js-toc-content',
// Which headings to grab inside of the contentSelector element.
headingSelector: 'h1, h2, h3, h4',
// For headings inside relative or absolute positioned containers within content.
hasInnerContainers: false,
orderedList: false,
});
</script></body>""",
)

y = replace(
y,
"""<div class="docs-main">""" =>
"""<div class="js-toc-content docs-main">""",
)
f = open(i, "w")
write(f, y)
close(f)
end
end

deploydocs(repo = "github.com/VarLad/Yao.jl.git", target = "build")
73 changes: 73 additions & 0 deletions docs/src/assets/themes/indigo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@font-face {
font-family: JuliaMono;
src: local("JuliaMono"), url("https://cdn.jsdelivr.net/gh/cormullion/juliamono/webfonts/JuliaMono-Regular.woff2"); }

html.theme--documenter-dark pre,
html.theme--documenter-dark code {
font-family: "JuliaMono"; }

html:not(.theme--documenter-dark) body #documenter a {
color: #4595D1; }

html:not(.theme--documenter-dark) body #documenter a:hover, html:not(.theme--documenter-dark) body #documenter a:focus {
color: #194E82; }

html:not(.theme--documenter-dark) body #documenter .docs-sidebar {
box-shadow: none;
color: #FFFFFF;
background-color: #2b5797; }
html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu {
border-top: none; }
html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu .tocitem:hover, html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu li.is-active .tocitem, html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu li.is-active .tocitem:hover, html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu li.is-active ul.internal .tocitem:hover {
color: #FFFFFF;
background-color: #4595D1; }
html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu .tocitem {
color: #FFFFFF;
background: none; }
html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu li.is-active {
border-top: none;
border-bottom: none; }
html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu li.is-active ul.internal {
margin: 0;
border-top: none; }
html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu li.is-active ul.internal li {
margin-top: 0; }
html:not(.theme--documenter-dark) body #documenter .docs-sidebar ul.docs-menu li.is-active ul.internal .tocitem {
color: #194E82;
background-color: #FFFFFF;
padding: 0.5em;
padding-left: 1em; }

html:not(.theme--documenter-dark) body #documenter article#documenter-page a.docs-heading-anchor {
color: #194E82; }

html:not(.theme--documenter-dark) body #documenter pre, html:not(.theme--documenter-dark) body #documenter code {
color: inherit;
font-family: "JuliaMono"; }
html:not(.theme--documenter-dark) body #documenter pre .hljs-meta, html:not(.theme--documenter-dark) body #documenter code .hljs-meta {
color: #4595D1; }
html:not(.theme--documenter-dark) body #documenter pre .hljs-keyword, html:not(.theme--documenter-dark) body #documenter code .hljs-keyword {
color: #194E82; }

.admonition.is-category-terminology {
background-color: #FFFEDD;
border-color: #FFEC8B; }
.admonition.is-category-terminology > .admonition-header {
background-color: #FFEC8B;
color: black; }
.admonition.is-category-terminology > .admonition-header:before {
content: "Terminology: ";
font-family: inherit;
font-weight: bold; }

html.theme--documenter-dark .admonition.is-category-terminology {
border-color: #FFEC8B; }

details {
padding-left: 1rem;
padding-right: 1rem;
padding-bottom: 1rem;
background: aliceblue; }

html.theme--documenter-dark details {
background: #282f2f; }

2 comments on commit 9144626

@Roger-luo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Released via Ion CLI
@JuliaRegistrator register

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/39811

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.4 -m "<description of version>" 9144626c854dc8d8f1722aa7e5f664a6e3bf43db
git push origin v0.6.4

Please sign in to comment.