<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 == &quot;&quot;:
+                                dim_units = latex_missing_string
+                        else:
+                                dim_units = &quot;$%s$&quot;%dim_units
                 except:
                         dim_units = latex_missing_string
 
                 if dim_description == &quot;&quot;:
                         dim_description = latex_missing_string
+                else:
+                        equations = dim_description.find('$')
+                        if equations != -1:
+                                dim_desc_split = dim_description.split(&quot;$&quot;)
 
-                if dim_units == &quot;&quot;:
-                        dim_units = latex_missing_string
+                                if dim_description.replace('_','')[0] == &quot;$&quot;:
+                                        replace = False
+                                        dim_description = &quot;$&quot;
+                                else:
+                                        replace = True
+                                        dim_description = &quot;&quot;
 
+                                for part in dim_desc_split:
+                                        if replace:
+                                                dim_description = &quot;%s %s&quot;%(dim_description, part.replace('_','\_'))
+                                                replace = False
+                                        else:
+                                                dim_description = &quot;%s $%s$&quot;%(dim_description, part)
+                                                replace = True
+
                 latex.write('        %s &amp; %s &amp; %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 == &quot;&quot;:
                         opt_description = latex_missing_string
+                else:
+                        equations = opt_description.find('$')
+                        if equations != -1:
+                                opt_desc_split = opt_description.split(&quot;$&quot;)
 
+                                if opt_description.replace('_','')[0] == &quot;$&quot;:
+                                        replace = False
+                                        opt_description = &quot;$&quot;
+                                else:
+                                        replace = True
+                                        opt_description = &quot;&quot;
+
+                                for part in opt_desc_split:
+                                        if replace:
+                                                opt_description = &quot;%s %s&quot;%(opt_description, part.replace('_','\_'))
+                                                replace = False
+                                        else:
+                                                opt_description = &quot;%s $%s$&quot;%(opt_description, part)
+                                                replace = True
+
                 latex.write('        \hyperref[subsec:nm_sec_%s]{%s} &amp; %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[&quot;units&quot;]
+                        if opt_units == &quot;&quot;:
+                                opt_units = latex_missing_string
+                        else:
+                                opt_units = &quot;$%s$&quot;%opt_units
                 except:
                         opt_units = latex_missing_string
 
@@ -164,12 +207,29 @@
                 if opt_possible_values == &quot;&quot;:
                         opt_possible_values = latex_missing_string
 
-                if opt_units == &quot;&quot;:
-                        opt_units = latex_missing_string
 
                 if opt_description == &quot;&quot;:
                         opt_description = latex_missing_string
+                else:
+                        equations = opt_description.find('$')
+                        if equations != -1:
+                                opt_desc_split = opt_description.split(&quot;$&quot;)
 
+                                if opt_description.replace('_','')[0] == &quot;$&quot;:
+                                        replace = False
+                                        opt_description = &quot;$&quot;
+                                else:
+                                        replace = True
+                                        opt_description = &quot;&quot;
+
+                                for part in opt_desc_split:
+                                        if replace:
+                                                opt_description = &quot;%s %s&quot;%(opt_description, part.replace('_','\_'))
+                                                replace = False
+                                        else:
+                                                opt_description = &quot;%s $%s$&quot;%(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 == &quot;&quot;:
                                 var_description = latex_missing_string
+                        else:
+                                equations = var_description.find('$')
+                                if equations != -1:
+                                        var_desc_split = var_description.split(&quot;$&quot;)
 
+                                        if var_description.replace('_','')[0] == &quot;$&quot;:
+                                                replace = False
+                                                var_description = &quot;$&quot;
+                                        else:
+                                                replace = True
+                                                var_description = &quot;&quot;
+
+                                        for part in var_desc_split:
+                                                if replace:
+                                                        var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                        replace = False
+                                                else:
+                                                        var_description = &quot;%s $%s$&quot;%(var_description, part)
+                                                        replace = True
+
                         latex.write('        \hyperref[subsec:var_sec_%s_%s]{%s} &amp; %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 == &quot;&quot;:
                         var_description = latex_missing_string
+                else:
+                        equations = var_description.find('$')
+                        if equations != -1:
+                                var_desc_split = var_description.split(&quot;$&quot;)
 
+                                if var_description.replace('_','')[0] == &quot;$&quot;:
+                                        replace = False
+                                        var_description = &quot;$&quot;
+                                else:
+                                        replace = True
+                                        var_description = &quot;&quot;
+
+                                for part in var_desc_split:
+                                        if replace:
+                                                var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                replace = False
+                                        else:
+                                                var_description = &quot;%s $%s$&quot;%(var_description, part)
+                                                replace = True
+
                 latex.write('        \hyperref[subsec:var_sec_%s_%s]{%s} &amp; %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 == &quot;&quot;:
+                                        var_units = latex_missing_string
+                                else:
+                                        var_units = &quot;$%s$&quot;%var_units
                         except:
                                 var_units = latex_missing_string
 
@@ -294,11 +396,28 @@
                                 var_index = &quot;domain %% blocklist %% %s %% index_%s&quot;%(struct_name, var_name_in_code)
                                 var_path = &quot;domain %% blocklist %% %s %% %s&quot;%(struct_name, var_arr_name)
 
-                        if var_units == &quot;&quot;:
-                                var_units = latex_missing_string
-
                         if var_description == &quot;&quot;:
                                 var_description = latex_missing_string
+                        else:
+                                equations = var_description.find('$')
+                                if equations != -1:
+                                        var_desc_split = var_description.split(&quot;$&quot;)
+
+                                        if var_description.replace('_','')[0] == &quot;$&quot;:
+                                                replace = False
+                                                var_description = &quot;$&quot;
+                                        else:
+                                                replace = True
+                                                var_description = &quot;&quot;
+
+                                        for part in var_desc_split:
+                                                if replace:
+                                                        var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                        replace = False
+                                                else:
+                                                        var_description = &quot;%s $%s$&quot;%(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 == &quot;&quot;:
+                                        var_units = latex_missing_string
+                                else:
+                                        var_units = &quot;$%s$&quot;%var_units
                         except:
                                 var_units = latex_missing_string
 
@@ -366,11 +489,28 @@
                         else:
                                 var_path = &quot;domain %% blocklist %% %s %% %s&quot;%(struct_name, var_name_in_code)
 
-                        if var_units == &quot;&quot;:
-                                var_units = latex_missing_string
-
                         if var_description == &quot;&quot;:
                                 var_description = latex_missing_string
+                        else:
+                                equations = var_description.find('$')
+                                if equations != -1:
+                                        var_desc_split = var_description.split(&quot;$&quot;)
+
+                                        if var_description.replace('_','')[0] == &quot;$&quot;:
+                                                replace = False
+                                                var_description = &quot;$&quot;
+                                        else:
+                                                replace = True
+                                                var_description = &quot;&quot;
+
+                                        for part in var_desc_split:
+                                                if replace:
+                                                        var_description = &quot;%s %s&quot;%(var_description, part.replace('_','\_'))
+                                                        replace = False
+                                                else:
+                                                        var_description = &quot;%s $%s$&quot;%(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>