-
Notifications
You must be signed in to change notification settings - Fork 62
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 utility to render the OFX file to HTML #15
Comments
Wouldn't just |
Sounds good to me. Do you think you'd later accept a pull request providing the command-line option? |
Don't ask me, I have nothing to do with this project (aside from maintaining one plugin for it). |
Sorry- just automatically thought I was responding to Andrey. A contrib is a good start; however I think a command-line option would be useful. |
I used Lets start with contrib. @petri, what is your use case for command line option? Is it just for debugging? |
Ah thanks I will take a look at ofxdump. Too bad there's no OSX version. Initial use case is debug yes; however I plan to add a bit nicer HTML UI for end users for a quick review of their statement history, perhaps indexed in various ways, etc. Personal itch as well (I know - duplicating what GnuCash does to some extent). |
@petri, can you post a script that will actually apply xslt template on ofx file? |
The bash script I posted in issue #16 does that using xsltproc, invoked thus: xsltproc transformer.xslt infile.ofx > outfile.html Or do you mean a Python script? |
Here's how to invoke the transform from Python, using lxml: from contextlib import contextmanager
from lxml import etree
@contextmanager
def xml(filename):
with open(filename) as xmlfile:
yield etree.XML(xmlfile.read())
with xml("transform.xslt") as transformer:
transform = etree.XSLT(transformer)
with xml("out.ofx") as ofx:
print(transform(ofx)) |
Thanks. I just wanted to look at the html it produces. Looks good. I think I'll accept a patch that adds --preview flag to Would it make sense to you? Or you want to store HTMLs somewhere for later access? |
I think for storing HTML I will run the parser(s) directly, as my use case requires access to the original transaction types, before they are mapped to types accepted by OFX. So a preview flag would make sense, yes. Installation of the lxml package has historically been problematic, but perhaps those issues are a thing of the past by now. We can of course choose to not require lxml in setup.py, opting to just checking for it when user gives the --preview flag. So users not needing preview are not automatically forced to install lxml. |
Yeah, lxml requires compiling C module, something that I'd like to avoid for such a non-essential feature. So I agree, let's put lxml to "extras_require" and check presence when user asks to --preview. |
I could not find such a utility, so I put together a XSLT transformation for debugging the OFX generated by ofxstatement from the input from the plugins I'm converting.
See here: https://gist.github.com/petri/7300330
Feel free to include in the project if you like. I will very likely improve it further; just wanted to contribute now that it's somewhat useful already.
It might be nice to add a command-line option to ofxstatement that uses the transform to generate a HTML representation?
The text was updated successfully, but these errors were encountered: