Discussion:
[wikidPad] problems creating a hook to remove whitespaces from page content before saving
bjornjobb@gmail.com [wikidPad]
2018-01-28 07:11:57 UTC
Permalink
Hi, I am trying to strip whitespace from pages before saving. I dont seem to be able to get this right.
I am able to get the text, but setting it does not work for me. Help appreciated ! /bjorn




def savingWikiWord(wikidPad, wikiWord):
"""
Called when a new or existing wiki word is about to be saved


wikidPad -- PersonalWikiFrame object
wikiWord -- name of the wiki word to create
"""
pass
ed = wikidPad.getActiveEditor()
stripped = ed.GetText().strip()
print stripped
#ed.SetText(stripped)

wikidPad.saveDocPage(wikiWord)
Ross xkjq@ymail.com [wikidPad]
2018-01-30 21:05:26 UTC
Permalink
Hi,

Is the savingWikiWord hook working at all?

There's a bug that seems to have been around for a while in the old
plugin hooks registration.

To fix, fix the typos in

newWikiWord=None, openedWikiWord=None, savingWikiWor=None,

in lib/pwiki/PersonalWikiFrame.py


Ross
Post by ***@gmail.com [wikidPad]
Hi, I am trying to strip whitespace from pages before saving. I dont
seem to be able to get this right.
I am able to get the text, but setting it does not work for me. Help appreciated ! /bjorn
    """
    Called when a new or existing wiki word is about to be saved
    wikidPad -- PersonalWikiFrame object
    wikiWord -- name of the wiki word to create
    """
    pass
    ed =  wikidPad.getActiveEditor()
    stripped = ed.GetText().strip()
    print stripped
    #ed.SetText(stripped)
    wikidPad.saveDocPage(wikiWord)
Loading...