Skip to content

Commit ace07ea

Browse files
pietroalbiniJoshua Nelson
authored andcommitted
statics: vendor highlightjs
1 parent 3a5ffba commit ace07ea

File tree

9 files changed

+1398
-5
lines changed

9 files changed

+1398
-5
lines changed

src/web/statics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::{ffi::OsStr, fs, path::Path};
1212
const VENDORED_CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/vendored.css"));
1313
const STYLE_CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/style.css"));
1414
const RUSTDOC_CSS: &str = include_str!(concat!(env!("OUT_DIR"), "/rustdoc.css"));
15-
const STATIC_SEARCH_PATHS: &[&str] = &["vendor/pure-css/css", "static"];
15+
const STATIC_SEARCH_PATHS: &[&str] = &["vendor/pure-css/css", "static", "vendor"];
1616

1717
pub(crate) fn static_handler(req: &mut Request) -> IronResult<Response> {
1818
let mut file = req.url.path();

templates/macros.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#}
55
{% macro highlight_js(languages) %}
66
{# Load the highlight script #}
7-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/highlight.min.js" type="text/javascript"
7+
<script src="/-/static/highlightjs/highlight.min.js" type="text/javascript"
88
charset="utf-8"></script>
99

1010
{# Load the script for each provided language #}
1111
{%- for language in languages -%}
12-
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/languages/{{ language }}.min.js"
12+
<script src="/-/static/highlightjs/languages/{{ language }}.min.js"
1313
type="text/javascript" charset="utf-8"></script>
1414
{%- endfor -%}
1515

@@ -30,11 +30,11 @@
3030
stylesheet = "/-/static/ayu-highlight.css";
3131
break;
3232
case "dark":
33-
stylesheet = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/dark.min.css";
33+
stylesheet = "/-/static/highlightjs/styles/dark.min.css";
3434
break;
3535
case "null": // The user is visiting docs.rs for the first time and hasn't set a theme yet.
3636
case "light":
37-
stylesheet = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.4.0/styles/github.min.css";
37+
stylesheet = "/-/static/highlightjs/styles/github.min.css";
3838
break;
3939
default:
4040
throw "unrecognized theme " + document.documentElement.dataset.theme;

vendor/highlightjs/LICENSE

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2006, Ivan Sagalaev.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

vendor/highlightjs/highlight.min.js

Lines changed: 1296 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
hljs.registerLanguage("ini",(()=>{"use strict";function e(e){
2+
return e?"string"==typeof e?e:e.source:null}function n(...n){
3+
return n.map((n=>e(n))).join("")}return s=>{const a={className:"number",
4+
relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:s.NUMBER_RE}]
5+
},i=s.COMMENT();i.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const t={
6+
className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/
7+
}]},r={className:"literal",begin:/\bon|off|true|false|yes|no\b/},l={
8+
className:"string",contains:[s.BACKSLASH_ESCAPE],variants:[{begin:"'''",
9+
end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'
10+
},{begin:"'",end:"'"}]},c={begin:/\[/,end:/\]/,contains:[i,r,t,l,a,"self"],
11+
relevance:0
12+
},g="("+[/[A-Za-z0-9_-]+/,/"(\\"|[^"])*"/,/'[^']*'/].map((n=>e(n))).join("|")+")"
13+
;return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,
14+
contains:[i,{className:"section",begin:/\[+/,end:/\]+/},{
15+
begin:n(g,"(\\s*\\.\\s*",g,")*",n("(?=",/\s*=\s*[^#\s]/,")")),className:"attr",
16+
starts:{end:/$/,contains:[i,c,r,t,l,a]}}]}}})());
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
hljs.registerLanguage("markdown",(()=>{"use strict";function n(...n){
2+
return n.map((n=>{return(e=n)?"string"==typeof e?e:e.source:null;var e
3+
})).join("")}return e=>{const a={begin:/<\/?[A-Za-z_]/,end:">",
4+
subLanguage:"xml",relevance:0},i={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0
5+
},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,
6+
relevance:2},{begin:n(/\[.+?\]\(/,/[A-Za-z][A-Za-z0-9+.-]*/,/:\/\/.*?\)/),
7+
relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{
8+
begin:/\[.+?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{
9+
className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,
10+
returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",
11+
excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",
12+
end:"\\]",excludeBegin:!0,excludeEnd:!0}]},s={className:"strong",contains:[],
13+
variants:[{begin:/_{2}/,end:/_{2}/},{begin:/\*{2}/,end:/\*{2}/}]},c={
14+
className:"emphasis",contains:[],variants:[{begin:/\*(?!\*)/,end:/\*/},{
15+
begin:/_(?!_)/,end:/_/,relevance:0}]};s.contains.push(c),c.contains.push(s)
16+
;let t=[a,i]
17+
;return s.contains=s.contains.concat(t),c.contains=c.contains.concat(t),
18+
t=t.concat(s,c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{
19+
className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:t},{
20+
begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",
21+
contains:t}]}]},a,{className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",
22+
end:"\\s+",excludeEnd:!0},s,c,{className:"quote",begin:"^>\\s+",contains:t,
23+
end:"$"},{className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{
24+
begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{
25+
begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",
26+
contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{
27+
begin:"^[-\\*]{3,}",end:"$"},i,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{
28+
className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{
29+
className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}}})());
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
hljs.registerLanguage("rust",(()=>{"use strict";return e=>{
2+
const n="([ui](8|16|32|64|128|size)|f(32|64))?",t="drop i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize f32 f64 str char bool Box Option Result String Vec Copy Send Sized Sync Drop Fn FnMut FnOnce ToOwned Clone Debug PartialEq PartialOrd Eq Ord AsRef AsMut Into From Default Iterator Extend IntoIterator DoubleEndedIterator ExactSizeIterator SliceConcatExt ToString assert! assert_eq! bitflags! bytes! cfg! col! concat! concat_idents! debug_assert! debug_assert_eq! env! panic! file! format! format_args! include_bin! include_str! line! local_data_key! module_path! option_env! print! println! select! stringify! try! unimplemented! unreachable! vec! write! writeln! macro_rules! assert_ne! debug_assert_ne!"
3+
;return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",
4+
keyword:"abstract as async await become box break const continue crate do dyn else enum extern false final fn for if impl in let loop macro match mod move mut override priv pub ref return self Self static struct super trait true try type typeof unsafe unsized use virtual where while yield",
5+
literal:"true false Some None Ok Err",built_in:t},illegal:"</",
6+
contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]
7+
}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{
8+
className:"string",variants:[{begin:/r(#*)"(.|\n)*?"\1(?!#)/},{
9+
begin:/b?'\\?(x\w{2}|u\w{4}|U\w{8}|.)'/}]},{className:"symbol",
10+
begin:/'[a-zA-Z_][a-zA-Z0-9_]*/},{className:"number",variants:[{
11+
begin:"\\b0b([01_]+)"+n},{begin:"\\b0o([0-7_]+)"+n},{
12+
begin:"\\b0x([A-Fa-f0-9_]+)"+n},{
13+
begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+n}],relevance:0},{
14+
className:"function",beginKeywords:"fn",end:"(\\(|<)",excludeEnd:!0,
15+
contains:[e.UNDERSCORE_TITLE_MODE]},{className:"meta",begin:"#!?\\[",end:"\\]",
16+
contains:[{className:"meta-string",begin:/"/,end:/"/}]},{className:"class",
17+
beginKeywords:"type",end:";",contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{
18+
endsParent:!0})],illegal:"\\S"},{className:"class",
19+
beginKeywords:"trait enum struct union",end:/\{/,
20+
contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{endsParent:!0})],illegal:"[\\w\\d]"
21+
},{begin:e.IDENT_RE+"::",keywords:{built_in:t}},{begin:"->"}]}}})());

vendor/highlightjs/styles/dark.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/highlightjs/styles/github.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)