lbl-srg / GenOpt

GenOpt - Generic Optimization program
http://simulationresearch.lbl.gov/GO
20 stars 14 forks source link

Correct wrong html #3

Closed mwetter closed 8 years ago

mwetter commented 8 years ago

Various files have wrong html syntax that lead to errors when running make

mwetter commented 8 years ago

Cleaned up various html errors using

import os, fnmatch

def find_files(directory, pattern):
    for root, dirs, files in os.walk(directory):
        for basename in files:
            if fnmatch.fnmatch(basename, pattern):
                filename = os.path.join(root, basename)
                yield filename

di = { '<CODE>binStr.length > length</CODE>':
       '<CODE>binStr.length &gt; length</CODE>',
       '<CODE>n < 0</CODE>':
       '<CODE>n &lt; 0</CODE>',
       '<CODE>x0<CODE>': '<CODE>x0</CODE>',
       '<d>': '<br/>',
       '<code>max <= 0</code>': '<code>max &le; 0</code>',
       '<code>x <': '<code>x &lt;',
       '<CODE>secondDelimiter</CODE><LI>': '<CODE>secondDelimiter</CODE><p>',
       'a section occurs or until end-of-file occurs.<LI>': 'a section occurs or until end-of-file occurs.<p>',
       'All found keywords are written into sk.<LI>': 'All found keywords are written into sk.<p>',
       'whereas the last occured value is written into sk.<LI>': 'whereas the last occured value is written into sk.<p>',
       '<code>l <= x <= u</code>': '<code>l &le; x &le; u</code>',
       ' mapping key -> value': ' mapping key to value',
       '*@param':     '* @param',
       '*@exception': '* @exception',
       '*@return':    '* @return',
       '<CODE>-1</CODE> if o1 > o2': '<CODE>-1</CODE> if o1 &lt; o2',
       'dy (dy >= dx)': 'dy (dy &ge; dx)',
       '<CODE> n=binStr.length < length </CODE>': '<CODE> n=binStr.length &le; length </CODE>',
       'detail message.<br/>': 'detail message.<p>',
       'or not.<br/>': 'or not.<p>',
       'is written into sk.</LI>': 'is written into sk.',
       'menu ->': 'menu &rarr;'
}

for filename in find_files('src', '*.java'):
    # Read in the file
    filedata = None
    with open(filename, 'r') as file :
        filedata = file.read()

        # Replace the target string
        for key in di:
            filedata = filedata.replace(key, di[key])

        # Write the file out again
        with open(filename, 'w') as file:
            file.write(filedata)

Then, disabled doclint in Makefile to be able to generate javadoc.

mwetter commented 8 years ago

This is now on the master