Compare commits

..

No commits in common. "442a7aa235f6a9d21385570255a06bf6cfc3539f" and "00a74ed96ad4a08f3c98ddb8c64fa3b4ce506b86" have entirely different histories.

5 changed files with 820 additions and 898 deletions

View file

@ -33,10 +33,7 @@ export default class extends Controller {
{ {
let value = ""; let value = "";
if (this.unitValue) { if (this.unitValue) {
//Escape percentage signs value = "\\mathrm{" + this.inputTarget.value + "}";
value = this.inputTarget.value.replace(/%/g, '\\%');
value = "\\mathrm{" + value + "}";
} else { } else {
value = this.inputTarget.value; value = this.inputTarget.value;
} }

View file

@ -85,9 +85,7 @@ export default class extends Controller
tmp += '<span>' + katex.renderToString(data.symbol) + '</span>' tmp += '<span>' + katex.renderToString(data.symbol) + '</span>'
} }
if (data.unit) { if (data.unit) {
let unit = data.unit.replace(/%/g, '\\%'); tmp += '<span class="ms-2">' + katex.renderToString('[' + data.unit + ']') + '</span>'
unit = "\\mathrm{" + unit + "}";
tmp += '<span class="ms-2">' + katex.renderToString('[' + unit + ']') + '</span>'
} }

896
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -217,7 +217,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
$str = ''; $str = '';
$bracket_opened = false; $bracket_opened = false;
if ($this->value_typical !== null) { if ($this->value_typical) {
$str .= $this->getValueTypicalWithUnit($latex_formatted); $str .= $this->getValueTypicalWithUnit($latex_formatted);
if ($this->value_min || $this->value_max) { if ($this->value_min || $this->value_max) {
$bracket_opened = true; $bracket_opened = true;
@ -225,11 +225,11 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
} }
} }
if ($this->value_max !== null && $this->value_min !== null) { if ($this->value_max && $this->value_min) {
$str .= $this->getValueMinWithUnit($latex_formatted).' ... '.$this->getValueMaxWithUnit($latex_formatted); $str .= $this->getValueMinWithUnit($latex_formatted).' ... '.$this->getValueMaxWithUnit($latex_formatted);
} elseif ($this->value_max !== null) { } elseif ($this->value_max) {
$str .= 'max. '.$this->getValueMaxWithUnit($latex_formatted); $str .= 'max. '.$this->getValueMaxWithUnit($latex_formatted);
} elseif ($this->value_min !== null) { } elseif ($this->value_min) {
$str .= 'min. '.$this->getValueMinWithUnit($latex_formatted); $str .= 'min. '.$this->getValueMinWithUnit($latex_formatted);
} }
@ -449,10 +449,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
if (!$with_latex) { if (!$with_latex) {
$unit = $this->unit; $unit = $this->unit;
} else { } else {
//Escape the percentage sign for convenience (as latex uses it as comment and it is often used in units) $unit = '$\mathrm{'.$this->unit.'}$';
$escaped = preg_replace('/\\\\?%/', "\\\\%", $this->unit);
$unit = '$\mathrm{'.$escaped.'}$';
} }
return $str.' '.$unit; return $str.' '.$unit;
@ -460,7 +457,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
return $str; return $str;
} }
/** /**
* Returns the class of the element that is allowed to be associated with this attachment. * Returns the class of the element that is allowed to be associated with this attachment.
* @return string * @return string

798
yarn.lock

File diff suppressed because it is too large Load diff