Skip to content

Commit f63cd6c

Browse files
committed
wiki: Fix in->mm and mm->in conversions
Fixes funny accidents like `1602 mm` instead of `160.02 mm`. Change-Id: I595eec0ad40fa94693bdef03f55422788f74a451
1 parent 987e2fb commit f63cd6c

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

Diff for: _includes/snippets/dimensions.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{%- if modelname %}
22
<b>{{ modelname }}</b><br/>
33
{%- endif %}
4-
{{ dimension_data.height }} mm ({{ dimension_data.height | divided_by: 25.4 | round: 2 | remove: ".0" }} in) (h)<br/>
5-
{{ dimension_data.width }} mm ({{ dimension_data.width | divided_by: 25.4 | round: 2 | remove: ".0" }} in) (w)<br/>
6-
{{ dimension_data.depth }} mm ({{ dimension_data.depth | divided_by: 25.4 | round: 2 | remove: ".0" }} in) (d)
4+
{{ dimension_data.height }} mm ({{ dimension_data.height | mm_to_in }} in) (h)<br/>
5+
{{ dimension_data.width }} mm ({{ dimension_data.width | mm_to_in }} in) (w)<br/>
6+
{{ dimension_data.depth }} mm ({{ dimension_data.depth | mm_to_in }} in) (d)

Diff for: _includes/snippets/screen.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{%- if modelname %}
22
<b>{{ modelname }}</b><br/>
33
{%- endif %}
4-
{{ screen_data.size }} in ({{ screen_data.size | times: 25.4 | round: 2 | remove: ".0" }} mm)<br/>
4+
{{ screen_data.size }} in ({{ screen_data.size | in_to_mm }} mm)<br/>
55
{{ screen_data.resolution }} ({{ screen_data.resolution | ppi: screen_data.size }} PPI)<br/>
66
{{ screen_data.technology }} {% if screen_data.refresh_rate %}(max. {{ screen_data.refresh_rate }} Hz){% endif %}

Diff for: _plugins/jekyll-size.rb

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module Jekyll
2+
module Size
3+
def in_to_mm(value)
4+
(value * 25.4).round(2).to_s().chomp('.0')
5+
end
6+
7+
def mm_to_in(value)
8+
(value / 25.4).round(2).to_s().chomp('.0')
9+
end
10+
end
11+
end
12+
13+
Liquid::Template.register_filter(Jekyll::Size)

0 commit comments

Comments
 (0)