mirror of
https://github.com/Pomax/BezierInfo-2.git
synced 2025-08-28 10:40:52 +02:00
Update cleanup.js
This commit is contained in:
@@ -11,17 +11,15 @@ module.exports = function cleanUp(latex) {
|
||||
var indent = false;
|
||||
var lines = latex.split('\n').filter(line => !!line.trim());
|
||||
var clean = function(line, idx) {
|
||||
if(line.trim()) {
|
||||
if (!indent) {
|
||||
var matched = line.match(/^(\s+)/);
|
||||
if (matched) {
|
||||
indent = matched[0];
|
||||
}
|
||||
}
|
||||
if (indent) {
|
||||
lines[idx] = line.replace(indent,'').trim();
|
||||
if (!indent) {
|
||||
var matched = line.match(/^(\s+)/);
|
||||
if (matched) {
|
||||
indent = matched[0];
|
||||
}
|
||||
}
|
||||
if (indent) {
|
||||
lines[idx] = line.replace(indent,'').trim();
|
||||
}
|
||||
}
|
||||
lines.forEach(clean);
|
||||
latex = lines.join('\n');
|
||||
|
Reference in New Issue
Block a user