Template:spec

  • Revision slug: Template:spec
  • Revision title: Template:spec
  • Revision id: 232778
  • Created:
  • Creator: ziyunfei
  • Is current revision? No
  • Comment 5 words added, 10 words removed

Revision Content

<% /* parameters: */ /* $0 = link to specification */ /* $1 = link text (optional) */ /* $2 = status of specification (optional). Possible values: ED, WD, LC, CR, PR, REC. */ var u = uri.parts(Page.uri); var lang = string.tolower(u.path[0]); if (string.contains(lang, "project") || string.contains(lang, "Project")) {   lang = string.substr(lang, 8); } /* fall back to page.language on a user page */ else if (string.StartsWith(lang, "user:")) { lang = page.language; } var status = $2; var title = ""; var color = ""; var bgcolor = ""; switch(status) { case 'ED': color = "#fff"; bgcolor = "#e61919"; title = "Editor's Draft (unofficial)"; break; case 'WD': color = "#fff"; bgcolor = "#e66e33"; title = "Working Draft"; break; case 'LC': color = "#333"; bgcolor = "#e2a669"; title = "Last Call"; break; case 'CR': color = "#333"; bgcolor = "#cfd510"; title = "Candidate Recommendation"; break; case 'PR': color = "#fff"; bgcolor = "#72ac35"; title = "Proposed Recommendation"; break; case 'REC': color = "#fff"; bgcolor = "#309c40"; title = "Recommendation"; break; } if(lang == "zh-cn"){ switch(status) {   case 'ED':     color = "#fff";     bgcolor = "#e61919";     title = "编辑草案(非官方)";     break;   case 'WD':     color = "#fff";     bgcolor = "#e66e33";     title = "工作草案";     break;   case 'LC':     color = "#333";     bgcolor = "#e2a669";     title = "Last Call";     break;   case 'CR':     color = "#333";     bgcolor = "#cfd510";     title = "候选标准";     break;   case 'PR':     color = "#fff";     bgcolor = "#72ac35";     title = "推荐标准";     break;   case 'REC':     color = "#fff";     bgcolor = "#309c40";     title = "正式标准";     break; } } web.link( $0, ($1 || $0) ); if ($2) { (status) }

Revision Source

<%

/* parameters: */
/* $0 = link to specification */
/* $1 = link text (optional) */
/* $2 = status of specification (optional). Possible values: ED, WD, LC, CR, PR, REC. */

var u = uri.parts(Page.uri);
var lang = string.tolower(u.path[0]);
if (string.contains(lang, "project") || string.contains(lang, "Project")) {
  lang = string.substr(lang, 8);
}
/* fall back to page.language on a user page */
else if (string.StartsWith(lang, "user:")) {
 lang = page.language;
}

var status = $2;
var title = "";
var color = "";
var bgcolor = "";

switch(status) {
  case 'ED':
    color = "#fff";
    bgcolor = "#e61919";
    title = "Editor's Draft (unofficial)";
    break;
  case 'WD':
    color = "#fff";
    bgcolor = "#e66e33";
    title = "Working Draft";
    break;
  case 'LC':
    color = "#333";
    bgcolor = "#e2a669";
    title = "Last Call";
    break;
  case 'CR':
    color = "#333";
    bgcolor = "#cfd510";
    title = "Candidate Recommendation";
    break;
  case 'PR':
    color = "#fff";
    bgcolor = "#72ac35";
    title = "Proposed Recommendation";
    break;
  case 'REC':
    color = "#fff";
    bgcolor = "#309c40";
    title = "Recommendation";
    break;
}

if(lang == "zh-cn"){
switch(status) {
  case 'ED':
    color = "#fff";
    bgcolor = "#e61919";
    title = "编辑草案(非官方)";
    break;
  case 'WD':
    color = "#fff";
    bgcolor = "#e66e33";
    title = "工作草案";
    break;
  case 'LC':
    color = "#333";
    bgcolor = "#e2a669";
    title = "Last Call";
    break;
  case 'CR':
    color = "#333";
    bgcolor = "#cfd510";
    title = "候选标准";
    break;
  case 'PR':
    color = "#fff";
    bgcolor = "#72ac35";
    title = "推荐标准";
    break;
  case 'REC':
    color = "#fff";
    bgcolor = "#309c40";
    title = "正式标准";
    break;
}
}
web.link( $0, ($1 || $0) );

if ($2) {
   <span title=(title) style=('color:' + color + '; background-color:' + bgcolor+ '; display: inline-block; font-size: x-small; margin-left: 6px; white-space: nowrap; padding: 2px 5px;')>(status)</span>
}
</pre>
Revert to this revision