Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.cpk | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
plugin_name = "objc自动new" | ||
plugin_bundle_id = "com.clipber.08EABDF2" | ||
plugin_desc = "自动生成new语法" | ||
plugin_version = "1.0" | ||
plugin_author = "http://clipber.com" | ||
cpkgen_version = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
function magiclines(s) | ||
if s:sub(-1)~="\n" then s=s.."\n" end | ||
return s:gmatch("(.-)\n") | ||
end | ||
|
||
function main(text) | ||
-- edit here | ||
r = "" | ||
for line in magiclines(text) do | ||
pt = string.gsub(line,"%s+", "") | ||
if string.find(pt, "^label") then | ||
r = r .. "\nUILabel * " .. pt .. " = [UILabel new];" | ||
end | ||
if string.find(pt, "^_label") then | ||
r = r .. "\n" .. pt .. " = [UILabel new];" | ||
end | ||
if string.find(pt, "^button") then | ||
r = r .. "\nUIButton * " .. pt .. " = [UIButton new];" | ||
end | ||
if string.find(pt, "^_button") then | ||
r = r .. "\n" .. pt .. " = [UIButton new];" | ||
end | ||
if string.find(pt, "^tableView") then | ||
r = r .. "\nUITableView * " .. pt .. " = [UITableView new];" | ||
end | ||
if string.find(pt, "^_tableView") then | ||
r = r .. "\n" .. pt .. " = [UITableView new];" | ||
end | ||
if string.find(pt, "^imageView") then | ||
r = r .. "\nUIImageView * " .. pt .. " = [UIImageView new];" | ||
end | ||
if string.find(pt, "^_imageView") then | ||
r = r .. "\n" .. pt .. " = [UIImageView new];" | ||
end | ||
end | ||
return r | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
plugin_name = "objc生成属性" | ||
plugin_bundle_id = "com.clipber.F1BC52DA" | ||
plugin_desc = "根据变量前缀生成objc属性" | ||
plugin_version = "1.0" | ||
plugin_author = "http://clipber.com" | ||
cpkgen_version = "1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
function magiclines(s) | ||
if s:sub(-1)~="\n" then s=s.."\n" end | ||
return s:gmatch("(.-)\n") | ||
end | ||
|
||
function main(text) | ||
-- edit here | ||
r = "" | ||
for line in magiclines(text) do | ||
pt = string.gsub(line,"%s+", "") | ||
if string.find(pt, "^label") then | ||
r = r .. "\n@property (nonatomic, strong) UILabel * " .. pt .. ";" | ||
end | ||
if string.find(pt, "^button") then | ||
r = r .. "\n@property (nonatomic, strong) UIButton * " .. pt .. ";" | ||
end | ||
if string.find(pt, "^tableView") then | ||
r = r .. "\n@property (nonatomic, strong) UITableView * " .. pt .. ";" | ||
end | ||
if string.find(pt, "^imageView") then | ||
r = r .. "\n@property (nonatomic, strong) UIImageView * " .. pt .. ";" | ||
end | ||
end | ||
return r | ||
end | ||
|