Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Hetarth02 committed Aug 24, 2023
2 parents 724bd89 + e2bd194 commit bb1dbc4
Show file tree
Hide file tree
Showing 80 changed files with 2,953 additions and 19,146 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ jobs:
with:
version: '1'
- uses: julia-actions/cache@v1
- run: |
julia --project=test/examples -e '
using Pkg
Pkg.instantiate()
Pkg.develop(PackageSpec(path=pwd()))
Pkg.add(["IOCapture", "tectonic_jll"])'
- run: julia --project=test/examples --code-coverage test/examples/tests_latex.jl
- name: Instantiate Pkg environment
shell: julia --color=yes --project=test/examples {0}
run: |
using Pkg
Pkg.instantiate()
Pkg.develop(PackageSpec(path=pwd()))
Pkg.add(["IOCapture", "tectonic_jll"])
- name: Run test/examples/tests_latex.jl
run: julia --color=yes --project=test/examples --code-coverage test/examples/tests_latex.jl
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
Expand Down Expand Up @@ -171,3 +173,12 @@ jobs:
run: julia --color=yes --project=docs/ docs/instantiate.jl
- name: Build and check documentation
run: julia --color=yes --project=docs/ docs/make.jl linkcheck

prettier:
name: Prettier (JS code formatting)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actionsx/prettier@v2
with:
args: --check .
17 changes: 17 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Various build products
docs/build/
# Vendored theme stuff
assets/html/scss/highlightjs/
# And generated theme stuff
assets/html/themes/

# Tests contain a bunch of Markdown and such, so we'll just
# completely ignore it
test/

# Let's not format Markdown files for now
*.md
# Also the SCSS files, but we should format those eventually
*.scss
# And the GitHub workflows, but we should also format those eventually
.github/**/*.yml
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"tabWidth": 2
}
1,229 changes: 877 additions & 352 deletions CHANGELOG.md

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
JULIA:=julia

default: help

docs-instantiate:
${JULIA} docs/instantiate.jl

docs: docs-instantiate
${JULIA} --project=docs docs/make.jl

changelog:
${JULIA} docs/changelog.jl

themes: docs-instantiate
${JULIA} --project=docs -e 'using DocumenterTools; DocumenterTools.Themes.compile_native_themes()'

help:
@echo "The following make commands are available:"
@echo " - make changelog: update all links in CHANGELOG.md's footer"
@echo " - make docs: build the documentation"
@echo " - make test: run the tests"
@echo " - make themes: compile Documenter's native CSS themes"

.PHONY: default docs-instantiate themes help changelog docs test
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
MarkdownAST = "d0879d2d-cac2-40c8-9cee-1863dc0c7391"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
SnoopPrecompile = "66db9d55-30c0-4569-8b51-7e840670fc0c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

Expand All @@ -27,7 +27,7 @@ DocStringExtensions = "0.4, 0.5, 0.6, 0.7, 0.8, 0.9"
IOCapture = "0.2"
JSON = "0.19, 0.20, 0.21"
MarkdownAST = "0.1.1"
SnoopPrecompile = "1"
PrecompileTools = "1"
julia = "1.6"

[extras]
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

| **Documentation** | **Build Status** |
|:-------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------:|
| [![][docs-stable-img]][docs-stable-url] [![][docs-dev-img]][docs-dev-url] | [![][GHA-img]][GHA-url] [![][codecov-img]][codecov-url] |
| [![][docs-stable-img]][docs-stable-url] [![][docs-dev-img]][docs-dev-url] | [![][GHA-img]][GHA-url] [![][codecov-img]][codecov-url] [![PkgEval][pkgeval-img]][pkgeval-url] |


## Installation
Expand Down Expand Up @@ -78,3 +78,6 @@ Finally, there are also a few other packages in the Julia ecosystem that are sim
[codecov-url]: https://codecov.io/gh/JuliaDocs/Documenter.jl

[issues-url]: https://github.com/JuliaDocs/Documenter.jl/issues

[pkgeval-img]: https://juliaci.github.io/NanosoldierReports/pkgeval_badges/D/Documenter.svg
[pkgeval-url]: https://juliaci.github.io/NanosoldierReports/pkgeval_badges/D/Documenter.html
4 changes: 3 additions & 1 deletion assets/html/js/collapse.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ $(document).on("click", ".docstring header", function () {
articleToggleTitle = "Collapse docstring";
}

$(this).find(".docstring-article-toggle-button").prop("title", articleToggleTitle);
$(this)
.find(".docstring-article-toggle-button")
.prop("title", articleToggleTitle);
$(this).siblings("section").slideToggle();
});

Expand Down
8 changes: 4 additions & 4 deletions assets/html/js/headroom.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// Manages the top navigation bar (hides it when the user starts scrolling down on the
// mobile).
window.Headroom = Headroom; // work around buggy module loading?
$(document).ready(function() {
$('#documenter .docs-navbar').headroom({
"tolerance": {"up": 10, "down": 10},
$(document).ready(function () {
$("#documenter .docs-navbar").headroom({
tolerance: { up: 10, down: 10 },
});
})
});
16 changes: 8 additions & 8 deletions assets/html/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
// arguments: $

// Modal settings dialog
$(document).ready(function() {
var settings = $('#documenter-settings');
$('#documenter-settings-button').click(function(){
settings.toggleClass('is-active');
$(document).ready(function () {
var settings = $("#documenter-settings");
$("#documenter-settings-button").click(function () {
settings.toggleClass("is-active");
});
// Close the dialog if X is clicked
$('#documenter-settings button.delete').click(function(){
settings.removeClass('is-active');
$("#documenter-settings button.delete").click(function () {
settings.removeClass("is-active");
});
// Close dialog if ESC is pressed
$(document).keyup(function(e) {
if (e.keyCode == 27) settings.removeClass('is-active');
$(document).keyup(function (e) {
if (e.keyCode == 27) settings.removeClass("is-active");
});
});
106 changes: 94 additions & 12 deletions assets/html/js/shortcut.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,100 @@
let searchbox = document.querySelector("#documenter-search-query");
let sidebar = document.querySelector(".docs-sidebar");
// libraries: jquery
// arguments: $

let search_modal_header = `
<header class="modal-card-head gap-2 is-align-items-center is-justify-content-space-between w-100 px-3">
<div class="field mb-0 w-100">
<p class="control has-icons-right">
<input class="input documenter-search-input" type="text" placeholder="Search" />
<span class="icon is-small is-right has-text-primary-dark">
<i class="fas fa-magnifying-glass"></i>
</span>
</p>
</div>
<div class="icon is-size-4 is-clickable close-search-modal">
<i class="fas fa-times"></i>
</div>
</header>
`;

let initial_search_body = `
<div class="has-text-centered my-5 py-5">Type something to get started!</div>
`;

let search_modal_footer = `
<footer class="modal-card-foot">
<span>
<kbd class="search-modal-key-hints">Ctrl</kbd> +
<kbd class="search-modal-key-hints">/</kbd> to search
</span>
<span class="ml-3"> <kbd class="search-modal-key-hints">esc</kbd> to close </span>
</footer>
`;

$(document.body).append(
`
<div class="modal" id="search-modal">
<div class="modal-background"></div>
<div class="modal-card search-min-width-50 search-min-height-100 is-justify-content-center">
${search_modal_header}
<section class="modal-card-body is-flex is-flex-direction-column is-justify-content-center gap-4 search-modal-card-body">
${initial_search_body}
</section>
${search_modal_footer}
</div>
</div>
`
);

document.querySelector(".docs-search-query").addEventListener("click", () => {
openModal();
});

document.querySelector(".close-search-modal").addEventListener("click", () => {
closeModal();
});

$(document).on("click", ".search-result-link", function () {
closeModal();
});

document.addEventListener("keydown", (event) => {
if ((event.ctrlKey || event.metaKey) && event.key === "/") {
if (!sidebar.classList.contains("visible")) {
sidebar.classList.add("visible");
}
searchbox.focus();
return false;
openModal();
} else if (event.key === "Escape") {
if (sidebar.classList.contains("visible")) {
sidebar.classList.remove("visible");
}
searchbox.blur();
return false;
closeModal();
}

return false;
});

// Functions to open and close a modal
function openModal() {
let searchModal = document.querySelector("#search-modal");

searchModal.classList.add("is-active");
document.querySelector(".documenter-search-input").focus();
}

function closeModal() {
let searchModal = document.querySelector("#search-modal");
let initial_search_body = `
<div class="has-text-centered my-5 py-5">Type something to get started!</div>
`;

searchModal.classList.remove("is-active");
document.querySelector(".documenter-search-input").blur();

if (!$(".search-modal-card-body").hasClass("is-justify-content-center")) {
$(".search-modal-card-body").addClass("is-justify-content-center");
}

$(".documenter-search-input").val("");
$(".search-modal-card-body").html(initial_search_body);
}

document
.querySelector("#search-modal .modal-background")
.addEventListener("click", () => {
closeModal();
});
36 changes: 18 additions & 18 deletions assets/html/js/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,51 @@
// arguments: $

// Manages the showing and hiding of the sidebar.
$(document).ready(function() {
$(document).ready(function () {
var sidebar = $("#documenter > .docs-sidebar");
var sidebar_button = $("#documenter-sidebar-button")
sidebar_button.click(function(ev) {
var sidebar_button = $("#documenter-sidebar-button");
sidebar_button.click(function (ev) {
ev.preventDefault();
sidebar.toggleClass('visible');
if (sidebar.hasClass('visible')) {
sidebar.toggleClass("visible");
if (sidebar.hasClass("visible")) {
// Makes sure that the current menu item is visible in the sidebar.
$("#documenter .docs-menu a.is-active").focus();
}
});
$("#documenter > .docs-main").bind('click', function(ev) {
$("#documenter > .docs-main").bind("click", function (ev) {
if ($(ev.target).is(sidebar_button)) {
return;
}
if (sidebar.hasClass('visible')) {
sidebar.removeClass('visible');
if (sidebar.hasClass("visible")) {
sidebar.removeClass("visible");
}
});
})
});

// Resizes the package name / sitename in the sidebar if it is too wide.
// Inspired by: https://github.com/davatron5000/FitText.js
$(document).ready(function() {
$(document).ready(function () {
e = $("#documenter .docs-autofit");
function resize() {
var L = parseInt(e.css('max-width'), 10);
var L = parseInt(e.css("max-width"), 10);
var L0 = e.width();
if(L0 > L) {
var h0 = parseInt(e.css('font-size'), 10);
e.css('font-size', L * h0 / L0);
if (L0 > L) {
var h0 = parseInt(e.css("font-size"), 10);
e.css("font-size", (L * h0) / L0);
// TODO: make sure it survives resizes?
}
}
// call once and then register events
resize();
$(window).resize(resize);
$(window).on('orientationchange', resize);
$(window).on("orientationchange", resize);
});

// Scroll the navigation bar to the currently selected menu item
$(document).ready(function() {
$(document).ready(function () {
var sidebar = $("#documenter .docs-menu").get(0);
var active = $("#documenter .docs-menu .is-active").get(0);
if(typeof active !== 'undefined') {
if (typeof active !== "undefined") {
sidebar.scrollTop = active.offsetTop - sidebar.offsetTop - 15;
}
})
});
26 changes: 13 additions & 13 deletions assets/html/js/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@
// arguments: $

// Theme picker setup
$(document).ready(function() {
$(document).ready(function () {
// onchange callback
$('#documenter-themepicker').change(function themepick_callback(ev){
var themename = $('#documenter-themepicker option:selected').attr('value');
if (themename === 'auto') {
$("#documenter-themepicker").change(function themepick_callback(ev) {
var themename = $("#documenter-themepicker option:selected").attr("value");
if (themename === "auto") {
// set_theme(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
window.localStorage.removeItem('documenter-theme');
window.localStorage.removeItem("documenter-theme");
} else {
// set_theme(themename);
window.localStorage.setItem('documenter-theme', themename);
window.localStorage.setItem("documenter-theme", themename);
}
// We re-use the global function from themeswap.js to actually do the swapping.
set_theme_from_local_storage();
});

// Make sure that the themepicker displays the correct theme when the theme is retrieved
// from localStorage
if(typeof(window.localStorage) !== "undefined") {
var theme = window.localStorage.getItem("documenter-theme");
if(theme !== null) {
$('#documenter-themepicker option').each(function(i,e) {
e.selected = (e.value === theme);
})
if (typeof window.localStorage !== "undefined") {
var theme = window.localStorage.getItem("documenter-theme");
if (theme !== null) {
$("#documenter-themepicker option").each(function (i, e) {
e.selected = e.value === theme;
});
}
}
})
});
Loading

0 comments on commit bb1dbc4

Please sign in to comment.