author | Clipperz <info@clipperz.com> | 2013-01-09 10:37:39 (UTC) |
---|---|---|
committer | Clipperz <info@clipperz.com> | 2013-01-09 10:37:39 (UTC) |
commit | 5996ee475c193f08a713eb53338e4769c2716aa7 (patch) (unidiff) | |
tree | 18947a78d3946635ace383bfc3bacdabda11aafd | |
parent | 813c3245eebfebf9d951e082b9a7473d0116b63a (diff) | |
download | clipperz-5996ee475c193f08a713eb53338e4769c2716aa7.zip clipperz-5996ee475c193f08a713eb53338e4769c2716aa7.tar.gz clipperz-5996ee475c193f08a713eb53338e4769c2716aa7.tar.bz2 |
Fixed build script
Changed the build script in order to replace placeholders even if present multiple times
-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 | |||
@@ -263,103 +263,103 @@ class FrontendBuilder(object): | |||
263 | # ('inputElement', '_1a'), | 263 | # ('inputElement', '_1a'), |
264 | # ('elementValues', '_1b'), | 264 | # ('elementValues', '_1b'), |
265 | # ('radioValue', '_1c'), | 265 | # ('radioValue', '_1c'), |
266 | # ('values', '_1d'), | 266 | # ('values', '_1d'), |
267 | # ('objtype', '_21'), | 267 | # ('objtype', '_21'), |
268 | # ('useKey', '_27'), | 268 | # ('useKey', '_27'), |
269 | # ('bookmarkletDiv', '_28'), | 269 | # ('bookmarkletDiv', '_28'), |
270 | # ('someParameters', '_29'), | 270 | # ('someParameters', '_29'), |
271 | # ('anException', '_2a'), | 271 | # ('anException', '_2a'), |
272 | # ('newDiv', '_2b'), | 272 | # ('newDiv', '_2b'), |
273 | # ('base_url', '_2c'), | 273 | # ('base_url', '_2c'), |
274 | # ('help_url', '_2d'), | 274 | # ('help_url', '_2d'), |
275 | # ('logo_image_url', '_2e'), | 275 | # ('logo_image_url', '_2e'), |
276 | # ('background_image_url','_2f'), | 276 | # ('background_image_url','_2f'), |
277 | # ('close_image_url', '_30'), | 277 | # ('close_image_url', '_30'), |
278 | # #('bookmarklet_textarea','_31'), | 278 | # #('bookmarklet_textarea','_31'), |
279 | # ('innerHTML', '_32'), | 279 | # ('innerHTML', '_32'), |
280 | # ] | 280 | # ] |
281 | # for replacer in replacers: | 281 | # for replacer in replacers: |
282 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) | 282 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) |
283 | 283 | ||
284 | # replacers = [ | 284 | # replacers = [ |
285 | # ('headNode', '_1' ), | 285 | # ('headNode', '_1' ), |
286 | # ('clipperzScriptNode','_2' ), | 286 | # ('clipperzScriptNode','_2' ), |
287 | # ] | 287 | # ] |
288 | # for replacer in replacers: | 288 | # for replacer in replacers: |
289 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) | 289 | # result = re.sub('([^\.])' + replacer[0], '\\1' + replacer[1], result) |
290 | 290 | ||
291 | # result = re.sub(';', ';\n', result) | 291 | # result = re.sub(';', ';\n', result) |
292 | 292 | ||
293 | return result | 293 | return result |
294 | 294 | ||
295 | 295 | ||
296 | 296 | ||
297 | def bookmarklet (self): | 297 | def bookmarklet (self): |
298 | cacheKey = 'bookmarklet' | 298 | cacheKey = 'bookmarklet' |
299 | if not self.processedFiles.has_key(cacheKey): | 299 | if not self.processedFiles.has_key(cacheKey): |
300 | result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js']), "regular") + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js']), "IE") + '";' | 300 | result = 'bookmarklet="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet.js']), "regular") + '";bookmarklet_ie="' + self.packBookmarklet(self.loadFilesContent('js', ['Bookmarklet_IE.js']), "IE") + '";' |
301 | self.processedFiles[cacheKey] = result | 301 | self.processedFiles[cacheKey] = result |
302 | else: | 302 | else: |
303 | result = self.processedFiles[cacheKey] | 303 | result = self.processedFiles[cacheKey] |
304 | 304 | ||
305 | return result | 305 | return result |
306 | 306 | ||
307 | 307 | ||
308 | def replaceTemplatePlaceholders (self, pageTitle, copyright, css, code, jsLoadMode, version, versionType): | 308 | def replaceTemplatePlaceholders (self, pageTitle, copyright, css, code, jsLoadMode, version, versionType): |
309 | result = self.template() | 309 | result = self.template() |
310 | 310 | ||
311 | result = result.replace('@page.title@', pageTitle, 1) | 311 | result = result.replace('@page.title@', pageTitle) |
312 | result = result.replace('@copyright@', copyright, 1) | 312 | result = result.replace('@copyright@', copyright) |
313 | result = result.replace('@css@', css, 1) | 313 | result = result.replace('@css@', css) |
314 | #result = result.replace('@bookmarklet@', bookmarklet,1) | 314 | #result = result.replace('@bookmarklet@', bookmarklet) |
315 | result = result.replace('@application.version@', version, 1) | 315 | result = result.replace('@application.version@', version) |
316 | result = result.replace('@application.version.type@', versionType,1) | 316 | result = result.replace('@application.version.type@',versionType) |
317 | result = result.replace('@js_' + jsLoadMode + '@', code, 1) | 317 | result = result.replace('@js_' + jsLoadMode + '@', code) |
318 | 318 | ||
319 | result = re.sub('@js_[^@]+@', '', result) | 319 | result = re.sub('@js_[^@]+@', '', result) |
320 | 320 | ||
321 | return result | 321 | return result |
322 | 322 | ||
323 | 323 | ||
324 | def assembleCopyrightHeader (self): | 324 | def assembleCopyrightHeader (self): |
325 | processedFile = 'copyright' | 325 | processedFile = 'copyright' |
326 | if not self.processedFiles.has_key(processedFile): | 326 | if not self.processedFiles.has_key(processedFile): |
327 | #self.log("assembling copyright header") | 327 | #self.log("assembling copyright header") |
328 | copyrightValues = self.settings['copyright.values'] | 328 | copyrightValues = self.settings['copyright.values'] |
329 | license = self.loadFilesContent('../../properties', ['license.txt']) | 329 | license = self.loadFilesContent('../../properties', ['license.txt']) |
330 | result = self.loadFilesContent('properties', ['creditsAndCopyrights.txt']) | 330 | result = self.loadFilesContent('properties', ['creditsAndCopyrights.txt']) |
331 | 331 | ||
332 | result = re.sub('@clipperz.license@', license, result) | 332 | result = re.sub('@clipperz.license@', license, result) |
333 | for key in copyrightValues: | 333 | for key in copyrightValues: |
334 | result = re.sub('@'+key+'@', copyrightValues[key], result) | 334 | result = re.sub('@'+key+'@', copyrightValues[key], result) |
335 | 335 | ||
336 | self.processedFiles[processedFile] = result | 336 | self.processedFiles[processedFile] = result |
337 | 337 | ||
338 | return self.processedFiles[processedFile] | 338 | return self.processedFiles[processedFile] |
339 | 339 | ||
340 | 340 | ||
341 | def cssTagsForFiles (self, basePath, files): | 341 | def cssTagsForFiles (self, basePath, files): |
342 | #<link rel="stylesheet" type="text/css" href="./css/reset-min.css" /> | 342 | #<link rel="stylesheet" type="text/css" href="./css/reset-min.css" /> |
343 | return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="' + basePath + '/' + file + '" />', files)) | 343 | return '\n'.join(map(lambda file: '<link rel="stylesheet" type="text/css" href="' + basePath + '/' + file + '" />', files)) |
344 | 344 | ||
345 | 345 | ||
346 | def cssTagForContent (self, content): | 346 | def cssTagForContent (self, content): |
347 | return '<style type="text/css">' + content + '</style>' | 347 | return '<style type="text/css">' + content + '</style>' |
348 | 348 | ||
349 | 349 | ||
350 | def scriptTagsForFiles (self, basePath, files): | 350 | def scriptTagsForFiles (self, basePath, files): |
351 | #<script type='text/javascript' src='./js/src/bookmarklet.js'></script> | 351 | #<script type='text/javascript' src='./js/src/bookmarklet.js'></script> |
352 | return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '" charset="utf-8"></script>', files)) | 352 | return '\n'.join(map(lambda file: '<script type="text/javascript" src="' + basePath + '/' + file + '" charset="utf-8"></script>', files)) |
353 | 353 | ||
354 | 354 | ||
355 | def scriptTagForContent (self, content): | 355 | def scriptTagForContent (self, content): |
356 | return '<script>' + content + '</script>' | 356 | return '<script>' + content + '</script>' |
357 | 357 | ||
358 | 358 | ||
359 | def assembleVersion (self, pageTitle, copyright, css, js, jsLoadMode, version, versionType): | 359 | def assembleVersion (self, pageTitle, copyright, css, js, jsLoadMode, version, versionType): |
360 | cacheKey = version + "-" + versionType | 360 | cacheKey = version + "-" + versionType |
361 | if not self.processedFiles.has_key(cacheKey): | 361 | if not self.processedFiles.has_key(cacheKey): |
362 | result = self.replaceTemplatePlaceholders(pageTitle, copyright, css, js, jsLoadMode, version, versionType) | 362 | result = self.replaceTemplatePlaceholders(pageTitle, copyright, css, js, jsLoadMode, version, versionType) |
363 | self.processedFiles[cacheKey] = result | 363 | self.processedFiles[cacheKey] = result |
364 | else: | 364 | else: |
365 | result = self.processedFiles[cacheKey] | 365 | result = self.processedFiles[cacheKey] |