Skip to content

Update AbstractParameter.php#959

Merged
jbtronics merged 5 commits intoPart-DB:masterfrom
d-buchmann:fix-parameter-display
Jul 5, 2025
Merged

Update AbstractParameter.php#959
jbtronics merged 5 commits intoPart-DB:masterfrom
d-buchmann:fix-parameter-display

Conversation

@d-buchmann
Copy link
Copy Markdown
Contributor

@d-buchmann d-buchmann commented Jul 1, 2025

Make lazy null conditionals explicit, thus enabling output of 0 as parameter value.
Try to handle LaTeX special chars gracefully (especially %, as seen in the referenced issue).
Fixes #958

(Javascript code will need some work too: the LaTeX controllers also don't handle special chars.
The parameter selection drop-down show some params incorrectly, e.g. Tolerance [%] shows as Tolerance[.
The parameter preview shows an error e.g. when entering %; With \%, it works.)

Make lazy null conditionals explicit.
Try to handle LaTeX special chars gracefully.
Fixes Part-DB#958
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.86%. Comparing base (c445359) to head (39b0e85).
Report is 3 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #959      +/-   ##
============================================
+ Coverage     59.73%   59.86%   +0.13%     
- Complexity     6036     6038       +2     
============================================
  Files           529      529              
  Lines         20588    20603      +15     
============================================
+ Hits          12298    12334      +36     
+ Misses         8290     8269      -21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jbtronics
Copy link
Copy Markdown
Member

I think it is not useful to escape all latex characters, as you then cannot use latex in units anymore at all (which was the whole point for using latex for formatting the units). For simple units you don't need it, but for something like $nV/\sqrt{Hz}$, latex is very useful.

I changed it in a way, that only the percentage sign gets escaped, as it is very unlikely that somebody wants to put a comment into a unit, and it will be more likely used as a percentage sign.

@d-buchmann
Copy link
Copy Markdown
Contributor Author

d-buchmann commented Jul 3, 2025

Make perfect sense.
I still have one small edit though: % inside the regex needn't be escaped, but if the user already escaped the percent sign, it would result in \\%, which we don't want.
Therefore capture and replace an optional backslash before the percentage sign as well.

@d-buchmann d-buchmann force-pushed the fix-parameter-display branch from 888ce3c to 02409f4 Compare July 3, 2025 06:52
@jbtronics jbtronics merged commit 2226b72 into Part-DB:master Jul 5, 2025
14 checks passed
@d-buchmann d-buchmann deleted the fix-parameter-display branch September 10, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parameter value '0' not shown in parameter tab

2 participants