[enh] there should be an html styling for commands

This commit is contained in:
Alban Crommer 2020-05-22 20:00:50 +00:00 committed by Alban Crommer
parent 381953bbd0
commit ea411c6cde
2 changed files with 11 additions and 4 deletions

View File

@ -17,4 +17,9 @@
.log p { .log p {
color: #666; color: #666;
} }
.log span.cmd {
background: #eee;
color: #003e80;
padding: 3px 8px;
}

View File

@ -25,10 +25,12 @@ url = function(string){
} }
var titleRegex = /^(.*\n)/; var titleRegex = /^(.*\n)/;
title = function(string){ title = function(string){
var str=''+string.replace(titleRegex, '<b>$1</b>');
return ''+string.replace(titleRegex, '<b>$1</b>'); return ''+string.replace(titleRegex, '<b>$1</b>');
} }
var cmdRegex = /```([^`]*?)```/g
cmd = function(string) {
return ''+string.replace(cmdRegex, '<span class="cmd">$1</span>');
}
function updatePage(data){ function updatePage(data){
var content = ""; var content = "";
@ -47,7 +49,7 @@ function updatePage(data){
<div class="log row-fluid"> <div class="log row-fluid">
<div class="span9"> <div class="span9">
<p><a href="/log/${id}">${escape(item.created_at)} -- ${escape(item.author)} -- ${escape(item.server)}</a></p> <p><a href="/log/${id}">${escape(item.created_at)} -- ${escape(item.author)} -- ${escape(item.server)}</a></p>
<pre> ${title(url(escape(item.content)))}</pre> <pre> ${cmd(title(url(escape(item.content))))}</pre>
</span> </span>
</div> </div>
`; `;