mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-04-19 04:49:36 +00:00
Compare commits
2 commits
00a74ed96a
...
442a7aa235
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
442a7aa235 | ||
|
|
2226b72d1c |
5 changed files with 898 additions and 820 deletions
|
|
@ -33,7 +33,10 @@ export default class extends Controller {
|
||||||
{
|
{
|
||||||
let value = "";
|
let value = "";
|
||||||
if (this.unitValue) {
|
if (this.unitValue) {
|
||||||
value = "\\mathrm{" + this.inputTarget.value + "}";
|
//Escape percentage signs
|
||||||
|
value = this.inputTarget.value.replace(/%/g, '\\%');
|
||||||
|
|
||||||
|
value = "\\mathrm{" + value + "}";
|
||||||
} else {
|
} else {
|
||||||
value = this.inputTarget.value;
|
value = this.inputTarget.value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,9 @@ 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) {
|
||||||
tmp += '<span class="ms-2">' + katex.renderToString('[' + data.unit + ']') + '</span>'
|
let unit = data.unit.replace(/%/g, '\\%');
|
||||||
|
unit = "\\mathrm{" + unit + "}";
|
||||||
|
tmp += '<span class="ms-2">' + katex.renderToString('[' + unit + ']') + '</span>'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
896
composer.lock
generated
896
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -217,7 +217,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
|
||||||
|
|
||||||
$str = '';
|
$str = '';
|
||||||
$bracket_opened = false;
|
$bracket_opened = false;
|
||||||
if ($this->value_typical) {
|
if ($this->value_typical !== null) {
|
||||||
$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 && $this->value_min) {
|
if ($this->value_max !== null && $this->value_min !== null) {
|
||||||
$str .= $this->getValueMinWithUnit($latex_formatted).' ... '.$this->getValueMaxWithUnit($latex_formatted);
|
$str .= $this->getValueMinWithUnit($latex_formatted).' ... '.$this->getValueMaxWithUnit($latex_formatted);
|
||||||
} elseif ($this->value_max) {
|
} elseif ($this->value_max !== null) {
|
||||||
$str .= 'max. '.$this->getValueMaxWithUnit($latex_formatted);
|
$str .= 'max. '.$this->getValueMaxWithUnit($latex_formatted);
|
||||||
} elseif ($this->value_min) {
|
} elseif ($this->value_min !== null) {
|
||||||
$str .= 'min. '.$this->getValueMinWithUnit($latex_formatted);
|
$str .= 'min. '.$this->getValueMinWithUnit($latex_formatted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -449,7 +449,10 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu
|
||||||
if (!$with_latex) {
|
if (!$with_latex) {
|
||||||
$unit = $this->unit;
|
$unit = $this->unit;
|
||||||
} else {
|
} else {
|
||||||
$unit = '$\mathrm{'.$this->unit.'}$';
|
//Escape the percentage sign for convenience (as latex uses it as comment and it is often used in units)
|
||||||
|
$escaped = preg_replace('/\\\\?%/', "\\\\%", $this->unit);
|
||||||
|
|
||||||
|
$unit = '$\mathrm{'.$escaped.'}$';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str.' '.$unit;
|
return $str.' '.$unit;
|
||||||
|
|
@ -457,7 +460,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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue