Latest post of the previous page:
Hmm. Seems like the encoding attribute is the problem. Once you remove it, everything is fine. I will have to remove it before the filter starts its work, I guess. Or something like that.Filters
- HaRT
- Moderator
- Posts: 10866
- Joined: Tue 30 Aug, 2005 17:21
- Has thanked: 221 times
- Been thanked: 358 times
Filters
I believe it does so. But that behavior is an obvious error as the encoding line clearly should not affect the result in this case.
So just removing the line looks more like a workaround rather than a fix.
Фар есть инструмент, а не нянька. © 2009 DrKnS
-
- Posts: 142
- Joined: Sun 20 Jun, 2010 12:37
- Has thanked: 49 times
- Been thanked: 7 times
Filters
JSON also works weird. The file contains a string
After pressing F5 we get
Code: Select all
{"sapcode":"133114"},{"sapcode":"132250"},{"sapcode":"133579"}
Code: Select all
{
"sapcode": "133114"
}
- HaRT
- Moderator
- Posts: 10866
- Joined: Tue 30 Aug, 2005 17:21
- Has thanked: 221 times
- Been thanked: 358 times
Filters
It is not a valid JSON file, as there must be a single top-level element, but the file has 3.stefanenko wrote: ↑Mon 28 Oct, 2019 23:57 JSON also works weird. The file contains a stringCode: Select all
{"sapcode":"133114"},{"sapcode":"132250"},{"sapcode":"133579"}
Фар есть инструмент, а не нянька. © 2009 DrKnS
-
- Posts: 142
- Joined: Sun 20 Jun, 2010 12:37
- Has thanked: 49 times
- Been thanked: 7 times
Filters
I already did everything through external utilities.
XML -> xmllint.exe
HTML -> tidy.exe
JSON -> over "echo json_encode(json_decode(file_get_contents($argv[1])), JSON_UNESCAPED_UNICODE+JSON_PRETTY_PRINT);"
XML -> xmllint.exe
HTML -> tidy.exe
JSON -> over "echo json_encode(json_decode(file_get_contents($argv[1])), JSON_UNESCAPED_UNICODE+JSON_PRETTY_PRINT);"
Last edited by stefanenko on Tue 29 Oct, 2019 05:42, edited 1 time in total.
Filters
Agreed.
Why should it be there? I mean, it's perfectly understandable that deviations from the standard should be mentioned, but why describe things which adhere to the standard?
That's exactly as intended. The internal filters are applicable without any external tools, but they may take some shortcuts due to the ways they are written; however, if a user encounters a case where the internal filters perform bad, they can always switch to external filters.stefanenko wrote: ↑Tue 29 Oct, 2019 05:42 I already did everything through external utilities.
XML -> xmllint.exe
HTML -> tidy.exe
JSON -> over "echo json_encode(json_decode(file_get_contents($argv[1])), JSON_UNESCAPED_UNICODE+JSON_PRETTY_PRINT);"
Filters
I need to perform some more testing and I would like to look into BASE64-decode (the trouble here is, how to deal with the different codepages in the editor), but other than that I am happy to announce that these bugs have been fixed:
- Incorrect plugin version in the Plugin Information dialog.
- XML with an "encoding" attribute causes invalid conversions of non-ASCII characters.
- JSON fails if the top element is an array.
Filters
Released version 0.05
- Fixed an incorrect plugin version info shown by the plugin list in Plugin Information (F3).
- XML filter: Fixed broken non-ASCII characters in XML files encoded in something else than UTF-8.
- JSON filter: Fixed a bug which caused a failure to filter in case the top element was an array.
- Support for selecting filters which don't match the specifications. For example, assuming the default settings for XML filters, only files with extensions such as .xml, .xsd etc. would previously be eligible for processing. In this version, even files with other extensions can be processed; however, these filters would be moved back in the list, leaving the specifications-matching filters in the front. Note that this functionality is only available from the plugin's main menu, not from the macro call - that always requires the specifications to match.
- Support for built-in BASE64 decoder. Note that the editor's encoding should be set to an 8-bit encoding (e.g. ANSI or OEM) for the best results.
Filters
I found a tool for formatting of the javascript-code: http://clang.llvm.org/docs/ClangFormat.html. It can be downloaded here: http://releases.llvm.org/download.html#git, by link "Windows (32-bit) (.sig)" (size: 139 Mb) or "Windows (64-bit) (.sig)". Next you need to extract the file clang-format.exe by using arclite or observer. Or you may use already extracted x86-version from the attachment.
Last edited by LAT on Mon 02 Dec, 2019 19:42, edited 1 time in total.
- HaRT
- Moderator
- Posts: 10866
- Joined: Tue 30 Aug, 2005 17:21
- Has thanked: 221 times
- Been thanked: 358 times
Filters
Thank you!
In general, it works, but there's a small cosmetic issue: if I autoformat an array, e.g.
[{"name":"value"},{"name":"value"}]
, I'm getting Code: Select all
[
{
"name": "value"
},{
"name": "value"
}]
Code: Select all
[
{
"name": "value"
},
{
"name": "value"
}
]
Are you in control of the formatter? Is it hard to improve this?
Фар есть инструмент, а не нянька. © 2009 DrKnS