From: rbt Date: Tue, 29 Jun 2004 16:40:40 +0000 (+0000) Subject: From: Bort, Paul X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=401e7000441e5f0521bc7295a4254a1e7b885231;p=postgresql-autodoc From: Bort, Paul 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. --- diff --git a/dia.tmpl b/dia.tmpl index 8c8ea6f..5078123 100644 --- a/dia.tmpl +++ b/dia.tmpl @@ -15,6 +15,12 @@ ## + + ## + + + + diff --git a/postgresql_autodoc.pl b/postgresql_autodoc.pl index 57a385c..1c6c81a 100755 --- a/postgresql_autodoc.pl +++ b/postgresql_autodoc.pl @@ -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, diff --git a/zigzag.dia.tmpl b/zigzag.dia.tmpl index 70327aa..66d1da0 100644 --- a/zigzag.dia.tmpl +++ b/zigzag.dia.tmpl @@ -15,6 +15,12 @@ ## + + ## + + + +