Skip to content

Commit

Permalink
Merge pull request #372 from NNPDF/swap-katex
Browse files Browse the repository at this point in the history
Swap KaTeX from local to global
  • Loading branch information
felixhekhorn authored May 17, 2024
2 parents 628ddd9 + a5eb840 commit 3c86e0e
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 680 deletions.
48 changes: 0 additions & 48 deletions crates/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion crates/eko/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ name = "eko"
version = "0.1.0"
edition = "2021"

[package.metadata.docs.rs]
rustdoc-args = [ "--html-in-header", "../katex-header.html" ]

[lib]
name = "ekors"
crate-type = ["cdylib"]

[dependencies]
num = "0.4.1"
katexit = "0.1.4"
ekore = { version = "0.1.0", path = "../ekore" }
1 change: 0 additions & 1 deletion crates/eko/src/mellin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use num::complex::Complex;
use std::f64::consts::PI;

#[cfg_attr(doc, katexit::katexit)]
/// Talbot inversion path.
///
/// Implements the algorithm presented in [\[Abate\]](crate::bib::Abate).
Expand Down
4 changes: 3 additions & 1 deletion crates/ekore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ edition = "2021"
description = "EKO expressions"
license = "GPL-3.0-or-later"

[package.metadata.docs.rs]
rustdoc-args = [ "--html-in-header", "../katex-header.html" ]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
num = "0.4.1"
float-cmp = "0.9.0"
katexit = "0.1.4"
hashbrown = "0.14"
4 changes: 0 additions & 4 deletions crates/ekore/src/constants.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
//! Global constants.

#[cfg_attr(doc, katexit::katexit)]
/// The number of colors.
///
/// Defaults to $N_C = 3$.
pub const NC: u8 = 3;

#[cfg_attr(doc, katexit::katexit)]
/// The normalization of fundamental generators.
///
/// Defaults to $T_R = 1/2$.
pub const TR: f64 = 1.0 / 2.0;

#[cfg_attr(doc, katexit::katexit)]
/// Second Casimir constant in the adjoint representation.
///
/// Defaults to $C_A = N_C = 3$.
pub const CA: f64 = NC as f64;

#[cfg_attr(doc, katexit::katexit)]
/// Second Casimir constant in the fundamental representation.
///
/// Defaults to $C_F = \frac{N_C^2-1}{2N_C} = 4/3$.
Expand Down
1 change: 0 additions & 1 deletion crates/ekore/src/harmonics/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use num::complex::Complex;

use crate::harmonics::w1;

#[cfg_attr(doc, katexit::katexit)]
/// List of available elements.
#[derive(Debug, PartialEq, Eq, Hash)]
pub enum K {
Expand Down
1 change: 0 additions & 1 deletion crates/ekore/src/harmonics/polygamma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use num::{complex::Complex, Zero};
use std::f64::consts::PI;

#[cfg_attr(doc, katexit::katexit)]
/// Compute the polygamma functions $\psi_k(z)$.
///
/// Reimplementation of ``WPSIPG`` (C317) in [CERNlib](http://cernlib.web.cern.ch/cernlib/) given by [[KOLBIG1972221]][crate::bib::KOLBIG1972221].
Expand Down
19 changes: 19 additions & 0 deletions crates/katex-header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-wcIxkf4k558AjM3Yz3BBFQUbk/zgIYC2R0QpeeYb+TwlBVMrlgLqwRjRtGZiK7ww" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-hIoBPJpTUs74ddyc4bFZSM1TVlQDA60VBbJS0oA934VSz82sBx1X7kSx2ATBDIyd" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
// customised options
// • auto-render specific keys, e.g.:
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
],
// • rendering keys, e.g.:
throwOnError : false
});
});
</script>
7 changes: 4 additions & 3 deletions pyproject.toml.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/pyproject.toml b/pyproject.toml
index 31be6cb0..b4ec7c95 100644
index 7404d871..a1e3ae66 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,20 @@
Expand All @@ -25,12 +25,13 @@ index 31be6cb0..b4ec7c95 100644

[tool.poetry]
name = "eko"
@@ -124,6 +138,11 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json"
@@ -124,6 +138,12 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json"
asv-show = "asv show --config benchmarks/asv.conf.json"
asv-clean = { "shell" = "rm -rf benchmarks/env benchmarks/html benchmarks/results" }
asv = ["asv-run", "asv-publish", "asv-preview"]
+compile = "pip install -e crates/eko/"
+rdocs = "cargo doc --workspace --manifest-path crates/Cargo.toml --no-deps"
+rdocs.cmd = "cargo doc --workspace --manifest-path crates/Cargo.toml --no-deps"
+rdocs.env = { RUSTDOCFLAGS = "--html-in-header katex-header.html" }
+rdocs-view = "xdg-open crates/target/doc/ekors/index.html"
+rdocs-clean = "rm -rf crates/target/doc/"
+rtest = "cargo test --workspace --manifest-path crates/Cargo.toml"
Expand Down
6 changes: 5 additions & 1 deletion rustify.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/bash

# git diff --merge-base master pyproject.toml > pyproject.toml.patch
patch -p1 <pyproject.toml.patch

# git diff --merge-base master src/eko/evolution_operator/__init__.py > src/eko/evolution_operator/__init__.py.patch
patch -p1 <src/eko/evolution_operator/__init__.py.patch
patch -p1 <tests/eko/evolution_operator/test_init.py.patch

mv tests/eko/evolution_operator/test_init.py tests/eko/evolution_operator/deactivated_t_e_s_t_init.py
Loading

0 comments on commit 3c86e0e

Please sign in to comment.