Skip to content

Commit 1498c74

Browse files
committed
提交html使用代码高亮测试
1 parent 1351af9 commit 1498c74

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

test/changer.css

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* 关键字 */
2+
#k{
3+
color: #8B1C62;
4+
font-weight:bold;
5+
}
6+
/* 全局变量 */
7+
#g{
8+
color: #0000FF;
9+
}
10+
/* 方局部变量 */
11+
#f{
12+
color: #8B5742;
13+
}
14+
/* 字符串 */
15+
#s{
16+
color: #436EEE;
17+
}
18+
/* 注解 */
19+
#a{
20+
color: #828282;
21+
}
22+
/* 绿色注释 */
23+
#n-g{
24+
color: #3CB371;
25+
}
26+
/* 蓝色注释 */
27+
#n-b{
28+
color: #8470FF;
29+
}

test/test.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
7+
<link rel="stylesheet" href="changer.css">
8+
<title>JavaToHtml代码转换测试</title>
9+
</head>
10+
<body>
11+
<br><br><br>
12+
<div class="container">
13+
<div class="row clearfix">
14+
<div class="col-md-8 col-md-offset-2 column">
15+
<pre><nobr id="k">package</nobr> totoro.top.java2html; <br>&#9;<br><nobr id="k">public</nobr> <nobr id="k">class</nobr> Test { <br>&#9;<br>&#9; <nobr id="n-g">// 主版本号</nobr><br>&#9;<nobr id="k">public static </nobr><nobr id="k">int</nobr> <nobr id="g">mainvVersion</nobr> = <nobr id="g">1</nobr>;<br>&#9; <nobr id="n-g">// 副版本号 :测试全局变量高亮</nobr><br>&#9;<nobr id="k">private static </nobr><nobr id="k">double</nobr> <nobr id="g">testDefineGlobal</nobr> = <nobr id="g">0.2</nobr>;<br>&#9;<br>&#9;<nobr id="k">public static </nobr>void main(String[] <nobr id="f">args</nobr>) {<br>&#9;&#9; <nobr id="n-g">// 字符串高亮显示</nobr><br>&#9;&#9;testDefineMethod(<nobr id="g">mainvVersion</nobr>, <nobr id="s">"点击转换按钮生成HTML代码"</nobr>);<br>&#9;} <br>&#9;<br>&#9; <nobr id="n-b">/**</nobr><br>&#9; <nobr id="n-b"> * 蓝色注释内容</nobr><br>&#9; <nobr id="n-b"> * 测试方法定义的参数高亮</nobr><br>&#9; <nobr id="n-b"> */</nobr><br>&#9;<nobr id="k">private static </nobr><nobr id="k">boolean</nobr> testDefineMethod(<nobr id="k">double</nobr> <nobr id="f">ver</nobr>, String <nobr id="f">log</nobr>) {<br>&#9;&#9; <nobr id="n-g">/* 测试局部变量高亮 ,并展示第二种绿色注释内容*/</nobr><br>&#9;&#9;<nobr id="k">double</nobr> <nobr id="f">version</nobr> = Test.<nobr id="g">mainvVersion</nobr> + <nobr id="g">testDefineGlobal</nobr>; <br>&#9;&#9;String <nobr id="f">testDefineField</nobr> = <nobr id="s">"测试"</nobr>+ <nobr id="f">version</nobr> + <nobr id="s">"版本 :"</nobr>;<br>&#9;&#9;System.out.println(<nobr id="f">testDefineField</nobr> + log); <br>&#9;&#9;<nobr id="k">return</nobr> <nobr id="k">true;</nobr> <br>&#9;} <br>&#9;<br>} <br></pre>
16+
</div>
17+
</div>
18+
</div>
19+
20+
</body>
21+
</html>

0 commit comments

Comments
 (0)