Is it possible to format / fuse html in ruby?

Is it possible to format or re-specify html in RubyMine 3.2.4? I tried Code... Reformat Code , but it does nothing for HTML. Do I need a plugin?

+4
source share
3 answers

He works.

Using the standard 404.html file that is generated:

 <!DOCTYPE html> <html> <head> <title>The page you were looking for doesn't exist (404)</title> <style type="text/css"> body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } div.dialog { width: 25em; padding: 0 4em; margin: 4em auto 0 auto; border: 1px solid #ccc; border-right-color: #999; border-bottom-color: #999; } h1 { font-size: 100%; color: #f00; line-height: 1.5em; } </style> </head> <body> <!-- This file lives in public/404.html --> <div class="dialog"> <h1>The page you were looking for doesn't exist.</h1> <p>You may have mistyped the address or the page may have moved.</p> </div> </body> </html> 

I used the Code / Reformat parameter, and this led to the following:

 <!DOCTYPE html> <html> <head> <title>The page you were looking for doesn't exist (404)</title> <style type="text/css"> body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; } div.dialog { width: 25em; padding: 0 4em; margin: 4em auto 0 auto; border: 1px solid #ccc; border-right-color: #999; border-bottom-color: #999; } h1 { font-size: 100%; color: #f00; line-height: 1.5em; } </style> </head> <body> <!-- This file lives in public/404.html --> <div class="dialog"> <h1>The page you were looking for doesn't exist.</h1> <p>You may have mistyped the address or the page may have moved.</p> </div> </body> </html> 

You can see how he reformatted the styles in particular (and if I change line breaks, etc., he also fixes them).

If you go to the file / settings, settings / IDE editor, make sure that the "Convert Code Dialog Box" option is checked [x], try again. Can it be set only to correct the selected text? Or ...

+4
source

You can use ⌘ + ⌥ + l for keyboard shortcuts.

+2
source

You can change the html formatting options in the "Project Settings> Code Style> HTML" section.

For example: you can resize tabs, indent, etc.

If you are on OSx, you can use the ⌘ + shortcut,

Another suggestion: try renaming the file before formatting (removing .erb from it)

0
source

Source: https://habr.com/ru/post/1380870/


All Articles