ProjectWeb/Html5ToJsConverter.py

branch
eric7
changeset 54
1b47d2b39f7c
parent 52
815847f3d404
child 56
d91d613bba96
equal deleted inserted replaced
53:5921f891c949 54:1b47d2b39f7c
66 Public method to get the converted JavaScript text. 66 Public method to get the converted JavaScript text.
67 67
68 @return JavaScript text 68 @return JavaScript text
69 @rtype str 69 @rtype str
70 """ 70 """
71 dlg = Html5ToJsConverterParameterDialog() 71 dlg = Html5ToJsConverterParameterDialog(parent=self.parent())
72 if dlg.exec() == QDialog.DialogCode.Accepted: 72 if dlg.exec() == QDialog.DialogCode.Accepted:
73 indentation, scriptTags = dlg.getData() 73 indentation, scriptTags = dlg.getData()
74 74
75 self.__createSoup() 75 self.__createSoup()
76 76
95 indentation, 95 indentation,
96 "var ", 96 "var ",
97 re.sub( 97 re.sub(
98 "[^a-z0-9]", 98 "[^a-z0-9]",
99 "", 99 "",
100 id_[1].lower() 100 (
101 if len(id_[1]) < 11 101 id_[1].lower()
102 else re.sub("[aeiou]", "", id_[1].lower()), 102 if len(id_[1]) < 11
103 else re.sub("[aeiou]", "", id_[1].lower())
104 ),
103 ), 105 ),
104 " = ", 106 " = ",
105 '$("#{0}").length'.format(id_[1]), 107 '$("#{0}").length'.format(id_[1]),
106 ";", 108 ";",
107 os.linesep, 109 os.linesep,
120 indentation, 122 indentation,
121 "var ", 123 "var ",
122 re.sub( 124 re.sub(
123 "[^a-z0-9]", 125 "[^a-z0-9]",
124 "", 126 "",
125 class_[1].lower() 127 (
126 if len(class_[1]) < 11 128 class_[1].lower()
127 else re.sub("[aeiou]", "", class_[1].lower()), 129 if len(class_[1]) < 11
130 else re.sub("[aeiou]", "", class_[1].lower())
131 ),
128 ), 132 ),
129 " = ", 133 " = ",
130 '$(".{0}").length'.format(class_[1]), 134 '$(".{0}").length'.format(class_[1]),
131 ";", 135 ";",
132 os.linesep, 136 os.linesep,

eric ide

mercurial