-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add new lines to the start and end of each structured text section #23
Conversation
This is well implemented and a good addition, thank you! |
00bb8b1
to
4e4bdff
Compare
No problem. I removed the versioneer updates as you didn't update in your most recent PR either. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things I like:
- Works as advertised! (if you modify slightly to make the hook entry and the python file names match as per my other comment)
- The resulting files are still readable by TwinCAT and compile normally
Things I'm not crazy about (still going to merge regardless):
- Since lxml modifies the xml header, this actually applies to every POU on every commit as it continually fights TwinCAT. This isn't a unique problem to this PR though, the xml formatter has the same thing. Maybe some day I'll come back through and figure out how to (if it is possible?) to make lxml behave.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be named twincat_st_newline.py
for setup.py
to automatically pick it up and provide it to pre-commit
as a console script. (The entry names are generically mapped to module names).
@@ -9,12 +9,13 @@ repos: | |||
files: \.(TcPOU|TcDUT|TcGVL)$ | |||
|
|||
- repo: https://github.com/pcdshub/pre-commit-hooks.git | |||
rev: v1.4.0 | |||
rev: v1.5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for updating these too!
merging and then I'm going to make a mini follow-up PR to rename the file so it will run from the thank you for your contribution and your patience! |
Addresses #10. Works upon ST declaration and implementations, with the
--lines
argument for specifying additional\n
.Two modifications occur from the use ElementTree.Write:
<?xml version="1.0" encoding="utf-8"?>
becomes
<?xml version='1.0' encoding='UTF-8'?>
Id
attributes lose a space at their end<Folder Name="internal" Id="{ad4fec99-008a-4786-b366-d1f41be17bb4}" />
becomes
<Folder Name="internal" Id="{ad4fec99-008a-4786-b366-d1f41be17bb4}"/>