Skip to content

Processes slim templates into appropriately formatted and indented Ruby code

License

Notifications You must be signed in to change notification settings

omarluq/sx-processor

Repository files navigation

SxProcessor

SxProcessor is a Ruby class that processes SLIM templates and converts them into Ruby code. It interprets the symbolic expression (sxp) structure of a SLIM template and translates it into appropriately formatted and indented Ruby code.

Credits

This project was influenced by slim-lint. The SxProcessor borrows from how slim-lint implemented their Ruby extractor. We appreciate their work and contributions to the open source community.

Usage

  - if items.any?
    table id=items class='table yellow'
    - for item in items
      tr
        td.name = item.name
        td.price = item.price
    - else
      p 'No items found.'

The above SLIM template is processed to the following Ruby code:

 if items.any?
       
   for item in items
       
           item.name
           item.price
 else
     'No items found.'

Testing

Tests are written using Minitest. To run the tests, navigate to the project directory in your terminal and run:

ruby -Ilib -Itest test/sx-processor_test.rb

License

This code is licensed under the terms of the MIT license. See the LICENSE.md file for details.

About

Processes slim templates into appropriately formatted and indented Ruby code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages