Skip to content
This repository has been archived by the owner on Aug 7, 2023. It is now read-only.

Tidy arguments need to go before filename #111

Open
creationix opened this issue Aug 11, 2017 · 2 comments
Open

Tidy arguments need to go before filename #111

creationix opened this issue Aug 11, 2017 · 2 comments

Comments

@creationix
Copy link

I've got latest tidy compiled from source (to get the new --custom-tags flag.)

On the command line, it works as:

tidy --custom-tags blocklevel -utf8 index.html

But in atom, I set the flags to --custom-tags blocklevel -utf8 and it doesn't appear to make any difference.

I did notice that with tidy options need to come before the filename in the arguments. Perhaps this plugins is appending them at the end and thus they aren't taking effect?

@creationix
Copy link
Author

For now I've worked around it by changing the default option in the tidy binary:

diff --git a/src/config.c b/src/config.c
index f47e452..ad5257e 100644
--- a/src/config.c
+++ b/src/config.c
@@ -294,7 +294,7 @@ static const TidyOptionImpl option_defs[] =
     { TidyTabSize,                 PP, "tab-size",                    IN, 8,               ParseInt,          NULL                },
     { TidyUpperCaseAttrs,          MU, "uppercase-attributes",        IN, TidyUppercaseNo, ParsePickList,     &attributeCasePicks },
     { TidyUpperCaseTags,           MU, "uppercase-tags",              BL, no,              ParsePickList,     &boolPicks          },
-    { TidyUseCustomTags,           MU, "custom-tags",                 IN, TidyCustomNo,    ParsePickList,     &customTagsPicks    }, /* 20170309 - Issue #119 */
+    { TidyUseCustomTags,           MU, "custom-tags",                 IN, TidyCustomBlocklevel,    ParsePickList,     &customTagsPicks    }, /* 20170309 - Issue #119 */
     { TidyVertSpace,               PP, "vertical-space",              IN, no,              ParsePickList,     &autoBoolPicks      }, /* #228 - tri option */
     { TidyWarnPropAttrs,           MU, "warn-proprietary-attributes", BL, yes,             ParsePickList,     &boolPicks          },
     { TidyWord2000,                MU, "word-2000",                   BL, no,              ParsePickList,     &boolPicks          },

@Arcanemagus
Copy link
Member

Arcanemagus commented Aug 16, 2017

Actually this package doesn't send a file name at all, the equivalent of how it runs this would be:
cat index.html | tidy --required --arguments --then --your --custom --arguments

So it first supplies these:

linter-tidy/lib/main.js

Lines 10 to 15 in 16f4208

const defaultExecutableArguments = [
'-language', 'en',
'-quiet',
'-errors',
'--tab-size', '1',
];

And appends your custom ones here:

const parameters = defaultExecutableArguments.concat(configExecutableArguments);

Maybe the latest version requires a - on the end now? You can test if that fixes it by adding .push('-') to the end of line 62.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants