tags:

views:

71

answers:

1

I in a large codebase of an application written in perl there is a lot of HTML and JS written inline in the perl file.

$html_str = qq^ <A LOT OF HTML> ^;

All the code development in done using Eclipse IDE and EPIC plugin. For ease of merging/diffs et al, I am looking for a way to tell the EPIC source formatter not to apply formatting rules to the HTML and JS that is written inline. Is there a way to do this?

+4  A: 

HTML embedded in the code is a red flag. That's stuff a designer is going to want to tweak, and so should be able to get at easily. The HTML should be split out into template files. I realize this doesn't answer your question, but it does solve your problem.

Otherwise, use perltidy to handle Perl code formatting. It won't mess with content inside strings and certainly isn't going to try and format HTML.

Schwern
@Schwern You have no idea how much I wish all the HTML was in template files. But this one is a legacy application that has HTML spilled all over. All new functionality that is being added uses best practices but here is just no time to refactor old code.I am already using EPIC that uses perltidy for source formatting. My problem is.. it does mess with the HTML within the string variables. Since this HTML is very long most of the times perltidy would trim it to whatever is the max line size. I want a way to tell perltidy to skip some section from formatting??
Wikidkaka
How about using vim for fixing formatting. See this macro to run perltidy on a region: http://stackoverflow.com/questions/1573782/what-are-your-suggestions-for-an-ideal-vim-configuration-for-perl-development/1582585#1582585
Sinan Ünür