3
我轉化網站包含具有固定寬度的內聯樣式和高度中的像素元件,例如:在氚中,我該如何做數學運算?
<div id="row1_column1" class="one-column" style="width:728px;height:1px;">
...
</div>
我想創建變換爲固定的像素尺寸的函數(例如,768px)成基於最大值的相對值(例如,75%)。我想是這樣寫的:
@func XMLNode.relativize_fixed_dimensions(Number %full_width, Number %full_height) {
attribute("style") {
value() {
replace(/width:\s*(\d)+px/) {
set(concat("width:", (%1/%full_width), "%"))
}
replace(/height:\s*(\d)+px/) {
set(concat("height:", (%1/%full_height), "%"))
}
}
}
}
然而,隨着每moovweb documentation,沒有類型,如數字,並沒有任何運營商,如/。
我想知道的是:是否有可能在氚中進行數學轉換,以便我可以實現我所需要的?
+1作爲功能請求。我遇到了非常相似的情況,最終訴諸於JavaScript。 – Ishan