"...main/resources/git@ustchcs.com:gujinli1118/RuoYi-Vue.git" did not exist on "14a859899c6bce862a9ef8dcf725031f717ea628"
Unverified Commit d6277e4d authored by Dave Machado's avatar Dave Machado
Browse files

Update markdown parser to format each table index

parent c3459bb0
fs = require('fs') fs = require('fs')
function md_trim(str) { function md_trim(str, context = null) {
str = str.replace(/(^\s+)|(\s+$)/g, ""); str = str.replace(/(^\s+)|(\s+$)/g, "");
if (str.lastIndexOf("[Go!]", 0) === 0) {
if (context == 1) { // Name
// placeholder for any formatting on name value
} else if (context == 2) { // Description
str = str.replace(".", ""); // remove ending periods on descriptions
} else if (context == 3) { // Auth
if (str.toUpperCase() == "NO") {
str = null
} else {
str = str.replace("`", "").replace("`", "")
}
} else if (context == 4) { // HTTPS
if (str.toUpperCase() == "YES") {
str = true
} else {
str = false
}
} else if (context == 5) { // Link
str = str.replace("[Go!]", "").slice(1, -1); str = str.replace("[Go!]", "").slice(1, -1);
} }
return str; return str;
...@@ -64,9 +81,7 @@ function handle(filename, anchor) { ...@@ -64,9 +81,7 @@ function handle(filename, anchor) {
line = read_line() line = read_line()
if (line) { if (!line) {
} else {
console.error("markdown expect table spliter") console.error("markdown expect table spliter")
break; break;
} }
...@@ -76,7 +91,7 @@ function handle(filename, anchor) { ...@@ -76,7 +91,7 @@ function handle(filename, anchor) {
var line_this = line.split("|") var line_this = line.split("|")
var row = [] var row = []
for (var j in line_this) { for (var j in line_this) {
line_this[j] = md_trim(line_this[j]) line_this[j] = md_trim(line_this[j], j)
if ((j == 0 || j == line_this.length - 1) && line_this[j] === "") { if ((j == 0 || j == line_this.length - 1) && line_this[j] === "") {
} else { } else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment