Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2518)

Unified Diff: resources/slides_utils.lua

Issue 698563004: update slide content (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « resources/slides_content2.lua ('k') | src/utils/SkLua.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: resources/slides_utils.lua
diff --git a/resources/slides_utils.lua b/resources/slides_utils.lua
index 24e58cee51bb17972c198ae13a32e3d1766440f2..f687d8758607e560e74cec3e9c3fb29e4661012f 100644
--- a/resources/slides_utils.lua
+++ b/resources/slides_utils.lua
@@ -54,12 +54,17 @@ function pretty_print_slides(slides)
io.write("}\n")
end
-function parse_transition_type(s)
- return s:match("^<%s*transition%s*=%s*(%a+)%s*>$")
+function parse_attr(s, lvalue)
+ local ts = "^<%s*" .. lvalue .. "%s*=%s*(%a+)%s*>$"
+ return s:match(ts)
end
-function parse_blockstyle_type(s)
- return s:match("^<%s*blockstyle%s*=%s*(%a+)%s*>$")
+function flush(slides, block)
+ if #block > 0 then
+ slides[#slides + 1] = block
+ return {}
+ end
+ return block
end
function parse_file(file)
@@ -69,13 +74,10 @@ function parse_file(file)
for line in file:lines() do
local s = trim_ws(line)
if #s == 0 then -- done with a block
- if #block > 0 then
- slides[#slides + 1] = block
- block = {}
- end
+ block = flush(slides, block)
else
- local transition_type = parse_transition_type(s)
- local blockstyle = parse_blockstyle_type(s)
+ local transition_type = parse_attr(s, "transition")
+ local blockstyle = parse_attr(s, "blockstyle")
if transition_type then
block["transition"] = transition_type
elseif blockstyle then
« no previous file with comments | « resources/slides_content2.lua ('k') | src/utils/SkLua.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698