View Single Post
Old 11-24-2015, 02:19 AM   #2
jbacelar
Interested in the matter
jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.jbacelar ought to be getting tired of karma fortunes by now.
 
jbacelar's Avatar
 
Posts: 421
Karma: 426094
Join Date: Dec 2011
Location: Spain, south coast
Device: Pocketbook InkPad 3
I also use file_name (full) for note IDs. But, because you need to remove the extension?

To extract notes from all files and dump them in a specific file (notas.xhtml), as I have not sufficient knowledge of Python, I do the following:
1- I make notas.xhtml
2- I use this regex-function
Code:
#Searching: (<p class="nota".+?>.+?</p>)

def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs):
    notas = open('e:/Libros/Taller/En curso/notas.txt', 'a')
    texto = match.group()+'\n'  
    notas.write(texto)
    return ''
replace.file_order = 'spine'
3- I do copy-paste of notas.txt to notas.xhtml

And sorry for my english.
jbacelar is offline   Reply With Quote