Skip to content

Commit

Permalink
Define border styles after defining prefix
Browse files Browse the repository at this point in the history
Some styles over-ride the prefix/suffix (wikimedia, specifically). Moved prefix definition earlier to allow border style to null out the prefix/suffix.
  • Loading branch information
dwesely committed Sep 14, 2018
1 parent fa88394 commit 844b12e
Showing 1 changed file with 64 additions and 60 deletions.
124 changes: 64 additions & 60 deletions assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,66 @@ function createTable() {
var hasRightSide = true; // Defaults to including the right side line
var topLineUsesBodySeparators = false; // Defaults to top line uses the same separators as the line between header and body
var align; // Default alignment: left-aligned

// Add comment/remark indicators for use in code":
prefix = "";
suffix = "";
switch (commenting) {
case "none":
break;
case "doubleslant":
// C++/C#/F#/Java/JavaScript/Swift
prefix = "// ";
break;
case "hash":
// Perl/PowerShell/Python/R/Ruby
prefix = "# ";
break;
case "doubledash":
// ada/AppleScript/Haskell/Lua/SQL
prefix = "-- ";
break;
case "percent":
// MATLAB
prefix = "% ";
break;
case "singlespace":
// wikimedia
prefix = " ";
break;
case "quadspace":
// reddit
prefix = " ";
break;
case "singlequote":
// VBA
prefix = "' ";
break;
case "rem":
// BASIC/DOS batch file
prefix = "REM ";
break;
case "c":
// Fortran IV
prefix = "C ";
break;
case "exclamation":
// Fortran 90
prefix = "! ";
break;
case "slantsplat":
// CSS
prefix = "/* ";
suffix = " */";
break;
case "xml":
// XML
prefix = "<!-- ";
suffix = " -->";
break;
default:
break;
}

// Map of variable locations in the output:
//
Expand Down Expand Up @@ -258,6 +318,10 @@ function createTable() {

hdV = "\n!"; hdH = "";
spV = "\n|"; spH = "";

// also remove prefix/suffix:
prefix = "";
suffix = "";
break;
case "unicode":
// unicode
Expand All @@ -283,66 +347,6 @@ function createTable() {
default:
break;
}

// Add comment/remark indicators for use in code":
prefix = "";
suffix = "";
switch (commenting) {
case "none":
break;
case "doubleslant":
// C++/C#/F#/Java/JavaScript/Swift
prefix = "// ";
break;
case "hash":
// Perl/PowerShell/Python/R/Ruby
prefix = "# ";
break;
case "doubledash":
// ada/AppleScript/Haskell/Lua/SQL
prefix = "-- ";
break;
case "percent":
// MATLAB
prefix = "% ";
break;
case "singlespace":
// wikimedia
prefix = " ";
break;
case "quadspace":
// reddit
prefix = " ";
break;
case "singlequote":
// VBA
prefix = "' ";
break;
case "rem":
// BASIC/DOS batch file
prefix = "REM ";
break;
case "c":
// Fortran IV
prefix = "C ";
break;
case "exclamation":
// Fortran 90
prefix = "! ";
break;
case "slantsplat":
// CSS
prefix = "/* ";
suffix = " */";
break;
case "xml":
// XML
prefix = "<!-- ";
suffix = " -->";
break;
default:
break;
}

// output the text
var output = "";
Expand Down

0 comments on commit 844b12e

Please sign in to comment.