forked from ieee-vgtc/ieeevis.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.js
44 lines (38 loc) · 1.68 KB
/
error.js
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
function send_to_create_gh_flow() {
var base = "https://github.com/ieee-vgtc/ieeevis.org/new/vis2023";
var p = base + window.location.pathname;
var i = p.lastIndexOf("/");
var filename = p.substr(i + 1) + ".md";
var pWithoutFileName = p.substring(0, i);
var yaml_front_matter;
yaml_front_matter = ["---",
"title: " + p.substr(i + 1),
"layout: page",
"permalink: " + window.location.pathname,
"---\n\n"];
yaml_front_matter = yaml_front_matter.join("\n");
window.location = pWithoutFileName + "?filename=" + filename + "&value=" + encodeURIComponent(yaml_front_matter);
}
// ALPER try for vis2023
function send_to_create_gh_flow_new() {
var base = "https://github.com/ieee-vgtc/ieeevis.org/new/vis2023";
var permalink = window.location.pathname;
// try to strip out year/2023/ and replace with content/ if possible to get the actual permaline
var year2023 = /year\/2023/g;
permalink = permalink.replace(year2023, "content");
var p = base + permalink;
var i = p.lastIndexOf('/');
var pWithoutFilename = p.substring(0, i);
// filename should contain last directory (see <https://github.com/isaacs/github/issues/1527> for discussion)
var dirAndFile = permalink.match(/.*\/(.+\/.+)/);
var filename = dirAndFile.length === 2 ? dirAndFile[1] + ".md" : p.substr(i + 1) + ".md";
var yaml_front_matter;
yaml_front_matter = ["---",
"title: " + p.substr(i + 1),
"layout: page",
"permalink: " + permalink.replace("content/", ""),
"contact: [committee-name]@ieeevis.org",
"---\n\n"];
yaml_front_matter = yaml_front_matter.join("\n");
window.location = pWithoutFilename + "?filename=" + filename + "&value=" + encodeURIComponent(yaml_front_matter);
}