-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new bulletin generator, updated cc info
- Loading branch information
1 parent
97c08f8
commit ef642d3
Showing
6 changed files
with
173 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>ClickCrystals | Bulletin2</title> | ||
<link rel="stylesheet" href="./bulletin2/css/bulletin2.css"> | ||
<link rel="shortcut icon" href="../assets/clickcrystals.png" type="image/x-icon"> | ||
</head> | ||
<body class="main"> | ||
<script src="../../common/toolsbg.js"></script> | ||
|
||
<h1>ClickCrystals Bulletin Generator v2</h1> | ||
<div class="textareas"> | ||
<div class="text"> | ||
<h3>Input: Markdown</h3> | ||
<textarea name="" id="input"></textarea> | ||
</div> | ||
<div class="text"> | ||
<h3>Output: JSON</h3> | ||
<textarea name="" id="output"></textarea> | ||
</div> | ||
</div> | ||
</body> | ||
<script src="./bulletin2/js/bulletin2.js"></script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
body { | ||
background-color: black; | ||
margin: 0; | ||
padding: 0; | ||
|
||
color: white; | ||
|
||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | ||
} | ||
|
||
h1 { | ||
text-align: center; | ||
margin-top: 50px; | ||
} | ||
|
||
.textareas { | ||
width: fit-content; | ||
margin: auto; | ||
margin-top: 20px; | ||
} | ||
#output { | ||
background-color: rgb(45, 44, 44); | ||
color: white; | ||
font-family: 'Courier New', Courier, monospace; | ||
} | ||
#input { | ||
background-color: rgb(215, 209, 209); | ||
color: black; | ||
font-size: 17px; | ||
} | ||
|
||
textarea { | ||
padding: 10px; | ||
border: none; | ||
resize: none; | ||
background-color: darkgray; | ||
border-radius: 10px; | ||
width: 500px; | ||
height: 400px; | ||
margin: 10px; | ||
} | ||
|
||
.text { | ||
display: inline-block; | ||
text-align: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
|
||
const input = document.getElementById('input'); | ||
const output = document.getElementById('output'); | ||
|
||
document.addEventListener('keyup', onKeyPress); | ||
|
||
function onKeyPress(e) { | ||
var ann = readMarkdown(input.value); | ||
output.value = JSON.stringify(ann); | ||
} | ||
|
||
|
||
function readMarkdown(str) { | ||
var lines = str.split('\n'); | ||
var title = "Release <version>"; | ||
var desc = "Check out the new release, ClickCrystals v<version>!"; | ||
var fields = []; | ||
|
||
var currentField = null; | ||
|
||
for (var i = 0; i < lines.length; i++) { | ||
var line = lines[i]; | ||
if (line.trim().length == 0) | ||
continue; | ||
if (line.match(/\s*```\w*\s*/gm) != null) | ||
continue; | ||
|
||
if (line.match(/\s*Version:\s*.+\s*/gmi) != null) { | ||
line = line.replace(/\s*Version:\s*/gmi, ''); | ||
title = "Release " + line | ||
desc = "Check out the new release, ClickCrystals v" + line + "!"; | ||
} | ||
else if (line.match(/\s*Desc(ription)?:\s*.+\s*/gmi) != null) { | ||
line = line.replace(/\s*Desc(ription)?:\s*/gmi, ''); | ||
desc = line | ||
} | ||
else if (line.match(/\s*.+:\s*/gm) != null) { | ||
line = line.trim().replace(/:/, ''); | ||
if (currentField != null) | ||
fields.push(currentField); | ||
currentField = new Field(line, ''); | ||
} | ||
else if (line.match(/\s*-\s*.+\s*/gm) != null) { | ||
line = line.trim().replace(/\s*-\s*/, ''); | ||
if (currentField != null) { | ||
currentField.desc += currentField.desc.length == 0 ? '' : ', '; | ||
currentField.desc += line; | ||
} | ||
} | ||
} | ||
|
||
return new Ann(title, desc, fields); | ||
} | ||
|
||
class Ann { | ||
title | ||
desc | ||
fields | ||
|
||
constructor(title, desc, fields) { | ||
this.title = title; | ||
this.desc = desc; | ||
this.fields = fields; | ||
} | ||
} | ||
|
||
class Field { | ||
title | ||
desc | ||
|
||
constructor(title, desc) { | ||
this.title = title; | ||
this.desc = desc; | ||
} | ||
} |