From: Doug B. <dou...@gm...> - 2009-03-21 12:28:53
|
On Sat, Mar 21, 2009 at 8:15 AM, Gerald Britton <ger...@gm...>wrote: > I really, really don't like the start-stop way of working. Actually, > it is just because of the need to remember where you are, so to speak, > that I wrote the class in the first place. The Html class autocloses > every tag (that needs a closing tag -- not all do) at the just the > right time. This way, you can focus on your content rather than the > DOM structure. I completely agree. We don't want to think at the HMTL-level when writing large, complex documents. In fact, I've also written an html library from scratch, using ideas like: print tr(td("Webpage:") + td(input("url", url, size=65))) which uses nested structure rather than your .extend() method. -Doug I think you are right that the other HtmlDoc classes should derive > from Html. The Html class is concerned with structure and an easy way > to build up a page, piece by piece, rather than special methods for > special situations. I'll look into that. > > On Sat, Mar 21, 2009 at 5:59 AM, Benny Malengier > <ben...@gm...> wrote: > > > > > > 2009/3/21 Benny Malengier <ben...@gm...> > >> > >> Hi, > >> > >> I find it a pity you made this without talking about it first. > >> I need to extend src/docgen/HtmlDoc > >> I was hoping I could write that better, starting with a HtmlDocBase, of > >> which then derives a HtmlDocPrint for use as print output of the text > >> reports. I'd then investigate if something like webcal and nar web can > use > >> another derived class of HtmlDocBase to do their stuff, adding some > extra > >> methods as clearly they do more advanced things than the text reports > and > >> want more direct control over the html output. It would however allow > them > >> or others who want to write a web output to use the same methods as the > Doc > >> classes. > >> > >> HtmlDocBase would be the place I add a write_note class doing styled > notes > >> in html. One place to add this logic, as it should be. The same for > excaping > >> text before writing, .... > >> > >> We really have to stop adding things to GRAMPS without deprecating the > >> existing ways, it creates too much double maintenance. > >> In this case, we need html output which derives from BaseDoc.TextDoc and > >> BaseDoc.DrawDoc, so a reuse of that everywhere we write html is in > order. > >> > >> I therefore suggest you rewrite the Html class to make it a docgen > >> deriving from BaseDoc.TextDoc and BaseDoc.DrawDoc, call it HtmlDocBase, > and > >> then create a derivative of that for use in webcal, ... > >> You could perhaps even add this Html class in /src, then create a > >> HtmlDocBase class that derives from Html, BaseDoc.TextDoc and > >> BaseDoc.DrawDoc. > >> If you don't then I just have to do my own thing in HtmlDoc and I > support > >> that, while you support your stuff and someone hacks in style in notes > in > >> another way in nar web. That would be pity. > > > > I was looking it the old branch, things are now in src/plugins/docgen. > > > > Anyway, I presume it might be possible to rewrite HtmlDoc so it uses Html > > classes. > > However, the Doc classes use a start_el, end_el way of working, so the > start > > can do the setup, and the end can move to the element higher again. Not > sure > > this fits with the addition you use in Html. I like the start/end logic > > better myself. > > I see for example: > > > > table=Html(table style stuff) > > thead=Html(head style stuff) > > tr=Html(head style stuff _AND text) > > > > .... > > thead += tr > > table += thead > > > > I don't like that much to read and know at a certain addition where you > are. > > I'm afraid it becomes more difficult to read quickly. > > > > With start stop as it would be: > > > > start_table( table_style stuff) > > start_header(header style stuff) > > write # text to write > > stop_header() > > stop_table() > > > > That reads easily in code as it is nicely sequential, so good for dummies > > :-) . > > > > It might be interesting in this regard to look at the code Zsolt wrote > for > > cairo: src/plugins/lib/libcairodoc. Especially GtkDocBaseElement. > Obviously > > printing is much harder than just writing text (you need to first collect > > all text, then decide what will be on a page), I just point out some > > paradigms here. The other docgen implementation offer some other > paradigms. > > > > Benny > > > >> > >> 2009/3/20 ger...@gm... <ger...@gm...> > >>> > >>> I've shared a document with you called "Html class": > >>> http://docs.google.com/Doc?id=d6p7rnz_503hrg6jxhh&invite=137756891 > >>> > >>> It's not an attachment -- it's stored online at Google Docs. To open > this > >>> document, just click the link above. > >>> --- > >>> > >>> Dear Gramps Developers, > >>> > >>> Please have a look at the document refered to herein, that describes > work > >>> that Rob Healey and myself have been up to during the last few weeks, > and a > >>> new module -- html.py -- that came out of it. We invite questions, > >>> suggestions, critique and, above all, experimentation! > >>> > >>> > ------------------------------------------------------------------------------ > >>> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > >>> powering Web 2.0 with engaging, cross-platform capabilities. Quickly > and > >>> easily build your RIAs with Flex Builder, the Eclipse(TM)based > >>> development > >>> software that enables intelligent coding and step-through debugging. > >>> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > >>> _______________________________________________ > >>> Gramps-devel mailing list > >>> Gra...@li... > >>> https://lists.sourceforge.net/lists/listinfo/gramps-devel > >>> > >> > > > > > > > > -- > Gerald Britton > > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Gramps-devel mailing list > Gra...@li... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > |