Fix parsing of numbers with plus sign
Some checks failed
Deploy Vite app to GitHub Pages / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-02-15 20:13:02 +01:00
parent 4440c1fc2b
commit 2df97bbcac

View File

@@ -32,7 +32,7 @@ const SVG_CONFIG = {
/**
* Parse input text and identify tab lines vs annotation lines
* Adds + signs to positive numbers in tab lines
* Adds + signs to positive numbers in tab lines (if not already present)
* Preserves empty lines for spacing
*/
const parseInput = (text) => {
@@ -42,13 +42,13 @@ const parseInput = (text) => {
// Check if line is empty
const isEmpty = line.trim().length === 0;
// Tab lines contain only numbers, spaces, minus signs, and bend markers
// Tab lines contain only numbers, spaces, +/- signs, and bend markers
const isTabLine =
/^[\s\d\-'"`'']+$/.test(line.trim()) && line.trim().length > 0;
/^[\s\d\+\-'"`'']+$/.test(line.trim()) && line.trim().length > 0;
let processedContent = line;
// Add + signs to positive numbers in tab lines
// Add + signs to positive numbers in tab lines (only if not already present)
if (isTabLine) {
processedContent = line.replace(
/(\s|^)(\d+)(['"`'']?)/g,