📄 weblog.vm
字号:
#** * Weblog entries, comments, and related links. * @author Lance Lavandowska (conversion to Velocimacros) * @author David M Johnson (comment macros) *##** * Print status/error message if exists. * Note: "error" and "status" styles should be moved out into * invididual Themes' theme.css files. **##macro( showStatusMessage ) #if( $errorMessage ) <span class="error">$errorMessage</span> #end #if( $statusMessage ) <span class="status">$statusMessage</span> #end#end#** * Set the META tag for ContentLanguage. We do this rather than * setting the Response header because the header does not get * cached. So in order to maintain the ContentType we must present * it inside the rendered page itself.**##macro( showContentLanguage $lang ) <meta http-equiv="Content-Language" content="$lang">#end#** * Use this macro in your day template if you want to override * entry rendering in both your HTML and RSS weblog output by defining * a page template named _entry. * * <p>It is no longer necessary to use a page template named _entry * if you want to override entry rendering in both your * HTML and RSS weblog output (for support of PagePlugins). * However, backwards compatibility for such use is still included, * or if you have some other need to override entry rendering. * The _entry page is now loaded by ContextLoader as $entryPage.</p> *##macro( showEntryText $entry ) #if( $entryPage ) #parse($entryPage.id) #else #if ( $entry.plugins ) #set( $entryText = $pageHelper.renderPlugins( $entry ) ) #else #set( $entryText = $entry.text ) #end #if( $entryLength == -1 ) $utilities.textToCDATA($entryText) #else #set( $entryText = $utilities.textToCDATA($utilities.removeHTML($entryText)) ) $stringUtils.left( $entryText, $entryLength )... [$entryText.length() characters] #end #end#end#** * Use this macro in your day template if you want to override * entry rendering in both your HTML and RSS weblog output by defining * a page template named _desc. * * <p>It is no longer necessary to use a page template named _desc * if you want to override entry rendering in both your * HTML and RSS weblog output (for support of PagePlugins). * However, backwards compatibility for such use is still included, * or if you have some other need to override entry rendering. * The _desc page is now loaded by ContextLoader as $descPage.</p> *##macro( showEntryDescription $entry ) #if( $descPage ) #parse($descPage.id) #else #if ( $entry.plugins ) #set( $entryText = $pageHelper.renderPlugins( $entry ) ) #else #set( $entryText = $entry.text ) #end #if( $entryLength == -1 ) $utilities.textToXML($entryText) #else #set( $entryText = $stringUtils.left( $entryText, $entryLength ) ) #set( $entryText = $utilities.textToXML($utilities.removeHTML($entryText)) ) $entryText... [$entryText.length() characters] #end #end#end#** * Display Permalink for Date. * @param day Date object that specifies day (type java.util.Date). *##macro( showDayPermalink $day ) <a href="$baseURL/page/$userName/#formatDate($plainFormat $day )"><img class="daypermalink" src="$ctxPath/images/permalink.gif" title="$text.get( "macro.weblog.daypermalink.title" )" alt="#formatDate( $plainFormat $day )" /></a>#end#** * Display the default Date.toString for date using the 'macro.weblog.date.toStringFormat' * format as defined in the resource bundle. * @param toStringFormat Format string (see java.text.SimpleDateFormat). * @param day Date object that specifies day (type java.util.Date). *##macro( showEntryDate $day ) #set( $format=$text.get("macro.weblog.date.toStringFormat") ) #formatDate( $format $day ) ##formatDate( $toStringFormat $day )#end#** * Display the timestamp for the $day using the 'macro.weblog.date.timestampFormat' * format as defined in the resource bundle. * * @param timestampFormat Format string (see java.text.SimpleDateFormat). * @param day Date object that specifies day (type java.util.Date). *##macro( showTimestamp $day ) #set( $format = $text.get("macro.weblog.date.timestampFormat") ) #formatDate( $format $day ) ##formatDate( $timestampFormat $day )#end#** * Display the Permalink for a weblog entry. * @param entry WeblogEntry object. *##macro( showEntryPermalink $entry ) <a href="$baseURL$entry.permaLink" title="$text.get( "macro.weblog.entrypermalink.title" )" class="entrypermalink">Permalink</a> #if ($pageHelper.isUserAuthorizedToEdit()) [<a href="$pageHelper.getEntryEditUrl($entry)">$text.get( "macro.weblog.entrypermalink.edit" )</a>] #end#end#** * Display the Trackback URL for a weblog entry. * @param entry WeblogEntry object. *##macro( showTrackbackURL $entry )$absBaseURL/trackback/$userName/$page.link/$utilities.encode($entry.anchor)#end#** * Display search form for searching a weblog. This is only a form, no div * or anything around it. *##macro( showSearchForm ) <form id="searchForm" method="get" action="$ctxPath/search/$userName" style="margin: 0; padding: 0" onsubmit="return validateSearch(this)"> <p> <input type="text" id="q" name="q" size="20" maxlength="255" value="#if($term)$term#end" /> #set( $cats = $pageModel.getWeblogCategories("nil") ) <select name="c"> <option value="">- In Category -</option> #foreach( $cat in $cats ) <option #if($cat.name == $req.getParameter('c'))selected="selected"#end>$cat.name</option> #end </select> <input type="submit" value="$text.get( "macro.weblog.searchbutton" )" /> </p> </form> <script type="text/javascript"> function validateSearch(form) { if (form.q.value == "") { alert("$text.get( "macro.weblog.searchalert" )"); form.q.focus(); return false; } return true; } </script>#end#** * Display search again form *##macro( showSearchAgainForm ) <div id="searchAgain"> $text.get( "macro.weblog.searchdictionary", [$term, $term, $term] ) $text.get( "macro.weblog.searchhits", [$hits]) <form method="get" action="$ctxPath/search/$userName" style="margin: 5px"> <input type="text" id="q" name="q" size="31" maxlength="255" value="$term" style="padding-left: 1px" /> #set( $cats = $pageModel.getWeblogCategories("nil") ) <select name="c"> <option value="">- Restrict By Category -</option> #foreach( $cat in $cats ) <option #if($cat.name == $req.getParameter('c'))selected="selected"#end>$cat.name</option> #end </select> <input type="submit" value="$text.get( "macro.weblog.searchagain" )" /> </form> $text.get( "macro.weblog.searchgoogle", [$term, $absBaseURL, $ctxPath, $userName] ) </div> <script type="text/javascript" src="$ctxPath/theme/scripts/searchhi.js"></script>#end#** * Displays header like "1 - 10 of 20 found.".**##macro( showSearchSummary ) #set( $min = $offset + 1 ) #set( $max = $offset + $limit ) #if( $max > $hits )#set( $max = $hits )#end <h3> $min - $max of $hits found. </h3>#end#** * Display list of search result pages (for pagination).**##macro( showSearchPager ) <h3 style="text-align:center;"> #set( $numPages = $hits / $limit ) #set( $remainder = $hits % $limit ) #if( $remainder > 0 )#set( $numPages = $numPages + 1 )#end #if( $numPages > 1 )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -