View Single Post
Old 09-06-2015, 12:23 PM   #7
bmix
Member
bmix began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Mar 2014
Location: Budapest/Hungary
Device: Kindle4,reMarkable2,MoonReader Pro
Quote:
Originally Posted by kovidgoyal View Post
I dont see the difference. In either case you are applying an XSLT transform to the text.
We would be applying a 'search & replace' to the text also, if we'd use 'sed' instead of the 'search & replace' on the text in the editor.

Also, there is this: http://stackoverflow.com/questions/1...contained-tags ;-)

Using XML technology for editing X(HT)ML just seems logical to me. But it's not just about XSL. A function, that would allow to route currently opened editor document through external program and reload it, could make for many features, that the user can set up themselves. Something like this: https://packagecontrol.io/packages/FilterPipes

Quote:
Although, if I were you, I'd ditch XSLT and just directly use lxml. Much nicer to use than XSLT.
Well, niceness is a matter of taste ;-)

I am an XML author, not a Python coder. I work mainly with XML technologies (XProc, XPath, XSL, etc.). So I have much more experience here. Being natively developed for XML-transforms, using XSL, imho, is just more natural for XML than anything else.

So I would like to re-define my feature whish as:

Have currently opened document send to external program and reloaded upon successful completion.

If this can be implemented as a plugin, I will look into it, but since I am not a Python coder (and am busy with another, huge, project) I see not much chance, that I am going to be successful. What attribute would I need to get 'filename of frontmost document' ? Is it:

Code:
foo = calibre.gui2.tweak_book.boss.Boss.currently_editing
?

Thanks.

EDIT: I just realized, that for that, what I want to implement, I'd need a scratch-buffer, into which I quickly can add some XSLT. Is such a thing available? I should have explained this earlier, since this may make it more understandable, why I want it to be appliable from within the editor.

Last edited by bmix; 09-06-2015 at 12:33 PM. Reason: Added comment.
bmix is offline   Reply With Quote