-rw-r--r-- | scripts/builder/frontendBuilder.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/builder/frontendBuilder.py b/scripts/builder/frontendBuilder.py index fc603c4..e52c31e 100644 --- a/scripts/builder/frontendBuilder.py +++ b/scripts/builder/frontendBuilder.py @@ -247,135 +247,135 @@ class FrontendBuilder(object): # replacers = [ # ('aForm', '_1' ), # ('inputFields', '_2' ), # ('passwordFieldsFound', '_3' ), # ('aDocument', '_6' ), # ('aLevel', '_7' ), # # ('result', '_8' ), # ('documentForms', '_9' ), # ('iFrames', '_c' ), # ('anInputElement', '_d' ), # ('options', '_f' ), # ('option', '_12'), # ('aLoginForm', '_13'), # # ('action', '_17'), # ('radioValues', '_18'), # ('radioValueName', '_19'), # ('inputElement', '_1a'), # ('elementValues', '_1b'), # ('radioValue', '_1c'), # ('values', '_1d'), # ('objtype', '_21'), # ('useKey', '_27'), # ('bookmarkletDiv', '_28'), # ('someParameters', '_29'), # ('anException', '_2a'), # ('newDiv', '_2b'), # ('base_url', '_2c'), # ('help_url', '_2d'), # ('logo_image_url', '_2e'), # ('background_image_url','_2f'), # ('close_image_url', '_30'), # # ('bookmarklet_textarea','_31'), # ('innerHTML', '_32'), # ] # for replacer in replacers: # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) # replacers = [ # ('headNode', '_1' ), # ('clipperzScriptNode', '_2' ), # ] # for replacer in replacers: # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) # result = re.sub(';', ';\n', result) return result def bookmarklet (self): cacheKey = 'bookmarklet' if not self.processedFiles.has_key(cacheKey): result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js']), "regular") + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js']), "IE") + '";' self.processedFiles[cacheKey] = result else: result = self.processedFiles[cacheKey] return result def replaceTemplatePlaceholders (self, pageTitle, copyright, css, code, jsLoadMode, version, versionType): result = self.template() - result = result.replace('@page.title@', pageTitle, 1) - result = result.replace('@copyright@', copyright, 1) - result = result.replace('@css@', css, 1) - #result = result.replace('@bookmarklet@', bookmarklet, 1) - result = result.replace('@application.version@', version, 1) - result = result.replace('@application.version.type@', versionType, 1) - result = result.replace('@js_' + jsLoadMode + '@', code, 1) + result = result.replace('@page.title@', pageTitle) + result = result.replace('@copyright@', copyright) + result = result.replace('@css@', css) + #result = result.replace('@bookmarklet@', bookmarklet) + result = result.replace('@application.version@', version) + result = result.replace('@application.version.type@', versionType) + result = result.replace('@js_' + jsLoadMode + '@', code) result = re.sub('@js_[^@]+@', '', result) return result def assembleCopyrightHeader (self): processedFile = 'copyright' if not self.processedFiles.has_key(processedFile): #self.log("assembling copyright header") copyrightValues = self.settings['copyright.values'] license = self.loadFilesContent('../../properties', ['license.txt']) result = self.loadFilesContent('properties', ['creditsAndCopyrights.txt']) result = re.sub('@clipperz.license@', license, result) for key in copyrightValues: result = re.sub('@'+key+'@', copyrightValues[key], result) self.processedFiles[processedFile] = result return self.processedFiles[processedFile] def cssTagsForFiles (self, basePath, files): #<link rel="stylesheet" type="text/css" href="./css/reset-min.css" /> return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="' + basePath + '/' + file + '" />', files)) def cssTagForContent (self, content): return '<style type="text/css">' + content + '</style>' def scriptTagsForFiles (self, basePath, files): #<script type='text/javascript' src='./js/src/bookmarklet.js'></script> return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '" charset="utf-8"></script>', files)) def scriptTagForContent (self, content): return '<script>' + content + '</script>' def assembleVersion (self, pageTitle, copyright, css, js, jsLoadMode, version, versionType): cacheKey = version + "-" + versionType if not self.processedFiles.has_key(cacheKey): result = self.replaceTemplatePlaceholders(pageTitle, copyright, css, js, jsLoadMode, version, versionType) self.processedFiles[cacheKey] = result else: result = self.processedFiles[cacheKey] #self.log("# cacheKey:\n" + result) return result def assemble (self, assemblyMode='INSTALL', versionType='LIVE'): if versionType == 'LIVE': pageTitle = "Clipperz - " + self.module else: pageTitle = "Clipperz - " + self.module + " [" + versionType + " - " + assemblyMode +"]" if assemblyMode == 'INSTALL': copyright = self.assembleCopyrightHeader() css = self.cssTagForContent(self.compressCSS(self.loadFilesContent('css', self.settings['css']))) js = self.scriptTagForContent( |