# -*- tab-width: 4 -*- # Copyright (c) 2009 Tim Freeman # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # # (This is the standard MIT License, copied from # http://www.opensource.org/licenses/mit-license.php on 24 Apr 2007.) #desc Shared code between the various HTML files. import time, license_text, sets import os.path email = "tim@fungible.com" email_url = "mailto:" + email me = "Tim Freeman" top_home_url = "http://fungible.com/respect" paper_url = top_home_url + "/paper.html" paper_title = "Using Compassion and Respect to " \ "Motivate an Artificial Intelligence" code_url = top_home_url + "/code" epsilon = "ε" doctype = """""" css = """ """ validator_text = """
""" class BaseDocument(object): def __init__ (self, sourceDirectory=None, sourceURL=None): """sourceDirectory is where we should look for source code files referenced with sourceFileRef. sourceURL is the prefix we should put on the filename to make it into a URL. sourceURL should have a trailing slash if it is nonempty.""" self.sourceDirectory = sourceDirectory self.sourceURL = sourceURL self.definedNames = sets.Set() self.referencedNames = sets.Set() self.parentHeaders = [] # Return a string with the beginning of an HTML file with the given title. # This includes a " result += "\n") result = self.h2("mit-license", "License") \ + html_license + validator_text \ + "