Modified generation of webShowName
authorem.lee <em.lee@localhost>
Tue, 22 Jun 2010 10:01:35 +0000 (10:01 +0000)
committerem.lee <em.lee@localhost>
Tue, 22 Jun 2010 10:01:35 +0000 (10:01 +0000)
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTaxonExport.java

index 1758cc4001d03a66aabdce2680aacd1ccb3532ec..26288934a2762c7bc8b851b26232ded5b03f3560 100644 (file)
@@ -637,8 +637,6 @@ public class PesiTaxonExport extends PesiExportBase {
                                                                String specificEpithet = nonViralName.getSpecificEpithet();\r
                                                                String infraSpecificEpithet = nonViralName.getInfraSpecificEpithet();\r
                                                                \r
-                                                               boolean rankExists = false;\r
-\r
                                                                StringBuffer replaceFullName = new StringBuffer(fullName);\r
                                                                List<NamePosition> genusOrUninomialPosition = getPosition(genusOrUninomial, fullName);\r
                                                                List<NamePosition> infraGenericEpithetPosition = getPosition(infraGenericEpithet, fullName);\r
@@ -648,6 +646,8 @@ public class PesiTaxonExport extends PesiExportBase {
                                                                        replaceFullName.insert(0, italicBeginTag);\r
                                                                        \r
                                                                        if (nameExists(specificEpithetPosition)) {\r
+                                                                               boolean insertSpecificEpithetEndTag = true;\r
+\r
                                                                                if ((specificEpithet.equals(infraSpecificEpithet) && countPattern(infraSpecificEpithet, fullName) == 2) |\r
                                                                                                (! specificEpithet.equals(infraSpecificEpithet) && countPattern(infraSpecificEpithet, fullName) == 1)) {\r
                                                                                        // infraSpecificEpithet exists\r
@@ -677,14 +677,23 @@ public class PesiTaxonExport extends PesiExportBase {
                                                                                                                replaceFullName.insert(infraSpecificEpithetEndLocation + italicBeginTag.length(), italicEndTag);\r
                                                                                                        }\r
                                                                                                }\r
+                                                                                       } else if (rankPosition != null && ! nameExists(rankPosition)) {\r
+                                                                                               // Rank information does not exist\r
+                                                                                               insertSpecificEpithetEndTag = false;\r
+                                                                                               \r
+                                                                                               // Insert italicEndTag\r
+                                                                                               replaceFullName.insert(infraSpecificEpithetEndLocation + italicBeginTag.length(), italicEndTag);\r
                                                                                        }\r
                                                                                }\r
-                                                                               \r
-                                                                               int specificEpithetLocation = replaceFullName.indexOf(specificEpithet) + specificEpithet.length();\r
-                                                                               if (specificEpithetPosition.contains(NamePosition.end)) {\r
-                                                                                       replaceFullName.append(italicEndTag);\r
-                                                                               } else {\r
-                                                                                       replaceFullName.insert(specificEpithetLocation, italicEndTag);\r
+\r
+                                                                               // Insert an italicEndTag for the specificEpithet\r
+                                                                               if (insertSpecificEpithetEndTag) {\r
+                                                                                       int specificEpithetLocation = replaceFullName.indexOf(specificEpithet) + specificEpithet.length();\r
+                                                                                       if (specificEpithetPosition.contains(NamePosition.end)) {\r
+                                                                                               replaceFullName.append(italicEndTag);\r
+                                                                                       } else {\r
+                                                                                               replaceFullName.insert(specificEpithetLocation, italicEndTag);\r
+                                                                                       }\r
                                                                                }\r
                                                                        } else if (nameExists(infraGenericEpithetPosition)) {\r
                                                                                int infraGenericEpithetLocation = replaceFullName.indexOf(infraGenericEpithet) + \r