@6>
<@local(ps,name,root,sw,nclose,num,max_depth)>
<@>
<$name = argv#0>
<$root = argv#1>
<$ps = v.load_plgset(name)>
<$num= v.plugin_num(name)>
<$sw = ps.switch)>
<$nclose = sw && ps.nclose>
<$max_depth = (ps.depth || 3)-1>
<@>
<@>---------------------------------------------------------------------
<@>再帰サブルーチン
<@>---------------------------------------------------------------------
<$sub = begin.function>
<@local(t, p, node, tree, depth, x)>
<$node = argv#0>
<$tree = node.children || []>
<$depth = argv#1><@>prefix
<$p = "\t" %x depth>
<@p>
<@if(depth && nclose, ' style="display: none"')>>
<@forexec(t, tree, begin.forexec)>
<@> / で始まるlink_keyに link_key_encode() での細工した先頭 ./ を除去する
<$ifset(substr(t.elink_key,0,2) eq './', t.elink_key, substr(t.elink_key,2))>
<$ifnext(t.tstat & v.tstat_nomenu)>
<@ifexec(t.children && depth
<@p> - <@\>
<@if(sw, #'')> <@\>
<@t.elink_key>")>"><@t.title><@if(sw, '')>
<@exec(sub, t, depth+1)>
<@p>
<$else>
<@p> - <@\>
<@t.elink_key>")>"><@t.title>
<$end>
<$end.forexec>
<@p>
<$end.function>
<@>---------------------------------------------------------------------
<@>コンテンツリスト
<@>---------------------------------------------------------------------
<$tree = argv#1>
<@ifexec(root && root.pkey, begin, begin)>
<$else>
<@ps.title || 'コンテンツ'>
<$end>
<@ifexec(root, begin)>
<@exec(sub, root, 0)>
<$end>