1
- <!DOCTYPE html>
2
- < html xmlns ="http://www.w3.org/1999/xhtml ">
1
+ < html >
3
2
< 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
3
</ 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 > 	< br > < nobr id ="k "> public</ nobr > < nobr id ="k "> class</ nobr > Test { < br > 	< br > 	 < nobr id ="n-g "> // 主版本号</ nobr > < br > 	< nobr id ="k "> public static </ nobr > < nobr id ="k "> int</ nobr > < nobr id ="g "> mainvVersion</ nobr > = < nobr id ="g "> 1</ nobr > ;< br > 	 < nobr id ="n-g "> // 副版本号 :测试全局变量高亮</ nobr > < br > 	< nobr id ="k "> private static </ nobr > < nobr id ="k "> double</ nobr > < nobr id ="g "> testDefineGlobal</ nobr > = < nobr id ="g "> 0.2</ nobr > ;< br > 	< br > 	< nobr id ="k "> public static </ nobr > void main(String[] < nobr id ="f "> args</ nobr > ) {< br > 		 < nobr id ="n-g "> // 字符串高亮显示</ nobr > < br > 		testDefineMethod(< nobr id ="g "> mainvVersion</ nobr > , < nobr id ="s "> "点击转换按钮生成HTML代码"</ nobr > );< br > 	} < br > 	< br > 	 < nobr id ="n-b "> /**</ nobr > < br > 	 < nobr id ="n-b "> * 蓝色注释内容</ nobr > < br > 	 < nobr id ="n-b "> * 测试方法定义的参数高亮</ nobr > < br > 	 < nobr id ="n-b "> */</ nobr > < br > 	< 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 > 		 < nobr id ="n-g "> /* 测试局部变量高亮 ,并展示第二种绿色注释内容*/</ nobr > < br > 		< nobr id ="k "> double</ nobr > < nobr id ="f "> version</ nobr > = Test.< nobr id ="g "> mainvVersion</ nobr > + < nobr id ="g "> testDefineGlobal</ nobr > ; < br > 		String < nobr id ="f "> testDefineField</ nobr > = < nobr id ="s "> "测试"</ nobr > + < nobr id ="f "> version</ nobr > + < nobr id ="s "> "版本 :"</ nobr > ;< br > 		System.out.println(< nobr id ="f "> testDefineField</ nobr > + log); < br > 		< nobr id ="k "> return</ nobr > < nobr id ="k "> true;</ nobr > < br > 	} < br > 	< br > } < br > </ pre >
16
- </ div >
17
- </ div >
18
- </ div >
4
+ < body > < br > < br >
5
+ < div style ="margin:0 auto;width:600px; ">
6
+ < style >
7
+ # code_pre {border : 1px solid # d0d1d2 ;border-radius : 5px ;background : # F5FFFA ;margin : 10px ;
8
+ padding : 10px ;font-size : 13px ;font-family : courier, arial;overflow-y : hidden;}
9
+ # k-p {color : # 8B1C62 ;font-weight : bold;}
10
+ # g-db {color : # 0000FF ;}
11
+ # f-br {color : # 8B5742 ;}
12
+ # s-sb {color : # 436EEE ;}
13
+ # nn-g {color : # 3CB371 ;}
14
+ # ni-b {color : # 8470FF ;}
15
+ # anno {color : # 828282 ;}
16
+ </ style >
17
+ < pre id ="code_pre "> < nobr id ="k-p "> package</ nobr > totoro.top.java2html;
18
+
19
+ < nobr id ="k-p "> import</ nobr > java.util.HashMap;
20
+ < nobr id ="k-p "> import</ nobr > java.util.Map;
21
+
22
+ < nobr id ="nn-g "> // 测试注解高亮</ nobr >
23
+ < nobr id ="anno "> @TestAnnotation</ nobr >
24
+ < nobr id ="k-p "> public</ nobr > < nobr id ="k-p "> class</ nobr > Test {
25
+
26
+ 	< nobr id ="nn-g "> /* 1. 测试全局变量高亮</ nobr >
27
+ 	< nobr id ="nn-g "> * 2. 测试多行普通注释样式*/</ nobr >
28
+ 	< nobr id ="k-p "> public static int</ nobr > < nobr id ="g-db "> mainvVersion</ nobr > = 1;
29
+ 	< nobr id ="k-p "> private static double</ nobr > < nobr id ="g-db "> testDefineGlobal</ nobr > = 0.2;
19
30
31
+ 	< nobr id ="k-p "> public static void</ nobr > main(String[] < nobr id ="f-br "> args</ nobr > ) {
32
+ 		< nobr id ="nn-g "> // 测试字符串高亮</ nobr >
33
+ 		testDefineMethod(< nobr id ="g-db "> mainvVersion</ nobr > , < nobr id ="s-sb "> "点击转换按钮生成HTML代码"</ nobr > );
34
+ 	}
35
+
36
+ 	< nobr id ="ni-b "> /**</ nobr >
37
+ 	< nobr id ="ni-b "> * 1. 测试重要注释内容样式</ nobr >
38
+ 	< nobr id ="ni-b "> * 2. 测试方法定义的参数高亮</ nobr >
39
+ 	< nobr id ="ni-b "> */</ nobr >
40
+ 	< nobr id ="k-p "> private static boolean</ nobr > testDefineMethod(< nobr id ="k-p "> double</ nobr > < nobr id ="f-br "> ver</ nobr > , String < nobr id ="f-br "> log</ nobr > ) {
41
+ 		< nobr id ="nn-g "> /* 测试局部变量高亮 ,并使用第二种普通注释样式*/</ nobr >
42
+ 		< nobr id ="k-p "> double</ nobr > < nobr id ="f-br "> version</ nobr > = Test.< nobr id ="g-db "> mainvVersion</ nobr > + < nobr id ="g-db "> testDefineGlobal</ nobr > ;
43
+ 		< nobr id ="f-br "> testDefineField</ nobr > = < nobr id ="s-sb "> "测试"</ nobr > + < nobr id ="f-br "> version</ nobr > + < nobr id ="s-sb "> "版本 :"</ nobr > ;
44
+ 		System.out.println(< nobr id ="f-br "> testDefineField</ nobr > + < nobr id ="f-br "> log</ nobr > );
45
+ 		< nobr id ="k-p "> return</ nobr > < nobr id ="k-p "> true;</ nobr >
46
+ 	}
47
+
48
+ 	< nobr id ="ni-b "> /**</ nobr >
49
+ 	< nobr id ="ni-b "> * 测试特殊符号</ nobr >
50
+ 	< nobr id ="ni-b "> * 比如,"<"和">"符号在HTML代码中的显示是特殊字符,需要做字符转化;</ nobr >
51
+ 	< nobr id ="ni-b "> */</ nobr >
52
+ 	< nobr id ="k-p "> public </ nobr > Map<String, Object> testGenericParadigm() {
53
+ 		Map<String, Object> < nobr id ="f-br "> map</ nobr > = < nobr id ="k-p "> new</ nobr > HashMap<>();
54
+ 		< nobr id ="k-p "> return</ nobr > < nobr id ="f-br "> map</ nobr > ; < nobr id ="nn-g "> // 测试以注释结束的代码行</ nobr >
55
+ 	}
56
+
57
+ }
58
+ </ pre >
59
+ </ div >
20
60
</ body >
21
61
</ html >
0 commit comments