資源簡介
/Method-Draw-master/method-draw/index.html啟用查看;
代碼片段和文件信息
#!/usr/bin/env?python
#?-*-?coding:?utf-8?-*-
#?ship.py
#
#?Licensed?under?the?Apache?2?License?as?is?the?rest?of?the?project
#?Copyright?(c)?2011?Jeff?Schiller
#
#?This?script?has?very?little?real-world?application.??It?is?only?used?in?our?pure-client?web?app
#?served?on?GoogleCode?so?we?can?have?one?HTML?file?run?a?build?script?and?generate?a?‘release‘
#?version?without?having?to?maintain?two?separate?HTML?files.??It?does?this?by?evaluating
#?‘processing?comments‘?that?are?suspicously?similar?to?IE?conditional?comments?and?then?outputting
#?a?new?HTML?file?after?evaluating?particular?variables.
#
#?This?script?takes?the?following?inputs:
#
#?*?a?HTML?file?(--i=in.html)
#?*?a?series?of?flag?names?(--on=Foo?--on=Bar)
#
#?Example:
#
#?in.html:
#???
#?????BAR!
#???
#
#?$?ship.py?--i?in.html?--on?foo
#
#?out.html:
#???
#?????FOO!
#???
#
#?It?has?the?following?limitations:
#
#?1)?Only?if-else-endif?are?currently?supported.
#?2)?All?processing?comments?must?be?on?one?line?with?no?other?non-whitespace?characters.
#?3)?Comments?cannot?be?nested.
import?optparse
import?os
inside_if?=?False
last_if_true?=?False
_options_parser?=?optparse.OptionParser(
usage=‘%prog?--i?input.html?[--on?flag1]‘
description=(‘Rewrites?an?HTML?file?based?on?conditional?comments?and?flags‘))
_options_parser.add_option(‘--i‘
action=‘store‘?dest=‘input_html_file‘?help=‘Input?HTML?filename‘)
_options_parser.add_option(‘--on‘
action=‘append‘?type=‘string‘?dest=‘enabled_flags‘
help=‘name?of?flag?to?enable‘)
def?parse_args(args=None):
??options?rargs?=?_options_parser.parse_args(args)
??return?options?(None?None)
def?parseComment(line?line_num?enabled_flags):
??global?inside_if
??global?last_if_true
??start?=?line.find(‘{‘)
??end?=?line.find(‘}‘)
??statement?=?line[start+1:end].strip()
??if?statement.startswith(‘if?‘):
????if?inside_if?==?True:
??????print?‘Fatal?Error:?Nested?{if}?found?on?line?‘?+?str(line_num)
??????print?line
??????quit()
????#?Evaluate?whether?the?expression?is?true/false.
????#?only?one?variable?name?allowed?for?now
????variable_name?=?statement[3:].strip()
????if?variable_name?in?enabled_flags:
??????last_if_true?=?True
??????line?=?‘‘
????else:
??????last_if_true?=?False
??????line?=?‘‘
????#?invert?the?logic?so?the?endif?clause?is?closed?properly
????last_if_true?=?not?last_if_true
????#?ensure?we?don‘t?have?two?else?statements?in?the?same?i
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\
?????文件?????????184??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\.gitignore
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\.idea\
?????目錄???????????0??2018-11-26?14:04??svg編輯器源碼\Method-Draw-master\.idea\inspectionProfiles\
?????文件?????????469??2018-11-26?13:57??svg編輯器源碼\Method-Draw-master\.idea\Method-Draw-master.iml
?????文件?????????179??2018-11-26?13:57??svg編輯器源碼\Method-Draw-master\.idea\misc.xm
?????文件?????????295??2018-11-26?13:57??svg編輯器源碼\Method-Draw-master\.idea\modules.xm
?????文件???????22516??2018-12-18?17:27??svg編輯器源碼\Method-Draw-master\.idea\workspace.xm
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\build\
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\build\tools\
?????文件?????3939454??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\build\tools\closure-compiler.jar
?????文件???????11358??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\build\tools\COPYING
?????文件????????7143??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\build\tools\README
?????文件????????4264??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\build\tools\ship.py
?????文件??????891148??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\build\tools\yuicompressor-2.4.7.jar
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\docs\
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\docs\files\
?????文件??????284514??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\files\svgcanvas-js.html
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\docs\index\
?????文件??????????94??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\index.html
?????文件????????8185??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\index\Files.html
?????文件???????30774??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\index\Functions.html
?????文件???????32026??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\index\General.html
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\docs\ja
?????文件???????25346??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\ja
?????文件????????2170??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\ja
?????目錄???????????0??2018-12-24?10:11??svg編輯器源碼\Method-Draw-master\docs\search\
?????文件????????4328??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\search\FilesS.html
?????文件????????3648??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\search\FunctionsA.html
?????文件????????4296??2018-02-27?08:41??svg編輯器源碼\Method-Draw-master\docs\search\FunctionsC.html
............此處省略1289個文件信息
- 上一篇:一個簡單的HTML5網頁設計
- 下一篇:班級介紹網站
評論
共有 條評論