Created
November 28, 2011 14:27
-
-
Save Bengt/1400582 to your computer and use it in GitHub Desktop.
DoxyCleaner
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/python | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
# | |
# You should have received a copy of the GNU General Public License | |
# along with this program; if not, write to the Free Software | |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
# MA 02110-1301, USA. | |
import os | |
""" | |
DoxyCleaner | |
Removes the 'Generated on' notes from Doxygen's HTMLs for Git. | |
""" | |
class DoxyCleaner: | |
"""Removing The 'Generated On' Notes ofrom Doxygen's HTMLs'""" | |
def __init__(self): | |
"""Empty Constructor""" | |
pass | |
def run (self): | |
"""Gathering And Cleaning HTMLs """ | |
self.cleanHTMLs(self.gatherHTMLs()) | |
def gatherHTMLs (self): | |
"""Gathering The HTML Files Generated by Doxygen""" | |
return os.listdir('./html/') | |
def cleanHTMLs (self, htmls): | |
"""Cleaning All Gathered HTMLs""" | |
for html in htmls: | |
if html.endswith('.html'): | |
self.cleanHTML(html) | |
def cleanHTML (self, html): | |
"""Cleaning out The 'Generated ON'-Note at The End of The Page""" | |
with open('./html/' + html, 'r') as f: | |
data = f.read() | |
data = data[:-237] + data[-17:] | |
with open('./html/' + html, 'w') as f: | |
f.write(data) | |
if __name__ == '__main__': | |
dc = DoxyCleaner() | |
dc.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment