From 7cbda0153cae3f2cd513254fa7c5fc7d5cf9ce73 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Sun, 18 Aug 2024 05:20:59 -0700 Subject: [PATCH 1/3] switch to mdbook for docs > [!tip] > See also [mdbook docs](https://rust-lang.github.io/mdBook/index.html) This is pretty customized. The CLI doc is still generated from rust. The doc's site ToC is altered via JS on page load to show the page's ToC. I also renamed some CI workflows to reduce the badges' visual noise (in README). --- .github/workflows/binary-builds.yml | 2 +- .github/workflows/build-docs.yml | 30 +- .github/workflows/python-packaging.yml | 2 +- .gitignore | 2 + Cargo.lock | 1318 ++++++++++++++++- Cargo.toml | 4 +- README.md | 2 +- cpp-linter-lib/examples/cli_doc.rs | 66 - cpp-linter-lib/src/cli.rs | 132 +- cpp-linter-lib/src/common_fs/file_filter.rs | 4 +- cpp-linter-py/docs/_static/extra_css.css | 11 - cpp-linter-py/docs/_static/favicon.ico | Bin 165662 -> 0 bytes cpp-linter-py/docs/conf.py | 85 -- cpp-linter-py/docs/index.rst | 48 - cpp-linter-py/docs/requirements.txt | 1 - cspell.config.yml | 3 + docs/Cargo.toml | 18 + docs/README.md | 20 + docs/book.toml | 36 + docs/src/SUMMARY.md | 6 + docs/src/cli.md | 16 + docs/src/index.md | 4 + docs/src/main.rs | 196 +++ .../logo.png => docs/theme/favicon.png | Bin docs/theme/pagetoc.css | 52 + docs/theme/pagetoc.js | 72 + 26 files changed, 1747 insertions(+), 383 deletions(-) delete mode 100644 cpp-linter-lib/examples/cli_doc.rs delete mode 100644 cpp-linter-py/docs/_static/extra_css.css delete mode 100644 cpp-linter-py/docs/_static/favicon.ico delete mode 100644 cpp-linter-py/docs/conf.py delete mode 100644 cpp-linter-py/docs/index.rst delete mode 100644 cpp-linter-py/docs/requirements.txt create mode 100644 docs/Cargo.toml create mode 100644 docs/README.md create mode 100644 docs/book.toml create mode 100644 docs/src/SUMMARY.md create mode 100644 docs/src/cli.md create mode 100644 docs/src/index.md create mode 100644 docs/src/main.rs rename cpp-linter-py/docs/_static/logo.png => docs/theme/favicon.png (100%) create mode 100644 docs/theme/pagetoc.css create mode 100644 docs/theme/pagetoc.js diff --git a/.github/workflows/binary-builds.yml b/.github/workflows/binary-builds.yml index c6c038f..b40f72a 100644 --- a/.github/workflows/binary-builds.yml +++ b/.github/workflows/binary-builds.yml @@ -1,4 +1,4 @@ -name: Binary executable builds +name: Binary builds permissions: contents: read diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index fc50eae..cb7260b 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -18,44 +18,38 @@ jobs: key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} - run: cargo fetch - build-sphinx: + build-mdbook: runs-on: ubuntu-latest needs: [cache-deps] permissions: contents: write steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: 3.x - - - name: Install dependencies - working-directory: cpp-linter-py - run: pip install -r docs/requirements.txt - - name: Cache .cargo locked resources uses: actions/cache/restore@v4 with: path: ~/.cargo key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} - - - name: Build docs - working-directory: cpp-linter-py - run: sphinx-build docs docs/_build/html - + - name: Install mdbook + uses: taiki-e/install-action@v2 + with: + tool: mdbook,cargo-binstall + - name: Install mdbook plugins + run: cargo binstall -y mdbook-alerts + - name: Build book + run: mdbook build docs - name: Upload docs build as artifact uses: actions/upload-artifact@v4 with: - name: cpp-linter-py_docs - path: cpp-linter-py/docs/_build/html - + name: cpp-linter-docs + path: docs/book/html - name: Upload to github pages # only publish doc changes from main branch if: github.ref == 'refs/heads/main' uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: cpp-linter-py/docs/_build/html + publish_dir: docs/book/html build-rustdoc: runs-on: ubuntu-latest diff --git a/.github/workflows/python-packaging.yml b/.github/workflows/python-packaging.yml index 2c82c23..63963ad 100644 --- a/.github/workflows/python-packaging.yml +++ b/.github/workflows/python-packaging.yml @@ -1,4 +1,4 @@ -name: Python packaging +name: Python builds on: push: diff --git a/.gitignore b/.gitignore index 20432c6..2dbfc96 100644 --- a/.gitignore +++ b/.gitignore @@ -193,6 +193,8 @@ debug/ # ignore vscode stuff .vscode/ +# mdbook builds +book # ignore generated files .cpp-linter_cache/ diff --git a/Cargo.lock b/Cargo.lock index 77f683d..417f4af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,34 @@ dependencies = [ "memchr", ] +[[package]] +name = "ammonia" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab99eae5ee58501ab236beb6f20f6ca39be615267b014899c89b2f0bc18a459" +dependencies = [ + "html5ever", + "maplit", + "once_cell", + "tendril", + "url", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.6.13" @@ -74,6 +102,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "anyhow" +version = "1.0.86" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" + [[package]] name = "atomic-waker" version = "1.1.2" @@ -101,6 +135,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" @@ -119,12 +159,38 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + [[package]] name = "bumpalo" version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.5.0" @@ -147,6 +213,18 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "windows-targets 0.52.6", +] + [[package]] name = "clap" version = "4.5.16" @@ -166,6 +244,16 @@ dependencies = [ "anstyle", "clap_lex", "strsim", + "terminal_size", +] + +[[package]] +name = "clap_complete" +version = "4.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ee158892bd7ce77aa15c208abbdb73e155d191c287a659b57abd5adb92feb03" +dependencies = [ + "clap", ] [[package]] @@ -174,6 +262,17 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +[[package]] +name = "cli-gen" +version = "2.0.0" +dependencies = [ + "clap", + "cpp-linter-lib", + "mdbook", + "semver", + "serde_json", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -228,12 +327,104 @@ dependencies = [ "tokio", ] +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + +[[package]] +name = "dbus" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bb21987b9fb1613058ba3843121dd18b163b254d8a6e797e144cbac14d96d1b" +dependencies = [ + "libc", + "libdbus-sys", + "winapi", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + [[package]] name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "elasticlunr-rs" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41e83863a500656dfa214fee6682de9c5b9f03de6860fec531235ed2ae9f6571" +dependencies = [ + "regex", + "serde", + "serde_derive", + "serde_json", +] + [[package]] name = "encoding_rs" version = "0.8.33" @@ -243,6 +434,29 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "env_filter" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" +dependencies = [ + "log", + "regex", +] + +[[package]] +name = "env_logger" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" +dependencies = [ + "anstream", + "anstyle", + "env_filter", + "humantime", + "log", +] + [[package]] name = "equivalent" version = "1.0.1" @@ -265,6 +479,18 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +[[package]] +name = "filetime" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" +dependencies = [ + "cfg-if", + "libc", + "libredox", + "windows-sys 0.59.0", +] + [[package]] name = "fnv" version = "1.0.7" @@ -295,6 +521,25 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "fsevent-sys" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76ee7a02da4d231650c7cea31349b889be2f45ddb3ef3032d2ec8185f6313fd2" +dependencies = [ + "libc", +] + +[[package]] +name = "futf" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df420e2e84819663797d1ec6544b13c5be84629e7bb00dc960d6917db2987843" +dependencies = [ + "mac", + "new_debug_unreachable", +] + [[package]] name = "futures-channel" version = "0.3.30" @@ -302,6 +547,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -310,6 +556,17 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +[[package]] +name = "futures-macro" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "futures-sink" version = "0.3.30" @@ -329,9 +586,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", + "futures-macro", + "futures-sink", "futures-task", "pin-project-lite", "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", ] [[package]] @@ -366,6 +636,38 @@ dependencies = [ "url", ] +[[package]] +name = "globset" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "h2" version = "0.4.5" @@ -377,7 +679,7 @@ dependencies = [ "fnv", "futures-core", "futures-sink", - "http", + "http 1.1.0", "indexmap", "slab", "tokio", @@ -385,12 +687,50 @@ dependencies = [ "tracing", ] +[[package]] +name = "handlebars" +version = "5.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d08485b96a0e6393e9e4d1b8d48cf74ad6c063cd905eb33f42c1ce3f0377539b" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +[[package]] +name = "headers" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" +dependencies = [ + "base64 0.21.7", + "bytes", + "headers-core", + "http 0.2.12", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http 0.2.12", +] + [[package]] name = "heck" version = "0.5.0" @@ -412,6 +752,31 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "html5ever" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c13771afe0e6e846f1e67d038d4cb29998a6779f93c809212e4e9c32efd244d4" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http" version = "1.1.0" @@ -423,6 +788,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http 0.2.12", + "pin-project-lite", +] + [[package]] name = "http-body" version = "1.0.1" @@ -430,7 +806,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http", + "http 1.1.0", ] [[package]] @@ -441,8 +817,8 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http", - "http-body", + "http 1.1.0", + "http-body 1.0.1", "pin-project-lite", ] @@ -452,35 +828,71 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" -version = "1.4.1" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", + "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.3.26", + "http 0.2.12", + "http-body 0.4.6", "httparse", + "httpdate", "itoa", "pin-project-lite", - "smallvec", + "socket2", "tokio", + "tower-service", + "tracing", "want", ] [[package]] -name = "hyper-rustls" +name = "hyper" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.1", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", - "http", - "hyper", + "http 1.1.0", + "hyper 1.4.1", "hyper-util", "rustls", "rustls-pki-types", @@ -497,7 +909,7 @@ checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", "http-body-util", - "hyper", + "hyper 1.4.1", "hyper-util", "native-tls", "tokio", @@ -514,9 +926,9 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http", - "http-body", - "hyper", + "http 1.1.0", + "http-body 1.0.1", + "hyper 1.4.1", "pin-project-lite", "socket2", "tokio", @@ -525,6 +937,29 @@ dependencies = [ "tracing", ] +[[package]] +name = "iana-time-zone" +version = "0.1.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "idna" version = "0.5.0" @@ -535,6 +970,22 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "ignore" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b46810df39e66e925525d6e38ce1e7f6e1d208f72dc39757880fcb66e2c58af1" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + [[package]] name = "indexmap" version = "2.1.0" @@ -551,6 +1002,26 @@ version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" +[[package]] +name = "inotify" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" +dependencies = [ + "bitflags 1.3.2", + "inotify-sys", + "libc", +] + +[[package]] +name = "inotify-sys" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" +dependencies = [ + "libc", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -581,6 +1052,26 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "kqueue" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" +dependencies = [ + "kqueue-sys", + "libc", +] + +[[package]] +name = "kqueue-sys" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" +dependencies = [ + "bitflags 1.3.2", + "libc", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -622,6 +1113,16 @@ version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +[[package]] +name = "libdbus-sys" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06085512b750d640299b79be4bad3d2fa90a9c00b1fd9e1b46364f66f0485c72" +dependencies = [ + "cc", + "pkg-config", +] + [[package]] name = "libgit2-sys" version = "0.17.0+1.8.1" @@ -636,6 +1137,17 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.4.1", + "libc", + "redox_syscall 0.5.3", +] + [[package]] name = "libssh2-sys" version = "0.3.0" @@ -668,12 +1180,84 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + +[[package]] +name = "markup5ever" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16ce3abbeba692c8b8441d036ef91aea6df8da2c6b6e21c7e14d3c18e526be45" +dependencies = [ + "log", + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "mdbook" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b45a38e19bd200220ef07c892b0157ad3d2365e5b5a267ca01ad12182491eea5" +dependencies = [ + "ammonia", + "anyhow", + "chrono", + "clap", + "clap_complete", + "elasticlunr-rs", + "env_logger", + "futures-util", + "handlebars", + "ignore", + "log", + "memchr", + "notify", + "notify-debouncer-mini", + "once_cell", + "opener", + "pathdiff", + "pulldown-cmark", + "regex", + "serde", + "serde_json", + "shlex", + "tempfile", + "tokio", + "toml", + "topological-sort", + "walkdir", + "warp", +] + [[package]] name = "memchr" version = "2.7.1" @@ -695,6 +1279,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -704,6 +1298,18 @@ dependencies = [ "adler", ] +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "mio" version = "1.0.2" @@ -734,6 +1340,60 @@ dependencies = [ "tempfile", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "normpath" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8911957c4b1549ac0dc74e30db9c8b0e66ddcd6d7acc33098f4c63a64a6d7ed" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "notify" +version = "6.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" +dependencies = [ + "bitflags 2.4.1", + "crossbeam-channel", + "filetime", + "fsevent-sys", + "inotify", + "kqueue", + "libc", + "log", + "mio 0.8.11", + "walkdir", + "windows-sys 0.48.0", +] + +[[package]] +name = "notify-debouncer-mini" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d40b221972a1fc5ef4d858a2f671fb34c75983eb385463dff3780eeff6a9d43" +dependencies = [ + "crossbeam-channel", + "log", + "notify", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "object" version = "0.32.2" @@ -749,6 +1409,18 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "opener" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0812e5e4df08da354c851a3376fead46db31c2214f849d3de356d774d057681" +dependencies = [ + "bstr", + "dbus", + "normpath", + "windows-sys 0.59.0", +] + [[package]] name = "openssl" version = "0.10.66" @@ -765,49 +1437,180 @@ dependencies = [ ] [[package]] -name = "openssl-macros" -version = "0.1.1" +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-src" +version = "300.2.1+3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fe476c29791a5ca0d1273c697e96085bbabbbea2ef7afd5617e78a4b40332d3" +dependencies = [ + "cc", +] + +[[package]] +name = "openssl-sys" +version = "0.9.103" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +dependencies = [ + "cc", + "libc", + "openssl-src", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall 0.5.3", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.7.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" +dependencies = [ + "once_cell", + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_shared 0.11.2", +] + +[[package]] +name = "phf_codegen" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +checksum = "e8d39688d359e6b34654d328e262234662d16cc0f60ec8dcbe5e718709342a5a" dependencies = [ - "proc-macro2", - "quote", - "syn", + "phf_generator 0.11.2", + "phf_shared 0.11.2", ] [[package]] -name = "openssl-probe" -version = "0.1.5" +name = "phf_generator" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand", +] [[package]] -name = "openssl-src" -version = "300.2.1+3.2.0" +name = "phf_generator" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fe476c29791a5ca0d1273c697e96085bbabbbea2ef7afd5617e78a4b40332d3" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "cc", + "phf_shared 0.11.2", + "rand", ] [[package]] -name = "openssl-sys" -version = "0.9.103" +name = "phf_shared" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" dependencies = [ - "cc", - "libc", - "openssl-src", - "pkg-config", - "vcpkg", + "siphasher", ] [[package]] -name = "percent-encoding" -version = "2.3.1" +name = "phf_shared" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] [[package]] name = "pin-project" @@ -853,6 +1656,21 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da544ee218f0d287a911e9c99a39a8c9bc8fcad3cb8db5959940044ecfc67265" +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "proc-macro2" version = "1.0.86" @@ -862,6 +1680,24 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "pulldown-cmark" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76979bea66e7875e7509c4ec5300112b316af87fa7a252ca91c448b32dfe3993" +dependencies = [ + "bitflags 2.4.1", + "memchr", + "pulldown-cmark-escape", + "unicase", +] + +[[package]] +name = "pulldown-cmark-escape" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd348ff538bc9caeda7ee8cad2d1d48236a1f443c1fa3913c6a02fe0043b1dd3" + [[package]] name = "pyo3" version = "0.22.2" @@ -934,6 +1770,36 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + [[package]] name = "redox_syscall" version = "0.4.1" @@ -943,6 +1809,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" +dependencies = [ + "bitflags 2.4.1", +] + [[package]] name = "regex" version = "1.10.6" @@ -978,16 +1853,16 @@ version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "encoding_rs", "futures-core", "futures-util", - "h2", - "http", - "http-body", + "h2 0.4.5", + "http 1.1.0", + "http-body 1.0.1", "http-body-util", - "hyper", + "hyper 1.4.1", "hyper-rustls", "hyper-tls", "hyper-util", @@ -1068,7 +1943,7 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ - "base64", + "base64 0.22.1", "rustls-pki-types", ] @@ -1095,6 +1970,15 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" version = "0.1.23" @@ -1104,6 +1988,18 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "security-framework" version = "2.9.2" @@ -1189,6 +2085,40 @@ dependencies = [ "serde", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + [[package]] name = "slab" version = "0.4.9" @@ -1220,6 +2150,32 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +[[package]] +name = "string_cache" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared 0.10.0", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro2", + "quote", +] + [[package]] name = "strsim" version = "0.11.1" @@ -1284,11 +2240,32 @@ checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "redox_syscall 0.4.1", "rustix", "windows-sys 0.52.0", ] +[[package]] +name = "tendril" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24a120c5fc464a3458240ee02c299ebcb9d67b5249c8848b09d639dca8d7bb0" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "thiserror" version = "1.0.56" @@ -1333,7 +2310,7 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio", + "mio 1.0.2", "pin-project-lite", "socket2", "tokio-macros", @@ -1383,6 +2360,18 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite", +] + [[package]] name = "tokio-util" version = "0.7.10" @@ -1397,6 +2386,21 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + +[[package]] +name = "topological-sort" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" + [[package]] name = "tower" version = "0.4.13" @@ -1430,6 +2434,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-core", ] @@ -1449,6 +2454,46 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 1.1.0", + "httparse", + "log", + "rand", + "sha1", + "thiserror", + "url", + "utf-8", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + [[package]] name = "unicode-bidi" version = "0.3.14" @@ -1493,6 +2538,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf8parse" version = "0.2.1" @@ -1505,6 +2556,22 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -1514,6 +2581,34 @@ dependencies = [ "try-lock", ] +[[package]] +name = "warp" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378d202ff965b011c64817db11d5829506d3404edeadb61f190d111da3f231c" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "headers", + "http 0.2.12", + "hyper 0.14.30", + "log", + "mime", + "mime_guess", + "percent-encoding", + "pin-project", + "scoped-tls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-tungstenite", + "tokio-util", + "tower-service", + "tracing", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1608,6 +2703,46 @@ dependencies = [ "winsafe", ] +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -1623,7 +2758,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -1643,17 +2787,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -1664,9 +2809,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -1676,9 +2821,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -1688,9 +2833,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -1700,9 +2851,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -1712,9 +2863,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -1724,9 +2875,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -1736,9 +2887,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winreg" @@ -1762,6 +2913,27 @@ version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zeroize" version = "1.8.1" diff --git a/Cargo.toml b/Cargo.toml index 180fd36..c11f154 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [workspace] -members = ["cpp-linter-lib", "cpp-linter-py"] +members = ["cpp-linter-lib", "cpp-linter-py", "docs"] resolver = "2" [workspace.package] @@ -11,4 +11,4 @@ authors = [ "Peter Shen", ] description = "Run clang-format and clang-tidy on a batch of files." -documentation = "https://example.com/bar" +documentation = "https://cpp-linter.github.io/cpp_linter_rs" diff --git a/README.md b/README.md index ab6d959..6ba17bc 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ For usage in a CI workflow, see [the cpp-linter/cpp-linter-action repository](https://github.com/cpp-linter/cpp-linter-action). For the description of supported Command Line Interface options, see -[the CLI documentation](https://cpp-linter.github.io/cpp_linter_rs/cli_args.html). +[the CLI documentation](https://cpp-linter.github.io/cpp_linter_rs/cli.html). ## Have question or feedback? diff --git a/cpp-linter-lib/examples/cli_doc.rs b/cpp-linter-lib/examples/cli_doc.rs deleted file mode 100644 index a5788ad..0000000 --- a/cpp-linter-lib/examples/cli_doc.rs +++ /dev/null @@ -1,66 +0,0 @@ -use std::{fs::OpenOptions, io::Write}; - -use cpp_linter_lib::cli; - -pub fn main() -> std::io::Result<()> { - let command = cli::get_arg_parser(); - let doc_file = OpenOptions::new() - .truncate(true) - .create(true) - .write(true) - .open("cpp-linter-py/docs/cli_args.rst")?; - let title = "Command Line Interface".to_string(); - writeln!(&doc_file, "\n{}", &title)?; - for _ in title.chars() { - write!(&doc_file, "=")?; - } - write!(&doc_file, "\n\n")?; - writeln!(&doc_file, "Commands\n--------\n")?; - for cmd in command.get_subcommands() { - writeln!(&doc_file, ".. std:option:: {}\n", cmd.get_name())?; - for line in cmd.get_about().unwrap().to_string().split('\n') { - writeln!(&doc_file, " {}", &line)?; - } - writeln!(&doc_file)?; - } - for group in command.get_groups() { - writeln!(&doc_file, "\n{}", group.get_id())?; - for _ in group.get_id().to_string().chars() { - write!(&doc_file, "-")?; - } - write!(&doc_file, "\n\n")?; - for arg_id in group.get_args() { - let mut arg_match = command.get_arguments().filter(|a| *a.get_id() == *arg_id); - let arg = arg_match.next().unwrap_or_else(|| { - panic!( - "arg {} expected in group {}", - arg_id.as_str(), - group.get_id().as_str() - ) - }); - writeln!( - &doc_file, - ".. std:option:: -{}, --{}\n", - &arg.get_short().unwrap(), - &arg.get_long().unwrap() - )?; - for line in arg.get_long_help().unwrap().to_string().split('\n') { - writeln!(&doc_file, " {}", &line)?; - } - writeln!(&doc_file)?; - let default = arg.get_default_values(); - if !default.is_empty() { - writeln!(&doc_file, " :Default:")?; - if default.len() < 2 { - writeln!(&doc_file, " ``{:?}``", default.first().unwrap())?; - } else { - for val in default { - writeln!(&doc_file, " - ``{:?}``", val)?; - } - } - } - } - } - println!("cpp-linter-py/docs/cli_args.rst generated!"); - Ok(()) -} diff --git a/cpp-linter-lib/src/cli.rs b/cpp-linter-lib/src/cli.rs index e142f5f..745fbd5 100644 --- a/cpp-linter-lib/src/cli.rs +++ b/cpp-linter-lib/src/cli.rs @@ -30,10 +30,8 @@ pub fn get_arg_parser() -> Command { .value_parser(["debug", "info"]) .long_help( "This controls the action's verbosity in the workflow's logs. -Supported options are defined by the `logging-level `_. This option does not affect the verbosity of resulting -thread comments or file annotations. -", +thread comments or file annotations.", ), ) .arg( @@ -44,11 +42,11 @@ thread comments or file annotations. .long_help( "The path that is used to read a compile command database. For example, it can be a CMake build directory in which a file named -compile_commands.json exists (set ``CMAKE_EXPORT_COMPILE_COMMANDS`` to ``ON``). +compile_commands.json exists (set `CMAKE_EXPORT_COMPILE_COMMANDS` to `ON`). When no build path is specified, a search for compile_commands.json will be -attempted through all parent paths of the first input file. See -https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html for an -example of setting up Clang Tooling on a source tree.", +attempted through all parent paths of the first input file. See [LLVM docs about +setup tooling](https://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) +for an example of setting up Clang Tooling on a source tree.", )) .arg( Arg::new("style") @@ -59,11 +57,10 @@ example of setting up Clang Tooling on a source tree.", .long_help( "The style rules to use. -- Set this to ``file`` to have clang-format use the closest relative +- Set this to `file` to have clang-format use the closest relative .clang-format file. -- Set this to a blank string (``''``) to disable using clang-format - entirely. -", +- Set this to a blank string (`''`) to disable using clang-format + entirely.", ), ) .arg( @@ -75,20 +72,19 @@ example of setting up Clang Tooling on a source tree.", ) .help_heading("clang-tidy options") .long_help( - "A comma-separated list of globs with optional ``-`` prefix. + "A comma-separated list of globs with optional `-` prefix. Globs are processed in order of appearance in the list. -Globs without ``-`` prefix add checks with matching names to the set, -globs with the ``-`` prefix remove checks with matching names from the set of +Globs without `-` prefix add checks with matching names to the set, +globs with the `-` prefix remove checks with matching names from the set of enabled checks. This option's value is appended to the value of the 'Checks' option in a .clang-tidy file (if any). - It is possible to disable clang-tidy entirely by setting this option to - ``'-*'``. + `'-*'`. - It is also possible to rely solely on a .clang-tidy config file by - specifying this option as a blank string (``''``). + specifying this option as a blank string (`''`). -See also clang-tidy docs for more info. -", +See also clang-tidy docs for more info.", ), ) .arg( @@ -103,12 +99,11 @@ See also clang-tidy docs for more info. "The desired version of the clang tools to use. Accepted options are strings which can be 8, 9, 10, 11, 12, 13, 14, 15, 16, 17. -- Set this option to a blank string (``''``) to use the +- Set this option to a blank string (`''`) to use the platform's default installed version. - This value can also be a path to where the clang tools are installed (if using a custom install location). All paths specified - here are converted to absolute. -", + here are converted to absolute.", ), ) .arg( @@ -118,8 +113,7 @@ strings which can be 8, 9, 10, 11, 12, 13, 14, 15, 16, 17. .value_delimiter(',') .default_value("c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx") .help_heading("source options") - .long_help("A comma-separated list of file extensions to analyze. -"), + .long_help("A comma-separated list of file extensions to analyze."), ) .arg( Arg::new("repo-root") @@ -129,9 +123,8 @@ strings which can be 8, 9, 10, 11, 12, 13, 14, 15, 16, 17. .help_heading("source options") .long_help( "The relative path to the repository root directory. This path is -relative to the runner's ``GITHUB_WORKSPACE`` environment variable (or -the current working directory if not using a CI runner). -", +relative to the runner's `GITHUB_WORKSPACE` environment variable (or +the current working directory if not using a CI runner).", ), ) .arg( @@ -145,17 +138,16 @@ the current working directory if not using a CI runner). "Set this option with path(s) to ignore (or not ignore). - In the case of multiple paths, you can use `|` to separate each path. -- There is no need to use ``./`` for each entry; a blank string (``''``) +- There is no need to use `./` for each entry; a blank string (`''`) represents the repo-root path. - This can also have files, but the file's path (relative to - the :std:option:`--repo-root`) has to be specified with the filename. + the [`--repo-root`](#-r---repo-root)) has to be specified with the filename. - Submodules are automatically ignored. Hidden directories (beginning - with a ``.``) are also ignored automatically. -- Prefix a path with ``!`` to explicitly not ignore it. This can be + with a `.`) are also ignored automatically. +- Prefix a path with `!` to explicitly not ignore it. This can be applied to a submodule's path (if desired) but not hidden directories. -- Glob patterns are not supported here. All asterisk characters (``*``) - are literal. -", +- Glob patterns are not supported here. All asterisk characters (`*`) + are literal.", ), ) .arg( @@ -166,7 +158,8 @@ the current working directory if not using a CI runner). .default_value("") .help_heading("clang-tidy options") .long_help( - "Similar to `--ignore` but applied exclusively to files analyzed by clang-tidy.", + "Similar to [`--ignore`](#-i---ignore) but applied +exclusively to files analyzed by clang-tidy.", ), ) .arg( @@ -177,7 +170,8 @@ the current working directory if not using a CI runner). .default_value("") .help_heading("clang-format options") .long_help( - "Similar to `--ignore` but applied exclusively to files analyzed by clang-format.", + "Similar to [`--ignore`](#-i---ignore) but applied +exclusively to files analyzed by clang-format.", ), ) .arg( @@ -191,11 +185,10 @@ the current working directory if not using a CI runner). "This controls what part of the files are analyzed. The following values are accepted: -- ``false``: All lines in a file are analyzed. -- ``true``: Only lines in the diff that contain additions are analyzed. -- ``diff``: All lines in the diff are analyzed (including unchanged - lines but not subtractions). -", +- `false`: All lines in a file are analyzed. +- `true`: Only lines in the diff that contain additions are analyzed. +- `diff`: All lines in the diff are analyzed (including unchanged + lines but not subtractions).", ), ) .arg( @@ -209,16 +202,15 @@ The following values are accepted: .long_help( "Set this option to false to analyze any source files in the repo. This is automatically enabled if -:std:option:`--lines-changed-only` is enabled. +[`--lines-changed-only`](#-l---lines-changed-only) is enabled. -.. note:: - The ``GITHUB_TOKEN`` should be supplied when running on a - private repository with this option enabled, otherwise the runner - does not not have the privilege to list the changed files for an event. - - See `Authenticating with the GITHUB_TOKEN - `_ -", +> [!note] +> The `GITHUB_TOKEN` should be supplied when running on a +> private repository with this option enabled, otherwise the runner +> does not not have the privilege to list the changed files for an event. +> +> See [Authenticating with the `GITHUB_TOKEN`]( +> https://docs.github.com/en/actions/reference/authentication-in-a-workflow).", ), ) .arg( @@ -231,11 +223,11 @@ This is automatically enabled if "A string of extra arguments passed to clang-tidy for use as compiler arguments. This can be specified more than once for each additional argument. Recommend using quotes around the value and -avoid using spaces between name and value (use ``=`` instead): - -.. code-block:: shell +avoid using spaces between name and value (use `=` instead): - cpp-linter --extra-arg=\"-std=c++17\" --extra-arg=\"-Wall\"", +```shell +cpp-linter --extra-arg=\"-std=c++17\" --extra-arg=\"-Wall\" +```", ), ) .arg( @@ -247,22 +239,16 @@ avoid using spaces between name and value (use ``=`` instead): .help_heading("feedback options") .long_help( "Set this option to true to enable the use of thread comments as feedback. -Set this to ``update`` to update an existing comment if one exists; +Set this to `update` to update an existing comment if one exists; the value 'true' will always delete an old comment and post a new one if necessary. -.. note:: - To use thread comments, the ``GITHUB_TOKEN`` (provided by - Github to each repository) must be declared as an environment - variable. - - See `Authenticating with the GITHUB_TOKEN - `_ - -.. hint:: - If run on a private repository, then this feature is - disabled because the GitHub REST API behaves - differently for thread comments on a private repository. -", +> [!note] +> To use thread comments, the `GITHUB_TOKEN` (provided by +> Github to each repository) must be declared as an environment +> variable. +> +> See [Authenticating with the `GITHUB_TOKEN`]( +> https://docs.github.com/en/actions/reference/authentication-in-a-workflow).", ), ) .arg( @@ -276,9 +262,9 @@ the value 'true' will always delete an old comment and post a new one if necessa "Set this option to true or false to enable or disable the use of a thread comment that basically says 'Looks Good To Me' (when all checks pass). -.. seealso:: - The :std:option:`--thread-comments` option also notes further implications. -", +> [!important] +> The [`--thread-comments`](#-g---thread-comments) +> option also notes further implications.", ), ) .arg( @@ -290,8 +276,7 @@ thread comment that basically says 'Looks Good To Me' (when all checks pass). .help_heading("feedback options") .long_help( "Set this option to true or false to enable or disable the use of -a workflow step summary when the run has concluded. -", +a workflow step summary when the run has concluded.", ), ) .arg( @@ -303,8 +288,7 @@ a workflow step summary when the run has concluded. .help_heading("feedback options") .long_help( "Set this option to false to disable the use of -file annotations as feedback. -", +file annotations as feedback.", ), ) .groups([ diff --git a/cpp-linter-lib/src/common_fs/file_filter.rs b/cpp-linter-lib/src/common_fs/file_filter.rs index a18bd97..8605e27 100644 --- a/cpp-linter-lib/src/common_fs/file_filter.rs +++ b/cpp-linter-lib/src/common_fs/file_filter.rs @@ -30,10 +30,10 @@ impl FileFilter { let mut not_ignored = vec![]; for pattern in ignore { let as_posix = pattern.replace('\\', "/"); - let mut pat = as_posix.as_str(); + let mut pat = as_posix.as_str().trim(); let is_ignored = !pat.starts_with('!'); if !is_ignored { - pat = &pat[1..]; + pat = pat[1..].trim_start(); } if pat.starts_with("./") { pat = &pat[2..]; diff --git a/cpp-linter-py/docs/_static/extra_css.css b/cpp-linter-py/docs/_static/extra_css.css deleted file mode 100644 index 9a20a75..0000000 --- a/cpp-linter-py/docs/_static/extra_css.css +++ /dev/null @@ -1,11 +0,0 @@ -tbody .stub, -thead { - background-color: var(--md-accent-bg-color--light); - color: var(--md-default-bg-color); -} - -.md-header, -.md-tabs, -.md-nav--primary .md-nav__title[for="__drawer"] { - background-color: #4051b5; -} diff --git a/cpp-linter-py/docs/_static/favicon.ico b/cpp-linter-py/docs/_static/favicon.ico deleted file mode 100644 index c5de55cd16e9449f58639df02d7c2384c20eee8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 165662 zcmeI52fQRjwZ`wVz%Frj$!WPu5J_Tq2$;A?koXiu5fy<&6h#bx2}SOpAgGuS192Z> zLck}IBnb0-s3=bbK~V%81p|n(1YyB-_x-=_u9?2G(=%P&RXsg3efRfmhf{Ux)T!@u zbyZjQjEzm>-_19V@&CNBnWru{w$9kt*p`4(W1pQCo@clEt2|J7pz=WFfyx7w2PzL# z9;iG}d7$z@<$=lrl?N&hR34~2PwgWE!yMn#IJ`wha&h5nZ*V_*(A0DKAD4i*6y-1ep8 zY3x(Xo&#jJ?$20xRQ**R$nODh32X%33cd%P0KT|fgx*K7|1$6fuokFdB|l9@N&}ox zKQSA;9t=ZFB*oo7sNV%(cd!x|sdla^Yv%#@p}s=%NoRrwKoYNp?YzeQ8t-cirFpXD z>^xVc9%c`~2aU5eud4Z=Eb~gk6faNW1NE5)f|Z83-K)BF_WK@e$(?vjZvyNnM$vLJ)$l3eC#mL0KT|0N_zGD^YdW6fh9#{xaMfJ&O+;$ehx;7 zzeUycA^fWTSp9OvxB>Bi+6rs}E(V&rEQ&9qTF$Nb_+_A)7cO~>&_*kQW5B~;RQcME zdTU->&l)w?RdSY$rg^l>HsD8K3Frq$sxrg1#fRYk>7&WQ^3|HQ(D++@#-Oi_8m9QV zg!b3~l#ehYVv&3g#=*5<5V)m&P3wIh2U;iiNCeFXDYh4bL8wPs8}+WsD?l|aDL5wa zxng5Kpm&ARwwLd8PhpFmIo}8tfDeH;fjxoVm(u;;I9MO74YYn%SQqHNUC-a12X+Hm z8+jZ!9cZ56r{K?E(AK}mC#u6L1yf{Xi^JD?xAbG6pVwRQ^md>)I2ybJi1#yq);T(9 zAL)spHDX#1voX+|^|9bWARE*tEiE~IfPM3vIHgjO=mC7J>+Y3(;DR`K3-~117wEd* z_h-o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G~h(P9tzJHLJ-nfhy??6qt)P%8@OWsz4@#ql;+dw8e5xB%4^eD6D$WAk&wM z)-Bl*d02lqZ5lETgM4y&^KX$(1$Q!$EV}Y5LBJ-_CCt}|d=lgh*c6wU!X!o2M36er zsf%;#k5l7;mpaI5foviwZ|ZGp9mfP74Dw-iOXboAY-%X90vTqrYyQNTh7t!d%$_ik z&@q8`JIE+u+Cq6Zkn#U`E1w**NEHrcwRXpxASW7GyJMs#l+~AUOiR`f1)6`gsQ55n zV@l=gIHr}4>P|MZ1&(RSsM2^#7KKt|3ss7>yei+yhb&eJRlX&|p|REtSb=a#5>q56 zCt9-F6hk?R$?8)KjgH2`VjEKojgBIjsZv-XN3Ax3|8b9UB(tM@s?ubbY3b6ZIBK&Vbz;#TEIri`4{r9cIQCpcG^OcxLRPYLE4qI@zY`U})iBMv1A zIw>QY2rgEkh(EDZj}k#P|Af9&he z$h1%CVSlRw{u-e$B&sUNaVQBdavY8a$2GhYlZBQ>tym{dTo$xNm`w#tk?BNOT2P6} zcs^6Gw&+NdQHhD9d=!=}t96mpyT}?{WDH^wZDIVJC|irn(YvGOR(=r_WxM$ B_Dlc( diff --git a/cpp-linter-py/docs/conf.py b/cpp-linter-py/docs/conf.py deleted file mode 100644 index a8496ae..0000000 --- a/cpp-linter-py/docs/conf.py +++ /dev/null @@ -1,85 +0,0 @@ -# Configuration file for the Sphinx documentation builder. -# -# For the full list of built-in configuration values, see the documentation: -# https://www.sphinx-doc.org/en/master/usage/configuration.html -from pathlib import Path -import subprocess -from sphinx.application import Sphinx - -# -- Project information ----------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information - -project = "cpp-linter" -copyright = "2023, Brendan Doherty" -author = "Brendan Doherty" - -# -- General configuration --------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration - -extensions = [ - "sphinx_immaterial", -] - -templates_path = ["_templates"] -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] - - -# -- Options for HTML output ------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output - -html_theme = "sphinx_immaterial" -html_static_path = ["_static"] -html_logo = "_static/logo.png" -html_favicon = "_static/favicon.ico" -html_css_files = ["extra_css.css"] -html_title = "cpp-linter" - -html_theme_options = { - "repo_url": "https://github.com/2bndy5/cpp_linter_rs", - "repo_name": "cpp_linter_rs", - "palette": [ - { - "media": "(prefers-color-scheme: light)", - "scheme": "default", - "primary": "light-blue", - "accent": "deep-purple", - "toggle": { - "icon": "material/lightbulb-outline", - "name": "Switch to dark mode", - }, - }, - { - "media": "(prefers-color-scheme: dark)", - "scheme": "slate", - "primary": "light-blue", - "accent": "deep-purple", - "toggle": { - "icon": "material/lightbulb", - "name": "Switch to light mode", - }, - }, - ], - "features": [ - "navigation.top", - "navigation.tabs", - "navigation.tabs.sticky", - "toc.sticky", - "toc.follow", - "search.share", - ], -} -object_description_options = [ - ("std:option", dict(include_fields_in_toc=False)), -] - -# -- Parse CLI args from `-h` output ------------------------------------- - - -def setup(app: Sphinx): - """Generate a doc from the executable script's ``--help`` output.""" - - subprocess.run( - ["cargo", "run", "--example", "cli_doc"], - check=True, - cwd=str(Path(__file__).parent.parent.parent), - ) diff --git a/cpp-linter-py/docs/index.rst b/cpp-linter-py/docs/index.rst deleted file mode 100644 index 632a6fe..0000000 --- a/cpp-linter-py/docs/index.rst +++ /dev/null @@ -1,48 +0,0 @@ -C/C++ Linting Package -===================== - -.. image:: https://img.shields.io/github/v/release/cpp-linter/cpp-linter - :alt: Latest Version - :target: https://github.com/cpp-linter/cpp-linter/releases -.. image:: https://img.shields.io/github/license/cpp-linter/cpp-linter?label=license&logo=github - :alt: License - :target: https://github.com/cpp-linter/cpp-linter/blob/main/LICENSE -.. image:: https://codecov.io/gh/cpp-linter/cpp-linter/branch/main/graph/badge.svg?token=0814O9WHQU - :alt: CodeCov - :target: https://codecov.io/gh/cpp-linter/cpp-linter -.. image:: https://github.com/cpp-linter/cpp-linter/actions/workflows/build-docs.yml/badge.svg - :alt: Docs - :target: https://cpp-linter.github.io/cpp-linter -.. image:: https://img.shields.io/pypi/dw/cpp-linter?color=dark-green&label=PyPI%20Downloads&logo=python&logoColor=white - :target: https://pepy.tech/project/cpp-linter - :alt: PyPI - Downloads - -A Python package for linting C/C++ code with clang-tidy and/or clang-format to collect feedback provided in the form of thread comments and/or file annotations. - -Usage ------ - -For usage in a CI workflow, see `the cpp-linter/cpp-linter-action repository `_ - -For the description of supported Command Line Interface options, see `the CLI documentation `_ - -Have question or feedback? --------------------------- - -To provide feedback (requesting a feature or reporting a bug) please post to `issues `_. - -License -------- - -The scripts and documentation in this project are released under the `MIT License `_. - -.. toctree:: - :maxdepth: 2 - :hidden: - - self - -.. toctree:: - :hidden: - - cli_args diff --git a/cpp-linter-py/docs/requirements.txt b/cpp-linter-py/docs/requirements.txt deleted file mode 100644 index d078f24..0000000 --- a/cpp-linter-py/docs/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -sphinx-immaterial diff --git a/cspell.config.yml b/cspell.config.yml index 7ba6d12..b39811a 100644 --- a/cspell.config.yml +++ b/cspell.config.yml @@ -10,9 +10,12 @@ words: - gitmodules - iomanip - libgit + - markdownlint + - mdbook - nonminimal - peekable - posix + - preprocess - pybind - pyfunction - pymodule diff --git a/docs/Cargo.toml b/docs/Cargo.toml new file mode 100644 index 0000000..87392c8 --- /dev/null +++ b/docs/Cargo.toml @@ -0,0 +1,18 @@ + +[package] +name = "cli-gen" +version.workspace = true +authors.workspace = true +description.workspace = true +documentation.workspace = true + +[dependencies] +cpp-linter-lib = { path = "../cpp-linter-lib", version = "*" } +clap = "4.5.16" +mdbook = "0.4.40" +semver = "1.0.23" +serde_json = "1.0.125" + +[[bin]] +name = "cli-gen" +path = "src/main.rs" diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..9c8f027 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,20 @@ +# Docs + +This folder is only for generating the documentation. +Please [visit our website][gh-pages] to see generated documentation. + +[gh-pages]: https://cpp-linter.github.io/cpp_linter_rs + +To view the documentation locally, some software needs to be installed. + +```shell +cargo install --locked cargo-binstall +cargo binstall -y mdbook mdbook-alerts +``` + +Then use `mdbook` to generate the docs and open them in your browser. + +```shell +# in repo root folder +mdbook serve docs --open +``` diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 0000000..d875075 --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,36 @@ +[book] +authors = ["Brendan Doherty"] +language = "en" +multilingual = false +src = "src" +title = "cpp-linter" +description = "Some documentation about the cpp_linter_rs project" + +[build] +create-missing = false +build-dir = "book/html" + +[output.html] +theme = "theme" +default-theme = "ayu" +preferred-dark-theme = "ayu" +git-repository-url = "https://github.com/cpp-linter/cpp_linter_rs" +additional-css = ["theme/pagetoc.css"] +additional-js = ["theme/pagetoc.js"] + +[preprocessor.alerts] +after = ["links"] + +[preprocessor.cli-gen] +command = "cargo run --bin cli-gen" +before = ["links"] +groups-order = [ + "General options", + "Source options", + "Clang-format options", + "Clang-tidy options", + "Feedback options", +] + +# [output.markdown] +# for debugging the cli-gen preprocessor (src/main.rs) diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md new file mode 100644 index 0000000..5ae2d66 --- /dev/null +++ b/docs/src/SUMMARY.md @@ -0,0 +1,6 @@ +# Summary + + + +- [Introduction](./index.md) +- [Command Line Interface](./cli.md) diff --git a/docs/src/cli.md b/docs/src/cli.md new file mode 100644 index 0000000..8241eb2 --- /dev/null +++ b/docs/src/cli.md @@ -0,0 +1,16 @@ + +# Command Line Interface + +> [!note] +> This document is generated during a Continuous Integration workflow. +> Please refer to the [generated version of this document][gh-pages] instead. +> +> To view this document locally, run the following command from project root: +> +> ```shell +> mdbook serve docs +> ``` +> +> See also [docs/README](../README.md) for more information. + +[gh-pages]: https://cpp-linter.github.io/cpp_linter_rs/cli.html diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..45f1a48 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,4 @@ + + + +{{#include ../../README.md}} diff --git a/docs/src/main.rs b/docs/src/main.rs new file mode 100644 index 0000000..e2199dc --- /dev/null +++ b/docs/src/main.rs @@ -0,0 +1,196 @@ +//! This is a preprocessor for mdbook that generates the CLI document. +//! For actual library/binary source code look in cpp-linter-lib or cpp-linter-py folders + +extern crate clap; +use clap::{Arg, ArgMatches, Command}; +extern crate mdbook; +use mdbook::errors::Error; +use mdbook::preprocess::{CmdPreprocessor, Preprocessor}; +extern crate semver; +extern crate serde_json; +use semver::{Version, VersionReq}; +use std::io; +use std::process; + +extern crate cpp_linter_lib; + +use cli_gen_lib::CliGen; + +pub fn make_app() -> Command { + Command::new("cli-gen") + .about("A mdbook preprocessor which generates a doc of CLI options") + .subcommand( + Command::new("supports") + .arg(Arg::new("renderer").required(true)) + .about("Check whether a renderer is supported by this preprocessor"), + ) +} + +fn handle_preprocessing(pre: &dyn Preprocessor) -> Result<(), Error> { + let (ctx, book) = CmdPreprocessor::parse_input(io::stdin())?; + + let book_version = Version::parse(&ctx.mdbook_version)?; + let version_req = VersionReq::parse(mdbook::MDBOOK_VERSION)?; + + if !version_req.matches(&book_version) { + eprintln!( + "Warning: The {} plugin was built against version {} of mdbook, \ + but we're being called from version {}", + pre.name(), + mdbook::MDBOOK_VERSION, + ctx.mdbook_version + ); + } + + let processed_book = pre.run(&ctx, book)?; + serde_json::to_writer(io::stdout(), &processed_book)?; + + Ok(()) +} + +fn handle_supports(pre: &dyn Preprocessor, sub_args: &ArgMatches) -> ! { + let renderer = sub_args + .get_one::("renderer") + .expect("Required argument"); + let supported = pre.supports_renderer(renderer); + + // Signal whether the renderer is supported by exiting with 1 or 0. + if supported { + process::exit(0); + } else { + process::exit(1); + } +} + +fn main() { + let matches = make_app().get_matches(); + + // Users will want to construct their own preprocessor here + let preprocessor = CliGen {}; + + if let Some(sub_args) = matches.subcommand_matches("supports") { + handle_supports(&preprocessor, sub_args); + } else if let Err(e) = handle_preprocessing(&preprocessor) { + eprintln!("{}", e); + process::exit(1); + } +} + +mod cli_gen_lib { + use std::path::PathBuf; + + use mdbook::book::Book; + use mdbook::preprocess::{Preprocessor, PreprocessorContext}; + + use cpp_linter_lib::cli; + + pub struct CliGen; + + impl CliGen { + fn generate_cli(groups_order: &Option>) -> String { + let mut out = String::new(); + let command = cli::get_arg_parser(); + out.push_str(format!("\n{}\n\n", "# Command Line Interface").as_str()); + out.push_str("\n"); + out.push_str("\n## Commands\n"); + for cmd in command.get_subcommands() { + out.push_str(format!("\n### `{}`\n\n", cmd.get_name()).as_str()); + out.push_str( + format!("{}\n", &cmd.get_about().unwrap().to_string().trim()).as_str(), + ); + } + let arg_groups = if let Some(groups) = groups_order { + eprintln!("ordering groups into {:?}", groups); + let mut ordered = Vec::with_capacity(command.get_groups().count()); + for group in groups { + let mut group_obj = None; + for arg_group in command.get_groups() { + if arg_group.get_id().as_str() == group.as_str() { + group_obj = Some(arg_group.clone()); + } + } + ordered.push( + group_obj + .unwrap_or_else(|| panic!("{} not found in command's groups", group)), + ); + } + ordered + } else { + command.get_groups().map(|g| g.to_owned()).collect() + }; + for group in arg_groups { + out.push_str(format!("\n## {}\n", group.get_id()).as_str()); + for arg_id in group.get_args() { + let mut arg_match = command.get_arguments().filter(|a| *a.get_id() == *arg_id); + let arg = arg_match.next().unwrap_or_else(|| { + panic!( + "arg {} expected in group {}", + arg_id.as_str(), + group.get_id().as_str() + ) + }); + out.push_str( + format!( + "\n### `-{}, --{}`\n\n", + &arg.get_short().unwrap(), + &arg.get_long().unwrap() + ) + .as_str(), + ); + let default = arg.get_default_values(); + if !default.is_empty() { + out.push_str("
Default
"); + assert_eq!(default.len(), 1); + out.push_str( + format!("{:?}
\n\n", default.first().unwrap()) + .as_str(), + ); + } + out.push_str( + format!("{}\n", &arg.get_long_help().unwrap().to_string().trim()).as_str(), + ); + } + } + out + } + } + + impl Preprocessor for CliGen { + fn name(&self) -> &str { + "cli-gen" + } + + fn run(&self, ctx: &PreprocessorContext, book: Book) -> mdbook::errors::Result { + let mut altered = book.clone(); + let groups_order = match ctx + .config + .get_preprocessor("cli-gen") + .unwrap() + .get("groups-order") + { + Some(val) => val.clone().as_array_mut().map(|v| { + v.iter_mut() + .map(|o| o.to_string().trim_matches('"').to_string()) + .collect() + }), + None => None, + }; + altered.for_each_mut(|item| { + if let mdbook::BookItem::Chapter(chap) = item { + if chap + .path + .clone() + .is_some_and(|p| p == PathBuf::from("cli.md")) + { + chap.content = CliGen::generate_cli(&groups_order); + } + } + }); + Ok(altered) + } + + fn supports_renderer(&self, renderer: &str) -> bool { + matches!(renderer, "html" | "markdown") + } + } +} diff --git a/cpp-linter-py/docs/_static/logo.png b/docs/theme/favicon.png similarity index 100% rename from cpp-linter-py/docs/_static/logo.png rename to docs/theme/favicon.png diff --git a/docs/theme/pagetoc.css b/docs/theme/pagetoc.css new file mode 100644 index 0000000..e358fa4 --- /dev/null +++ b/docs/theme/pagetoc.css @@ -0,0 +1,52 @@ + +@media only screen { + main { + position: relative; + } + .sidetoc { + margin-left: auto; + margin-right: auto; + } + .pagetoc { + width: auto; + word-wrap: normal; + } + .pagetoc a { + color: var(--sidebar-fg) !important; + display: block; + padding-left: 10px; + text-align: left; + text-decoration: none; + margin-block-start: 0.6em; + } + .pagetoc a:hover, + .pagetoc a.active { + color: var(--sidebar-active) !important; + } + .pagetoc .active { + color: var(--sidebar-active); + } + .pagetoc .pagetoc-H2 { + padding-left: 20px; + } + .pagetoc .pagetoc-H3 { + padding-left: 40px; + } + .pagetoc .pagetoc-H4 { + padding-left: 60px; + } + .pagetoc .pagetoc-H5 { + display: none; + } + .pagetoc .pagetoc-H6 { + display: none; + } + ol.chapter a { + color: var(--sidebar-fg); + text-decoration: none; + } + ol.chapter a.active { + color: var(--sidebar-active); + text-decoration: none; + } +} diff --git a/docs/theme/pagetoc.js b/docs/theme/pagetoc.js new file mode 100644 index 0000000..adc2982 --- /dev/null +++ b/docs/theme/pagetoc.js @@ -0,0 +1,72 @@ +let scrollTimeout; + +const listenActive = () => { + const elems = document.querySelector(".pagetoc").children; + [...elems].forEach(el => { + el.addEventListener("click", (event) => { + clearTimeout(scrollTimeout); + [...elems].forEach(el => el.classList.remove("active")); + el.classList.add("active"); + // Prevent scroll updates for a short period + scrollTimeout = setTimeout(() => { + scrollTimeout = null; + }, 100); // Adjust timing as needed + }); + }); +}; + +const getPagetoc = () => document.querySelector(".pagetoc") || autoCreatePagetoc(); + +const autoCreatePagetoc = () => { + const chapter = document.querySelector("body nav#sidebar.sidebar li.chapter-item.expanded a.active"); + const content = Object.assign(document.createElement("div"), { + className: "content-wrap" + }); + content.appendChild(chapter.cloneNode(true)); + const divAddedToc = Object.assign(document.createElement("div"), { className: "sidetoc" }); + const navAddedToc = Object.assign(document.createElement("nav"), { className: "pagetoc" }); + divAddedToc.appendChild(navAddedToc); + content.appendChild(divAddedToc); + chapter.replaceWith(content); + return document.querySelector(".pagetoc"); +}; + +const updateFunction = () => { + if (scrollTimeout) return; // Skip updates if within the cooldown period from a click + const headers = [...document.getElementsByClassName("header")]; + const scrolledY = window.scrollY; + let lastHeader = null; + + // Find the last header that is above the current scroll position + for (let i = headers.length - 1; i >= 0; i--) { + if (scrolledY >= headers[i].offsetTop) { + lastHeader = headers[i]; + break; + } + } + + const pagetocLinks = [...document.querySelector(".pagetoc").children]; + pagetocLinks.forEach(link => link.classList.remove("active")); + + if (lastHeader) { + const activeLink = pagetocLinks.find(link => lastHeader.href === link.href); + if (activeLink) activeLink.classList.add("active"); + } +}; + +window.addEventListener('load', () => { + const pagetoc = getPagetoc(); + var headers = [...document.getElementsByClassName("header")]; + headers.shift(); + headers.forEach(header => { + const link = Object.assign(document.createElement("a"), { + textContent: header.text, + href: header.href, + className: `pagetoc-${header.parentElement.tagName}` + }); + pagetoc.appendChild(link); + }); + updateFunction(); + listenActive(); + window.addEventListener("scroll", updateFunction); +}); From 48310dab7e3f4ba19fe303046da5750f6d001cd7 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Sun, 18 Aug 2024 06:17:21 -0700 Subject: [PATCH 2/3] fix JS and CSS linting errors --- docs/theme/pagetoc.css | 13 +++++++++++- docs/theme/pagetoc.js | 48 ++++++++++++++++++++++++------------------ 2 files changed, 40 insertions(+), 21 deletions(-) diff --git a/docs/theme/pagetoc.css b/docs/theme/pagetoc.css index e358fa4..eff428b 100644 --- a/docs/theme/pagetoc.css +++ b/docs/theme/pagetoc.css @@ -1,16 +1,18 @@ - @media only screen { main { position: relative; } + .sidetoc { margin-left: auto; margin-right: auto; } + .pagetoc { width: auto; word-wrap: normal; } + .pagetoc a { color: var(--sidebar-fg) !important; display: block; @@ -19,32 +21,41 @@ text-decoration: none; margin-block-start: 0.6em; } + .pagetoc a:hover, .pagetoc a.active { color: var(--sidebar-active) !important; } + .pagetoc .active { color: var(--sidebar-active); } + .pagetoc .pagetoc-H2 { padding-left: 20px; } + .pagetoc .pagetoc-H3 { padding-left: 40px; } + .pagetoc .pagetoc-H4 { padding-left: 60px; } + .pagetoc .pagetoc-H5 { display: none; } + .pagetoc .pagetoc-H6 { display: none; } + ol.chapter a { color: var(--sidebar-fg); text-decoration: none; } + ol.chapter a.active { color: var(--sidebar-active); text-decoration: none; diff --git a/docs/theme/pagetoc.js b/docs/theme/pagetoc.js index adc2982..bb96454 100644 --- a/docs/theme/pagetoc.js +++ b/docs/theme/pagetoc.js @@ -2,10 +2,10 @@ let scrollTimeout; const listenActive = () => { const elems = document.querySelector(".pagetoc").children; - [...elems].forEach(el => { - el.addEventListener("click", (event) => { + [...elems].forEach((el) => { + el.addEventListener("click", () => { clearTimeout(scrollTimeout); - [...elems].forEach(el => el.classList.remove("active")); + [...elems].forEach((el) => el.classList.remove("active")); el.classList.add("active"); // Prevent scroll updates for a short period scrollTimeout = setTimeout(() => { @@ -15,16 +15,24 @@ const listenActive = () => { }); }; -const getPagetoc = () => document.querySelector(".pagetoc") || autoCreatePagetoc(); +const getPagetoc = () => { + return document.querySelector(".pagetoc") || autoCreatePagetoc(); +}; const autoCreatePagetoc = () => { - const chapter = document.querySelector("body nav#sidebar.sidebar li.chapter-item.expanded a.active"); + const chapter = document.querySelector( + "body nav#sidebar.sidebar li.chapter-item.expanded a.active" + ); const content = Object.assign(document.createElement("div"), { - className: "content-wrap" + className: "content-wrap", }); content.appendChild(chapter.cloneNode(true)); - const divAddedToc = Object.assign(document.createElement("div"), { className: "sidetoc" }); - const navAddedToc = Object.assign(document.createElement("nav"), { className: "pagetoc" }); + const divAddedToc = Object.assign(document.createElement("div"), { + className: "sidetoc", + }); + const navAddedToc = Object.assign(document.createElement("nav"), { + className: "pagetoc", + }); divAddedToc.appendChild(navAddedToc); content.appendChild(divAddedToc); chapter.replaceWith(content); @@ -35,34 +43,34 @@ const updateFunction = () => { if (scrollTimeout) return; // Skip updates if within the cooldown period from a click const headers = [...document.getElementsByClassName("header")]; const scrolledY = window.scrollY; - let lastHeader = null; // Find the last header that is above the current scroll position - for (let i = headers.length - 1; i >= 0; i--) { - if (scrolledY >= headers[i].offsetTop) { - lastHeader = headers[i]; - break; - } - } + let headerOffsets = headers.filter((el) => { + return scrolledY >= el.offsetTop; + }); + const lastHeader = headerOffsets.reverse().shift(); const pagetocLinks = [...document.querySelector(".pagetoc").children]; - pagetocLinks.forEach(link => link.classList.remove("active")); + pagetocLinks.forEach((link) => link.classList.remove("active")); if (lastHeader) { - const activeLink = pagetocLinks.find(link => lastHeader.href === link.href); + const activeLink = pagetocLinks.find( + (link) => lastHeader.href === link.href + ); if (activeLink) activeLink.classList.add("active"); } }; -window.addEventListener('load', () => { +window.addEventListener("load", () => { const pagetoc = getPagetoc(); + console.log(pagetoc); var headers = [...document.getElementsByClassName("header")]; headers.shift(); - headers.forEach(header => { + headers.forEach((header) => { const link = Object.assign(document.createElement("a"), { textContent: header.text, href: header.href, - className: `pagetoc-${header.parentElement.tagName}` + className: `pagetoc-${header.parentElement.tagName}`, }); pagetoc.appendChild(link); }); From b9df2672b002c1f1c8fbf9c669a6af969014ea04 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Sun, 18 Aug 2024 06:59:35 -0700 Subject: [PATCH 3/3] disable eslint about `no-async-operation` I'm not sure if there is a suitable workaround, but I don't really care. --- docs/theme/pagetoc.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/theme/pagetoc.js b/docs/theme/pagetoc.js index bb96454..d5fefc5 100644 --- a/docs/theme/pagetoc.js +++ b/docs/theme/pagetoc.js @@ -8,6 +8,7 @@ const listenActive = () => { [...elems].forEach((el) => el.classList.remove("active")); el.classList.add("active"); // Prevent scroll updates for a short period + // eslint-disable-next-line no-async-operation scrollTimeout = setTimeout(() => { scrollTimeout = null; }, 100); // Adjust timing as needed @@ -45,9 +46,7 @@ const updateFunction = () => { const scrolledY = window.scrollY; // Find the last header that is above the current scroll position - let headerOffsets = headers.filter((el) => { - return scrolledY >= el.offsetTop; - }); + let headerOffsets = headers.filter((el) => scrolledY >= el.offsetTop); const lastHeader = headerOffsets.reverse().shift(); const pagetocLinks = [...document.querySelector(".pagetoc").children]; @@ -61,9 +60,8 @@ const updateFunction = () => { } }; -window.addEventListener("load", () => { +const onLoad = () => { const pagetoc = getPagetoc(); - console.log(pagetoc); var headers = [...document.getElementsByClassName("header")]; headers.shift(); headers.forEach((header) => { @@ -77,4 +75,6 @@ window.addEventListener("load", () => { updateFunction(); listenActive(); window.addEventListener("scroll", updateFunction); -}); +}; + +window.addEventListener("load", onLoad);