en:devmon:guidelines:tidy
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| en:devmon:guidelines:tidy [2021/08/19 22:54] – [Tidy Code] adminw1k1 | en:devmon:guidelines:tidy [2021/08/22 14:35] (current) – [Tidy Document] adminw1k1 | ||
|---|---|---|---|
| Line 68: | Line 68: | ||
| * Autoformat | * Autoformat | ||
| + | |||
| + | === Current Best Practice with autoformat === | ||
| + | * 78 char per line | ||
| + | * (stating at pos 0) | ||
| === Installation === | === Installation === | ||
| Line 74: | Line 78: | ||
| cpanm install Text:: | cpanm install Text:: | ||
| </ | </ | ||
| + | |||
| + | Create the following script: (I named it: autoformat.pl) | ||
| + | < | ||
| + | # | ||
| + | # Minimal use: read from STDIN, format to STDOUT... | ||
| + | use strict; | ||
| + | use Text:: | ||
| + | my $str = do { local $/; < | ||
| + | my $out = autoformat $str, {left=> | ||
| + | print $out; | ||
| + | </ | ||
| + | |||
| + | And now you can format any text or markdown (this will not rendered in a Markdown reader, but Markdown files becomes more readable when they are read " | ||
| + | |||
| + | Make your script exectutable | ||
| + | < | ||
| + | chmod +x autoformat.pl | ||
| + | </ | ||
| + | |||
| + | And test it! | ||
| + | |||
| + | < | ||
| + | autoformat.pl < unformated.txt > formated.txt | ||
| + | autoformat.pl < unformated.md > formated.md | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
en/devmon/guidelines/tidy.1629406459.txt.gz · Last modified: 2021/08/19 22:54 by adminw1k1