<p><b>dwj07@fsu.edu</b> 2013-03-20 11:21:27 -0600 (Wed, 20 Mar 2013)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Adding logic to allow underscores and equations in description fields.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/tools/python_scripts/namelist_generation/parse_xml_registry.py
===================================================================
--- branches/tools/python_scripts/namelist_generation/parse_xml_registry.py        2013-03-20 13:48:20 UTC (rev 2633)
+++ branches/tools/python_scripts/namelist_generation/parse_xml_registry.py        2013-03-20 17:21:27 UTC (rev 2634)
@@ -67,15 +67,35 @@
                try:
                        dim_units = dim.attrib['units']
+                        if dim_units == "":
+                                dim_units = latex_missing_string
+                        else:
+                                dim_units = "$%s$"%dim_units
                except:
                        dim_units = latex_missing_string
                if dim_description == "":
                        dim_description = latex_missing_string
+                else:
+                        equations = dim_description.find('$')
+                        if equations != -1:
+                                dim_desc_split = dim_description.split("$")
-                if dim_units == "":
-                        dim_units = latex_missing_string
+                                if dim_description.replace('_','')[0] == "$":
+                                        replace = False
+                                        dim_description = "$"
+                                else:
+                                        replace = True
+                                        dim_description = ""
+                                for part in dim_desc_split:
+                                        if replace:
+                                                dim_description = "%s %s"%(dim_description, part.replace('_','\_'))
+                                                replace = False
+                                        else:
+                                                dim_description = "%s $%s$"%(dim_description, part)
+                                                replace = True
+
                latex.write('        %s & %s & %s \\\\ </font>
<font color="black">'%(dim_name.replace('_','\_'), dim_units.replace('_','\_'), dim_description.replace('_','\_')))
                latex.write('        \hline</font>
<font color="gray">')
@@ -121,7 +141,26 @@
                if opt_description == "":
                        opt_description = latex_missing_string
+                else:
+                        equations = opt_description.find('$')
+                        if equations != -1:
+                                opt_desc_split = opt_description.split("$")
+                                if opt_description.replace('_','')[0] == "$":
+                                        replace = False
+                                        opt_description = "$"
+                                else:
+                                        replace = True
+                                        opt_description = ""
+
+                                for part in opt_desc_split:
+                                        if replace:
+                                                opt_description = "%s %s"%(opt_description, part.replace('_','\_'))
+                                                replace = False
+                                        else:
+                                                opt_description = "%s $%s$"%(opt_description, part)
+                                                replace = True
+
                latex.write('        \hyperref[subsec:nm_sec_%s]{%s} & %s \\\\</font>
<font color="black">'%(opt_name, opt_name.replace('_','\_'), opt_description.replace('_', '\_')))
                latex.write('        \hline</font>
<font color="gray">')
@@ -153,6 +192,10 @@
                try:
                        opt_units = nml_opt.attrib["units"]
+                        if opt_units == "":
+                                opt_units = latex_missing_string
+                        else:
+                                opt_units = "$%s$"%opt_units
                except:
                        opt_units = latex_missing_string
@@ -164,12 +207,29 @@
                if opt_possible_values == "":
                        opt_possible_values = latex_missing_string
-                if opt_units == "":
-                        opt_units = latex_missing_string
                if opt_description == "":
                        opt_description = latex_missing_string
+                else:
+                        equations = opt_description.find('$')
+                        if equations != -1:
+                                opt_desc_split = opt_description.split("$")
+                                if opt_description.replace('_','')[0] == "$":
+                                        replace = False
+                                        opt_description = "$"
+                                else:
+                                        replace = True
+                                        opt_description = ""
+
+                                for part in opt_desc_split:
+                                        if replace:
+                                                opt_description = "%s %s"%(opt_description, part.replace('_','\_'))
+                                                replace = False
+                                        else:
+                                                opt_description = "%s $%s$"%(opt_description, part)
+                                                replace = True
+
                latex.write('\subsection[%s]{\hyperref[sec:nm_tab_%s]{%s}}</font>
<font color="black">'%(opt_name.replace('_','\_'),rec_name,opt_name.replace('_','\_')))
                latex.write('\label{subsec:nm_sec_%s}</font>
<font color="black">'%opt_name)
                latex.write('\\begin{center}</font>
<font color="gray">')
@@ -220,7 +280,26 @@
                        if var_description == "":
                                var_description = latex_missing_string
+                        else:
+                                equations = var_description.find('$')
+                                if equations != -1:
+                                        var_desc_split = var_description.split("$")
+                                        if var_description.replace('_','')[0] == "$":
+                                                replace = False
+                                                var_description = "$"
+                                        else:
+                                                replace = True
+                                                var_description = ""
+
+                                        for part in var_desc_split:
+                                                if replace:
+                                                        var_description = "%s %s"%(var_description, part.replace('_','\_'))
+                                                        replace = False
+                                                else:
+                                                        var_description = "%s $%s$"%(var_description, part)
+                                                        replace = True
+
                        latex.write('        \hyperref[subsec:var_sec_%s_%s]{%s} & %s \\\\</font>
<font color="black">'%(struct_name, var_name, var_name.replace('_','\_'), var_description.replace('_','\_')))
                        latex.write('        \hline</font>
<font color="gray">')
@@ -232,7 +311,26 @@
                if var_description == "":
                        var_description = latex_missing_string
+                else:
+                        equations = var_description.find('$')
+                        if equations != -1:
+                                var_desc_split = var_description.split("$")
+                                if var_description.replace('_','')[0] == "$":
+                                        replace = False
+                                        var_description = "$"
+                                else:
+                                        replace = True
+                                        var_description = ""
+
+                                for part in var_desc_split:
+                                        if replace:
+                                                var_description = "%s %s"%(var_description, part.replace('_','\_'))
+                                                replace = False
+                                        else:
+                                                var_description = "%s $%s$"%(var_description, part)
+                                                replace = True
+
                latex.write('        \hyperref[subsec:var_sec_%s_%s]{%s} & %s \\\\</font>
<font color="black">'%(struct_name, var_name, var_name.replace('_','\_'), var_description.replace('_','\_')))
                latex.write('        \hline</font>
<font color="gray">')
@@ -274,6 +372,10 @@
                        try:
                                var_units = var.attrib['units']
+                                if var_units == "":
+                                        var_units = latex_missing_string
+                                else:
+                                        var_units = "$%s$"%var_units
                        except:
                                var_units = latex_missing_string
@@ -294,11 +396,28 @@
                                var_index = "domain %% blocklist %% %s %% index_%s"%(struct_name, var_name_in_code)
                                var_path = "domain %% blocklist %% %s %% %s"%(struct_name, var_arr_name)
-                        if var_units == "":
-                                var_units = latex_missing_string
-
                        if var_description == "":
                                var_description = latex_missing_string
+                        else:
+                                equations = var_description.find('$')
+                                if equations != -1:
+                                        var_desc_split = var_description.split("$")
+
+                                        if var_description.replace('_','')[0] == "$":
+                                                replace = False
+                                                var_description = "$"
+                                        else:
+                                                replace = True
+                                                var_description = ""
+
+                                        for part in var_desc_split:
+                                                if replace:
+                                                        var_description = "%s %s"%(var_description, part.replace('_','\_'))
+                                                        replace = False
+                                                else:
+                                                        var_description = "%s $%s$"%(var_description, part)
+                                                        replace = True
+
                        
                        latex.write('\subsection[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="black">'%(var_name.replace('_','\_'),struct_name, var_name.replace('_','\_')))
                        latex.write('\label{subsec:var_sec_%s_%s}</font>
<font color="gray">'%(struct_name,var_name))
@@ -348,6 +467,10 @@
                        try:
                                var_units = var.attrib['units']
+                                if var_units == "":
+                                        var_units = latex_missing_string
+                                else:
+                                        var_units = "$%s$"%var_units
                        except:
                                var_units = latex_missing_string
@@ -366,11 +489,28 @@
                        else:
                                var_path = "domain %% blocklist %% %s %% %s"%(struct_name, var_name_in_code)
-                        if var_units == "":
-                                var_units = latex_missing_string
-
                        if var_description == "":
                                var_description = latex_missing_string
+                        else:
+                                equations = var_description.find('$')
+                                if equations != -1:
+                                        var_desc_split = var_description.split("$")
+
+                                        if var_description.replace('_','')[0] == "$":
+                                                replace = False
+                                                var_description = "$"
+                                        else:
+                                                replace = True
+                                                var_description = ""
+
+                                        for part in var_desc_split:
+                                                if replace:
+                                                        var_description = "%s %s"%(var_description, part.replace('_','\_'))
+                                                        replace = False
+                                                else:
+                                                        var_description = "%s $%s$"%(var_description, part)
+                                                        replace = True
+
                        
                        latex.write('\subsection[%s]{\hyperref[sec:var_tab_%s]{%s}}</font>
<font color="black">'%(var_name.replace('_','\_'),struct_name, var_name.replace('_','\_')))
                        latex.write('\label{subsec:var_sec_%s_%s}</font>
<font color="black">'%(struct_name,var_name))
</font>
</pre>