-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmix.exs
More file actions
110 lines (98 loc) · 3.38 KB
/
mix.exs
File metadata and controls
110 lines (98 loc) · 3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
defmodule Dmp.MixProject do
use Mix.Project
@version "0.3.0"
@github_project_url "https://github.com/pzingg/diff_match_patch"
def project do
[
app: :diff_match_patch,
version: @version,
elixir: "~> 1.12",
start_permanent: Mix.env() == :prod,
deps: deps(),
source_url: @github_project_url,
hompepage_url: @github_project_url,
description: description(),
package: package(),
docs: docs()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
# extra_applications: [:logger]
]
end
defp description do
"""
An Elixir implementation of the Google diff_match_patch library.
"""
end
defp package do
[
licenses: ["Apache-2.0"],
links: %{"GitHub" => @github_project_url}
]
end
# Load KaTeX JavaScript to docs for math expressions
defp docs do
[
authors: ["Peter Zingg <peter.zingg@gmail.com>"],
assets: "priv/assets",
javascript_config_path: "assets/docs_config.js",
extras: ["README.md": [filename: "readme", title: "Diff Match Patch"]],
main: "readme",
# You can specify a function for adding
# custom content to the generated HTML.
# This is useful for custom JS/CSS files you want to include.
before_closing_head_tag: &before_closing_head_tag/1,
before_closing_body_tag: &before_closing_body_tag/1
]
end
# In our case we simply add a tags to load KaTeX
# from CDN and then specify the configuration.
# Once loaded, the script will dynamically render all LaTeX
# expressions on the page in place.
# For more details and options see https://katex.org/docs/autorender.html
defp before_closing_head_tag(:html) do
"""
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.js" integrity="sha384-I2b1Pcl48X93GxEkGkaMo1hrd6n+IX8H2wgSsMimGbkZoGTve/87h1FjaDNvlpQi" crossorigin="anonymous"></script>
<script defer src="assets/auto-render.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.0/dist/katex.min.css" integrity="sha384-Xi8rHCmBmhbuyyhbI88391ZKP2dmfnOl4rT9ZfRI7mLTdk1wblIUnrIq35nqwEvC" crossorigin="anonymous">
<link rel="stylesheet" href="assets/docs.css">
"""
end
defp before_closing_head_tag(_), do: ""
# The `sbMacro` function is a workaround to the problem that
# two underscores in Markdown are processed before KaTeX can
# see them. We can't use "\sb{expr}".
defp before_closing_body_tag(:html) do
"""
<script>
const sbMacro = function(text) {
return text.replace(/\\\\xsb/g, '_');
};
document.addEventListener('DOMContentLoaded', function() {
renderMathInElement(document.body, {
fleqn: true,
preProcess: sbMacro,
delimiters: [
{ left: '$$', right: '$$', display: true },
{ left: '$', right: '$', display: false },
]
});
});
</script>
"""
end
defp before_closing_body_tag(_), do: ""
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: :dev, runtime: false},
{:ex_doc, "~> 0.28", only: :dev, runtime: false}
]
end
end