Index: mttroot/mtt/bin/trans/dia2abg.pl ================================================================== --- mttroot/mtt/bin/trans/dia2abg.pl +++ mttroot/mtt/bin/trans/dia2abg.pl @@ -428,11 +428,11 @@ $anon_id = 0; while (($id, $component) = each(%components)) { $component =~ s/\#//g; ($type, $name) = split (/:/, $component); if (! $name) { - $component = "${component}:mtt${type}_${anon_id}"; + $component = "${component}:mtt${component}_${anon_id}"; } $anon_id++; $components{$id} = $component; } @@ -458,12 +458,21 @@ } $start_label = $bond_id_start_label{$dia_bond_id}; $end_label = $bond_id_end_label {$dia_bond_id}; - $start_label =~ s/\#//g; - $end_label =~ s/\#//g; + # treat label as a comment if not enclosed by [ ] + if ($start_label !~ /\[.*\]/) { + $start_label = "[]"; + } + if ($end_label !~ /\[.*\]/) { + $end_label = "[]"; + } + + # ignore label if it is not enclosed by [] +# $start_label =~ s/[^[]*\[\([^]]*\)\]/[$1]/; +# $end_label =~ s/[^[]*\[\([^]]*\)\]/[$1]/; if ($bond_id_arrow_on_start{$dia_bond_id}) { $head_label = $end_label; $tail_label = $start_label; } else { @@ -567,10 +576,19 @@ $subnode = get_first_subnode_by_nodename_attribute(0,$attribute_node,$type); $subnode->setAttribute(val => $new_value); # return $subnode->getAttributeNode("val")->getValue; } + +sub get_dia_attribute_string { + my ($attribute) = @_; + my ($str_elem, $string); + $str_elem = get_first_element_subnode($attribute); + $string = get_first_text_subnode($str_elem)->getData; + $string =~ s/\#//g; + return $string; +} sub get_arrow_info { my ( $object_node, $id, $id_index )= @_; my($attribute,$attributes); @@ -583,18 +601,15 @@ $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "flow_causality"); change_causality($id_index, $attribute, $change_flow_causality); $bond_id_flow_causality{$id} = defined($attribute) ? get_dia_attribute_value("dia:enum",$attribute)-1 : 1; -# $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "start_label"); -# $bond_id_start_label{$id} = defined($attribute) ? get_dia_attribute_value("dia:string") : "[]"; - $bond_id_start_label{$id} = "[]"; # FIXME! - -# $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "end_label"); -# $bond_id_end_label{$id} = defined($attribute) ? get_dia_attribute_value("dia:string") : "[]"; - $bond_id_end_label{$id} = "[]"; # FIXME! - + $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "start_label"); + $bond_id_start_label{$id} = defined($attribute) ? get_dia_attribute_string($attribute) : "[]"; + + $attribute = get_first_subnode_by_nodename_attribute(1,$object_node, "dia:attribute", "name", "end_label"); + $bond_id_end_label{$id} = defined($attribute) ? get_dia_attribute_string($attribute) : "[]"; } sub change_causality() { my ($id_index, $attribute_node, $causality_change_string)=@_; my ($mtt_id, $arrow_oriented_causality);