📄 templates.vm
字号:
## This is where the common macro's live#macro (note $data)<div class="frame note"><div class="label">Note</div><div class="content">$data.content</div></div>#end#macro (warning $data)<div class="frame warning"><div class="label">Warning</div><div class="content">$data.content</div></div>#end#macro ( table $table) #if ($table.getAttributeValue("class")) #set ($class = $table.getAttributeValue("class")) #else #set ($class = "ForrestTable") #end <table class="$!class" cellspacing="1" cellpadding="4"> #foreach ( $items in $table.getChildren() ) #if ($items.getName().equals("tr")) #tr ($items) #end #end </table>#end#macro ( tr $tr) <tr> #foreach ( $items in $tr.getChildren() ) #if ($items.getName().equals("td")) #td ($items) #elseif ($items.getName().equals("th")) #th ($items) #end #end</tr>#end#macro ( td $value) #if ($value.getAttributeValue("colspan")) #set ($colspan = $value.getAttributeValue("colspan")) #else #set ($colspan = 1) #end #if ($value.getAttributeValue("rowspan")) #set ($rowspan = $value.getAttributeValue("rowspan")) #else #set ($rowspan = 1) #end <td colspan="$!colspan" rowspan="$!rowspan" valign="top" align="left"> #if ($value.getText().length() != 0 || $value.hasChildren()) $value.content #else #end </td>#end#macro ( th $value) #if ($value.getAttributeValue("colspan")) #set ($colspan = $value.getAttributeValue("colspan")) #else #set ($colspan = 1) #end #if ($value.getAttributeValue("rowspan")) #set ($rowspan = $value.getAttributeValue("rowspan")) #else #set ($rowspan = 1) #end <th colspan="$!colspan" rowspan="$!rowspan" valign="top" align="left"> #if ($value.getText().length() != 0 || $value.hasChildren()) $value.content #else #end </th>#end#macro ( projectanchor $name $value ) #if ($value.startsWith("http://")) <a href="$value" class="externalLink">$name</a> #else <a href="$relativePath$value">$name</a> #end#end#macro ( link $item ) #set ($href = $value.getAttributeValue("href")) #set ($name = $value.getText() ) #if ($href.startsWith("http://")) <a href="$href" class="externalLink">$name</a> #else <a href="$relativePath$href">$name</a> #end#end#macro ( metaauthor $author $email ) <meta name="author" content="$author"> <meta name="email" content="$email">#end#macro ( image $value ) #if ($value.getAttributeValue("width")) #set ($width=$value.getAttributeValue("width")) #end #if ($value.getAttributeValue("height")) #set ($height=$value.getAttributeValue("height")) #end #if ($value.getAttributeValue("align")) #set ($align=$value.getAttributeValue("align")) #end #if ($value.getAttributeValue("alt")) #set ($align=$value.getAttributeValue("alt")) #end <img src="$relativePath$value.getAttributeValue("src")" width="$!width" height="$!height" align="$!align" alt="$!alt">#end#macro ( source $value)<pre class="code">$escape.getText($value.getText())</pre>#end#macro ( makeMainNavigation ) #set ( $tabs = $project.getChild("body").getChildren("menusection")) #if ( $project.getChild("body").getChild("menusection") ) #set ( $currentIndex = $root.getChild("properties").getChild("index").getAttributeValue("value") ) #if ( $currentIndex ) #foreach ( $tab in $tabs ) #set ($index = $tab.getAttributeValue("index")) #if ( $currentIndex.trim().equals( $index ) ) #set ($menus = $tab.getChildren("menu")) #end #end #else #set ($menus = $project.getChild("body").getChild("menusection").getChildren("menu")) #end #else #set ($menus = $project.getChild("body").getChildren("menu")) #end #makeProject ( $menus )#end#macro (makeProject $menus) <div class="menucontainer"> <div class="menu"> <ul> #foreach ( $menu in $menus ) <li><div class="menuheader">$menu.getAttributeValue("name")</div> <ul> #foreach ( $item in $menu.getChildren() ) #set ($name = $item.getAttributeValue("name")) #set ($current = $root.getChild("properties").getChild("title").getText() ) <li> #if ( $current.trim().equals( $name ) ) <span class="sel">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -