Skip to content

Commit 6abe462

Browse files
committed
Implement app:draft mode into atom api
1 parent 6444720 commit 6abe462

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

autoload/webapi/atom.vim

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,31 @@ endfunction
8282

8383
function! s:createXml(entry)
8484
let entry = webapi#xml#createElement("entry")
85-
let entry.attr["xmlns"] = "http://purl.org/atom/ns#"
85+
let entry.attr["xmlns"] = "http://purl.org/atom/ns#"
86+
let entry.attr["xmlns:app"] = "http://www.w3.org/2007/app"
8687

8788
for key in keys(a:entry)
88-
if type(a:entry[key]) == 1 && key !~ '\.'
89+
let l:keytype = type(a:entry[key])
90+
if l:keytype == 1 && key !~ '\.'
8991
let node = webapi#xml#createElement(key)
9092
call node.value(a:entry[key])
9193
if key == "content"
9294
let node.attr["type"] = a:entry['content.type']
9395
let node.attr["mode"] = a:entry['content.mode']
9496
endif
9597
call add(entry.child, node)
98+
elseif l:keytype == 4
99+
let node = webapi#xml#createElement(key)
100+
if key == "app:control"
101+
let l:draft_node = webapi#xml#createElement("app:draft")
102+
if exists("a:entry['app:control']['app:draft']")
103+
call l:draft_node.value(a:entry['app:control']['app:draft'])
104+
else
105+
call l:draft_node.value('no')
106+
endif
107+
call add(node.child, l:draft_node)
108+
endif
109+
call add(entry.child, node)
96110
endif
97111
endfor
98112
let xml = '<?xml version="1.0" encoding="utf-8"?>' . entry.toString()

0 commit comments

Comments
 (0)