]> granicus.if.org Git - postgresql-autodoc/commitdiff
From: Bort, Paul
authorrbt <rbt>
Tue, 29 Jun 2004 16:40:40 +0000 (16:40 +0000)
committerrbt <rbt>
Tue, 29 Jun 2004 16:40:40 +0000 (16:40 +0000)
Subject:  RE: Patch for Dia templates for Postgresql_AutoDoc
Date:  Tue, 22 Jun 2004 15:23:24 -0400

I've used the same method of shortening as the constraint you mentioned, but
I made it a new entry (table_comment_dia) in the hash rather than mangle the
existing one. I tried to follow the existing naming conventions and coding
style. I picked a total of 45 characters because that seems to be about the
right size on my screen. In testing I also found a bug in Dia that causes a
crash if a comment is too long, but that seems to be in the 100+ character
range, so I'm not worried about 45.

Here are the patches for postgresql_autodoc.pl, dia.tmpl, and
zigzag.dia.tmpl.

dia.tmpl
postgresql_autodoc.pl
zigzag.dia.tmpl

index 8c8ea6f324a9423259937b5d8d7cee656a930204..5078123ed4e9fb162c8479b0d83d9b6f24feec45 100644 (file)
--- a/dia.tmpl
+++ b/dia.tmpl
         <dia:string>#<!-- TMPL_VAR ESCAPE="HTML" name="schema" -->#</dia:string>
       </dia:attribute>
 <!-- /TMPL_IF name="number_of_schemas" -->
+      <dia:attribute name="comment">
+        <dia:string>#<!-- TMPL_VAR ESCAPE="HTML" name="table_comment_dia" -->#</dia:string>
+      </dia:attribute>
+      <dia:attribute name="visible_comments">
+        <dia:boolean val="true"/>
+      </dia:attribute>
       <dia:attribute name="abstract">
         <dia:boolean val="false"/>
       </dia:attribute>
index 57a385c26c3fd7455d3ad44f82e77089cd6015ad..1c6c81a4cce9499be8731c0db351b122bb892a84 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env perl
 # -- # -*- Perl -*-w
-# $Header: /cvsroot/autodoc/autodoc/postgresql_autodoc.pl,v 1.3 2004/06/03 01:46:28 rbt Exp $
+# $Header: /cvsroot/autodoc/autodoc/postgresql_autodoc.pl,v 1.4 2004/06/29 16:40:40 rbt Exp $
 #  Imported 1.22 2002/02/08 17:09:48 into sourceforge
 
 # Postgres Auto-Doc Version 1.23
@@ -1315,6 +1315,10 @@ sub write_using_templates
                        $tableids{"$schema$table"} = ++$object_id;
                        my $viewdef = sql_prettyprint($structure{$schema}{$table}{'VIEW_DEF'});
 
+                       # Truncate comment for Dia
+                        my $comment_dia = $structure{$schema}{$table}{'DESCRIPTION'};
+                       $comment_dia =~ s/^(.{35}).{5,}(.{5})$/$1 ... $2/g;
+
                        push @tables, {
                                object_id => $object_id,
                                object_id_dbk => docbook($object_id),
@@ -1343,6 +1347,7 @@ sub write_using_templates
                                table_sgmlid => sgml_safe_id(join('.', $schema, $structure{$schema}{$table}{'TYPE'}, $table)),
                                table_comment => $structure{$schema}{$table}{'DESCRIPTION'},
                                table_comment_dbk => docbook($structure{$schema}{$table}{'DESCRIPTION'}),
+                                table_comment_dia => $comment_dia,
                                view_definition => $viewdef,
                                view_definition_dbk => docbook($viewdef),
                                columns => \@columns,
index 70327aaa3df814dd10f30e90d359d4623e5fecc6..66d1da075b632c324c23b3d0f8fffc0727634841 100644 (file)
         <dia:string>#<!-- TMPL_VAR ESCAPE="HTML" name="schema" -->#</dia:string>
       </dia:attribute>
 <!-- /TMPL_IF name="number_of_schemas" -->
+      <dia:attribute name="comment">
+        <dia:string>#<!-- TMPL_VAR ESCAPE="HTML" name="table_comment_dia" -->#</dia:string>
+      </dia:attribute>
+      <dia:attribute name="visible_comments">
+        <dia:boolean val="true"/>
+      </dia:attribute>
       <dia:attribute name="abstract">
         <dia:boolean val="false"/>
       </dia:attribute>