TransWikia.com

How to display decimals as fractions?

Craft CMS Asked by ponies on September 4, 2021

Is there a twig filter to display decimal values as fractions?

One Answer

Turns out there's a plugin for that. Typography, by nystudio107.

https://nystudio107.com/docs/typogrify/#using-typogrify

===== edit =====

I was never able to get this working with typogrify. It never treated a period immediately surrounded by numbers as a decimal point.

It did inspire me to write a plugin, Fractionalize, to provide a '|fractionalize' filter which does the trick.

Answered by ponies on September 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP