From: Benny M. <ben...@gm...> - 2010-01-10 11:32:55
|
2010/1/10 Peter Landgren <pet...@te...>: > Benny, > > There is no __init__ in AsciiDoc.py. > Is it enough with > def __init__(): > __note_format = None BaseDoc has an init, so def __init__(self): BaseDoc.__init__(self) self.__note_format = None Benny > > ? > > I will provide examples with "before" and "after" my work. > > /Peter > >> Peter, >> >> It hurts my head to think about this again. >> About Asciidoc patch, you make __note_format a class variable, it >> should be an instance variable as you use it as that, so set it in >> __init__. >> >> Otherwise, the patch does no strange things. I'd have to see the bug >> in output to know what you want to achieve, but I trust you when you >> say there is a mishandling and this fixes it. >> >> Benny >> >> 2010/1/6 Peter Landgren <pet...@te...>: >> > Benny, >> > (see below) >> > >> > <snip> >> > >> >> > In many places of text output, the text is cleaned before writing. >> >> > Apparently the reformat_para does this here. >> >> > Some things are not ok: >> >> > >> >> > 1/for preformatted text, reformat_para should not be called, it >> >> > destroys the preformatting >> >> > >> >> > 2/for something that is not a note, reformat_para should not remove \n >> >> > or whitespace. >> >> > >> >> > 3/only for real notes that are not preformatted should \n and >> >> > whitespace be removed. >> >> > >> >> > I would suggest to change things as follows: >> >> > >> >> > 1/In write_note, set a self.__note = True, and set self.__format = >> >> > format, unset that at end of note >> >> > 2/in end_paragraph, only if not preformatted note, do as now. For a >> >> > preformatted note, do no cleaning of the paragraph, just print it or >> >> > add line per line to the cell. >> >> > 3/if not a note is being written, then split on \n, and print the >> >> > line, if in a cell, add line per line to the cell. >> >> > >> >> > So something like: >> >> > >> >> > if not self.__format == 'the preformat format' >> >> > if not self.__note >> >> > old_lines = para.split('\n') >> >> > else: >> >> > old_lines = [para] >> >> > for line in old_lines: >> >> > words = line.split() >> >> > #do as now ... >> >> > else: >> >> > for line in para.split(\n) >> >> > lines.append(line) >> >> > #continue >> >> > if just == >> >> > >> >> > Benny >> >> >> >> OK. >> >> I have assigned >> >> http://www.gramps-project.org/bugs/view.php?id=2848 >> >> to me. >> >> I see what I can do. >> >> /Peter >> > >> > This fall we discussed this issue. I have had it in my backlog since. >> > Now I took some time to look at it and I think we were talking about two >> > different notes. >> > Preformatted Notes and the references lines within Endnotes. >> > >> > So I did a test using individ_complete report to look at these two >> > features. >> > >> > Preformatted Endnotes;lines with references Comments >> > ------------------------------------------------------------------------- >> >--------- HTML, Firefox etc OK NOT OK; all references on one line >> > Is OK i branch! >> > ------------------------------------------------------------------------- >> >--------- ODT, OOWriter OK OK >> > ODT, Kword OK OK >> > ------------------------------------------------------------------------- >> >--------- PDF, Adobe Reader OK OK >> > PDF, okular OK OK >> > ------------------------------------------------------------------------- >> >--------- RTF, OOWriter Not OK OK Many errors >> > RTF, AbiWord Not OK OK >> > RTF, KWord OK? OK Many errors >> > ------------------------------------------------------------------------- >> >--------- TXT, kwrite Not OK NOT OK; all references on one line >> > Double spaced >> > lines >> > ------------------------------------------------------------------------- >> >--------- >> > >> > After step 1, which only influenced AsciiDoc: >> > ------------------------------------------------------------------------- >> >--------- TXT, kwrite OK NOT OK; all references on one line >> > ------------------------------------------------------------------------- >> >--------- >> > >> > After step 2, which only influenced _Endnotes.py >> > >> > Preformatted Endnotes;lines with references Comments >> > ------------------------------------------------------------------------- >> >--------- HTML, Firefox etc OK OK >> > ------------------------------------------------------------------------- >> >--------- ODT, OOWriter OK OK >> > ODT, Kword OK OK >> > ------------------------------------------------------------------------- >> >--------- PDF, Adobe Reader OK OK >> > PDF, okular OK OK >> > ------------------------------------------------------------------------- >> >--------- RTF, OOWriter Not OK OK Many errors >> > RTF, AbiWord Not OK OK >> > RTF, KWord Missing OK Many errors >> > ------------------------------------------------------------------------- >> >--------- TXT, kwrite OK OK >> > ------------------------------------------------------------------------- >> >--------- >> > >> > I have also large generated det_ancestor reports and they look OK with >> > two comments: >> > RTF is not working well. >> > HTML some text and image overlap. >> > Images are made square,looks like projected through a cinemascope lens! >> > >> > Patch files are attached. >> > >> > I'm not sure these fixes are in line with Gramps coding practice, >> > however, they are small. >> > Comments? >> > >> > /Peter > > |