-
Notifications
You must be signed in to change notification settings - Fork 8
/
ref.html
754 lines (706 loc) · 28.8 KB
/
ref.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" id="viewport" content="width = device-width, initial-scale = 1, minimum-scale = 1, maximum-scale = 1, user-scalable=no" />
<meta name="keywords" content="参考文献,参考文献格式,参考文献格式生成器,网页编程,网页编程语言,网页编程技术,编程语言,网络编程,脚本编程" />
<meta name="description" content="参考文献,,参考文献格式,参考文献格式生成器,为程序员提供最全的网络编程资讯,网页编程" />
<title>参考文献格式生成器</title>
<style>
@charset "utf-8";
/* CSS Document */
html,
body,
div,
p,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6 {
font-size: 12px;
font-weight: normal;
padding: 0;
margin: 0;
}
.wrapper {
position: relative;
width: 900px;
margin: 0 auto;
}
.footer {
text-align: center;
font-size: 13px;
color: gray;
}
.sidebar {
float: left;
width: 35%;
padding: 20px 0;
background: lightgray;
background: rgba(220, 220, 100, 0.5);
font-size: 14px;
line-height: 28px;
}
.main {
width: 65%;
margin-left: 35%;
}
.clean {
clear: both;
}
.header h1 {
font-size: 18px;
font-weight: bold;
line-height: 24px;
border-bottom: 1px gray solid;
padding: 5px 25px;
margin: 10px 0;
}
.sidebar label {
font-size: 13px;
display: block;
float: left;
width: 26%;
text-align: right;
margin-right: 10px;
}
.sidebar label .required {
color: gray;
font-weight: bold;
padding-left: 3px;
}
.sidebar input,
.sidebar select {
padding: 3px;
font-size: 13px;
line-height: 18px;
margin: 0;
}
.sidebar input[type="text"] {
width: 60%;
}
.sidebar input[type="button"] {
font-size: 14px;
line-height: 14px;
padding: 5px 12px;
margin: 0 5px;
}
.sidebar p {
position: relative;
clear: both;
margin: 0 10px 12px 10px;
padding: 0;
}
.sidebar .desc {
font-size: 13px;
color: gray;
}
.sidebar .buttons {
float: right;
line-height: 30px;
margin: 0 20px;
}
.sidebar p .desc {
display: block;
position: absolute;
top: 8px;
left: 94%;
line-height: 20px;
font-size: 12px;
float: right;
width: 8px;
height: 8px;
text-indent: 24px;
background: lightyellow;
overflow: hidden;
border: 1px lightgray solid;
border-radius: 4px;
}
.sidebar p .desc:hover {
top: 0;
text-indent: 0;
padding: 5px 10px;
width: 100px;
height: auto;
overflow: visible;
z-index: 99;
}
.main .resultDiv {
margin-left: 10px;
padding: 10px;
border: 1px solid lightgray;
height: 450px;
overflow: auto;
background: white;
background: rgba(255, 255, 255, 0.6);
}
.main .resultItem {
position: relative;
border: 1px solid lightgray;
margin-bottom: 10px;
}
.main .resultItem .delete,
.main .resultItem .edit {
position: absolute;
right: 5px;
font-size: 12px;
color: gray;
display: none;
display: none;
text-decoration: none;
}
.main .resultItem:hover .delete,
.main .resultItem:hover .edit {
display: block;
}
.main .resultItem .delete:hover,
.main .resultItem .edit:hover {
text-decoration: underline;
}
.main .resultItem .delete {
top: 1px;
}
.main .resultItem .edit {
top: 16px;
}
.main .referanceContent {
font-size: 13px;
line-height: 20px;
padding: 5px 10px;
margin-right: 45px;
}
.main .referanceContent[contentEditable="true"] {
border: 1px lightblue solid;
resize: none;
outline: none;
}
.main .desc {
text-align: right;
margin: 5px 30px;
font-size: 13px;
color: gray;
}
.narrowStyle .wrapper {
width: 568px;
}
.narrowStyle .header,
.narrowStyle .footer {
display: none;
}
.narrowStyle .sidebar {
float: none;
width: auto;
padding: 10px 5px 5px 5px;
}
.narrowStyle .main {
width: auto;
margin-left: 0;
}
.narrowStyle .sidebar p {
margin: 0 10px 8px 10px;
padding: 0;
float: left;
clear: none;
}
.narrowStyle .sidebar p .desc {
margin-left: 5px;
display: inline;
position: static;
float: none;
width: auto;
height: auto;
text-indent: 0;
background: transparent;
border: none;
border-radius: 0;
}
.narrowStyle .sidebar p .desc:hover {
padding: 0;
width: auto
}
.narrowStyle .sidebar label {
width: 68px;
}
.narrowStyle .sidebar input[type="text"] {
width: 165px;
}
.narrowStyle .sidebar input[name="题目"] {
width: 438px;
}
.narrowStyle .sidebar .desc {
font-size: 13px;
color: gray;
}
.narrowStyle .main .resultDiv {
margin: 10px 0 0 0;
height: 280px;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="header">
<h1>参考文献格式生成器</h1>
</div>
<div class="sidebar">
<p>
<label>文献类型:</label>
<select id="typeSelector"></select>
</p>
<div class="clean"></div>
<form id="inputForm"></form>
<div class="buttons">
<span class="desc">("*"为必填项)</span>
<input id="addBtn" type="button" value="添加" />
</div>
<!--sidebar-->
<div class="clean"></div>
</div>
<!--buttons-->
<div class="main">
<div id="resultDiv" class="resultDiv"></div>
<div class="desc">(可直接复制到Word文档中)</div>
</div>
<!--main-->
<script type="text/javascript">
if (document.body.clientWidth < 700) {
document.body.className = 'narrowStyle';
}
</script>
<script type="text/javascript">
// JavaScript Document
var _ = {
doc: document,
el: function(id) {
return this.doc.getElementById(id);
},
createEl: function(name, obj) {
var el = this.doc.createElement(name);
_.each(obj, function(value, key) {
switch (key) {
case 'html':
case 'text':
el.innerHTML = value;
break;
case 'style':
_.each(value, function(value, key) {
el.style[key] = value;
});
break;
default:
el.setAttribute(key, value);
}
});
return el;
},
each: function(arr, fn, max) {
max = max || Number.MAX_VALUE;
var i, item;
if (_.isArray(arr, false)) {
for (i = 0; item = arr[i]; i++) {
if (i >= max || fn(item, i) === false) {
break;
}
}
} else {
for (i in arr) {
max--;
if (max < 0 || fn(arr[i], i) === false) {
break;
}
}
}
},
isArray: function(value, strict) {
var type = Object.prototype.toString.apply(value),
isObj = value.length === undefined || _.isFunction(value);
if (strict !== false) {
return type === '[object Array]';
} else {
return !isObj;
}
},
isFunction: function(value) {
return typeof value === 'function' || typeof value === 'Function';
},
tmpl: function(template, obj) {
var result = template;
_.each(obj, function(item, i) {
result = result.replace(new RegExp('{' + i + '}', 'g'), item);
});
return result;
},
mixIn: function(className, obj) {
var args = arguments,
proto = className.prototype,
i, o;
for (i = 1; o = args[i]; i++) {
_.each(o, function(value, key) {
proto[key] = value;
});
}
},
bind: function(element, event, fn, scope) {
var f = function() {
fn.apply(scope || this, arguments);
}
if (element.addEventListener) {
element.addEventListener(event, f, false);
//为了兼容,全用冒泡模型,一般也用不着捕获模型
} else if (element.attachEvent) {
element.attachEvent('on' + event, f);
}
},
trim: function(str) {
str = str.replace(/^\s+/, '');
var end = str.length - 1,
regx = /\s/;
while (regx.test(str.charAt(end))) {
end--;
}
return str.slice(0, end + 1);
}
}
var Referance = function() {
this.initHooks();
this.initTypes();
this.showTypeOptions();
this.showInputs(this.defaultType)
this.bindEvents();
}
Referance.config = {
itemRegx: /{(\[.*?\])?(.+?)(\[.*?\])?}/g,
defaultType: 'J',
types: {
J: {
name: '期刊',
required: '作者,题目,期刊名,出版年份,期数',
format: '{作者}. {题目}[J]. {期刊名}, {出版年份}{[, ]卷号}{[(]期数[)]}{[:]起止页码}.'
},
N: {
name: '报纸',
required: '作者,题目,报纸名,出版日期,版次',
format: '{作者}. {题目}[N]. {报纸名}, {出版日期}{[(]版次[)]}.'
},
M: {
name: '图书',
required: '作者,题目,版次,出版单位,出版年份',
format: '{作者}. {题目}[M]. {版次[. ]}{出版地[:]}{出版单位}{[, ]出版年份}{[ :]起止页码}.'
},
C: {
name: '会议录,论文集',
required: '作者,题目,论文集名,出版单位,出版年份',
format: '{作者}. {题目}[C]. //{主编[.]}{论文集名}, {出版地[: ]}{出版单位[, ]}{出版年份}{[:]起止页码}.'
},
D: {
name: '学位论文',
required: '作者,题目,保存单位,年份',
format: '{作者}. {题目}[D]. {保存地[:]}{保存单位}{[, ]年份}.'
},
R: {
name: '报告',
required: '作者,题目,报告地,主办单位,报告年份',
format: '{作者}. {题目}[R]. {报告地[:]}{主办单位}{[, ]报告年份}.'
},
'EB/OL': {
name: '网络文献',
required: '责任者,题目,引用日期,访问路径',
format: '{责任者}. {题目}[EB/OL]. {出版年}[{引用日期}]. {访问路径}.'
}
},
descriptions: {
'作者': '多位作者请用英文逗号“,”分开',
'引用日期': '格式为 年-月-日',
'起止页码': '格式为 xxx-yyy'
}
}
Referance.fn = {
count: 1,
initTypes: function() {
var that = this;
_.each(this.types, function(type) {
var format = type['format'],
regx = that.itemRegx,
regxArr = format.match(regx);
type.required = type.required.split(',');
type.regxArr = {};
type.items = [];
_.each(regxArr, function(item, i) {
regx.lastIndex = 0;
var result = regx.exec(item);
if (result[1]) {
result[1] = result[1].substr(1, result[1].length - 2);
}
if (result[3]) {
result[3] = result[3].substr(1, result[3].length - 2);
}
type.regxArr[result[0]] = result;
type.items[i] = result[2];
});
});
},
isRequired: function(itemName, typeName) {
var type = this.types[typeName];
if (!type) {
return false;
}
var required = type.required,
result = false,
i, item;
for (i = 0; item = required[i]; i++) {
if (item == itemName) {
result = true;
break;
}
}
return result;
},
getItems: function(typeName) {
var type = this.types[typeName];
return type && type.items;
},
formatReferance: function(typeName, obj) {
var that = this,
type = this.types[typeName];
if (!type) {
return false;
}
var regx = this.itemRegx;
var result = type.format.replace(regx, function(match) {
var regxArr = type.regxArr[match],
name = regxArr[2],
result = '';
if (obj[name]) {
regxArr[1] && (result += regxArr[1]);
if (name == '作者') {
obj[name] = that.formatAuthors(obj[name]);
}
if (name == '责任者') {
obj[name] = '[' + (that.count++) + '] ' + obj[name]
}
result += obj[name];
regxArr[3] && (result += regxArr[3]);
}
return result;
});
return result;
},
formatAuthors: function(authors) {
var authorArr = authors.split(/,|,/),
isEn = false,
enRegx = /^[a-zA-Z \.-]+$/,
formated = /^[a-zA-Z]{2,}( [A-Z])*$/,
temp, lastName, i, len, result = [];
_.each(authorArr, function(author) {
author = _.trim(author);
if ((isEn = enRegx.test(author))) {
author = author.replace(/\.|-/g, '');
if (!formated.test(author)) {
temp = author.split(' ');
len = temp.length;
lastName = temp[--len];
author = lastName.charAt(0).toUpperCase() + lastName.substr(1);
for (i = 0; i < len; i++) {
if (temp[i]) {
author += ' ';
author += temp[i].charAt(0).toUpperCase();
}
}
}
}
result.push(author);
}, 3);
if (authorArr.length > 3) {
result.push(isEn ? 'etal' : '等')
}
return result.join(', ')
}
}
Referance.ctrl = {
typeSelector: '',
inputForm: '',
resultDiv: '',
addBtn: '',
selectType: '',
insertDefaultDate: function() {
const date = new Date();
document.getElementsByName('引用日期')[0].value = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
},
initHooks: function() {
this.typeSelector = _.el('typeSelector');
this.inputForm = _.el('inputForm');
this.resultDiv = _.el('resultDiv');
this.addBtn = _.el('addBtn');
},
showInputs: function(typeName) {
this.selectType = typeName;
var template = '<p><label>{inputName}<span class="required">{required}</span></label><input type="text" name="{inputName}" value=""/>{desc}</p>';
var that = this,
items = this.getItems(typeName),
html = '';
_.each(items, function(item, i) {
var obj = {
inputName: item,
required: that.isRequired(item, typeName) ? '*' : ' ',
desc: ''
};
if (that.descriptions[item]) {
obj.desc = '<span class="desc">' + that.descriptions[item] + '</span>';
}
html += _.tmpl(template, obj);
});
this.inputForm.innerHTML = html;
if (this.selectType === 'EB/OL') {
this.insertDefaultDate();
}
},
showTypeOptions: function() {
var that = this,
types = this.types,
selector = this.typeSelector,
html = '';
_.each(types, function(item, i) {
var option = _.createEl('option', {
text: item.name,
value: i
});
if (that.defaultType == i) {
option.selected = true;
option.defaultselected = true;
}
selector.appendChild(option);
});
},
cleanForm: function() {
var formEls = this.inputForm.elements;
_.each(formEls, function(el) {
el.value = '';
});
this.insertDefaultDate();
},
onSelectChange: function() {
var type = this.typeSelector.value;
this.showInputs(type);
},
addContent: function() {
var formEls = this.inputForm.elements,
formContent = {},
result, html;
_.each(formEls, function(item) {
if (item.name) {
formContent[item.name] = item.value;
}
});
result = this.formatReferance(this.selectType, formContent);
html = '<div class="resultItem"><div class="referanceContent">' + result + '</div><a href="javascript:" class="delete">Delete</a><a href="javascript:" class="edit">Edit</a></div>';
this.resultDiv.innerHTML += html;
this.cleanForm();
},
listenResultDivEvents: function(e) {
e = e || window.event;
var target = e.target || e.srcElement,
resultDiv = this.resultDiv,
attr;
switch (target.className) {
case 'delete':
resultDiv.removeChild(target.parentNode);
break;
case 'edit':
_.each(target.parentNode.childNodes, function(item) {
if (item.className == 'referanceContent') {
item.setAttribute('contentEditable', true);
item.focus();
item.onblur = function() {
item.removeAttribute('contentEditable');
}
}
});
break;
}
},
bindEvents: function() {
_.bind(this.typeSelector, 'change', this.onSelectChange, this);
_.bind(this.addBtn, 'click', this.addContent, this);
_.bind(this.resultDiv, 'click', this.listenResultDivEvents, this);
}
}
_.mixIn(Referance, Referance.config, Referance.fn, Referance.ctrl);
new Referance();
</script>
<hr />
<p>参考文献标准格式编排示例:
</p>
<p>a.专著、论文集、学位论文、报告
</p>
<p>[序号]主要责任者.文献题名[文献类型标识].出版地:出版者,出版年.起止页码(任选).
</p>
<p>[1]黄梯云.管理信息系统[M].北京:高等教育出版社,2004.24-25.
</p>
<p>[2]辛希孟.信息技术和信息服务国际研讨会论文集:A集[C].北京:中国社会科学出版社,1994.
</p>
<p>[3]张弛.基于产业链治理的集群国际竞争力提升研究[D].浙江:浙江大学,2011.
</p>
<p>[4]冯西桥.核反应堆压力管道和压力容器的LBB分析[R].北京:清华大学核能技术设计研究院,1997.
</p>
<p>[5]Gill,R.Mastering English Literature[M].London: Macmillan,1985.
</p>
<p>b.期刊文章
</p>
<p>[序号]主要责任者.文献题名[J].刊名,年,卷(期):起止页码.
</p>
<p>[6]徐建敏,任荣明.产业集群创新效应及政策建议[J].科学学与科学技术管理,2006,(12):67-73.
</p>
<p>[7]金显贺,王昌长,王忠东,等.一种用于在线检测局部放电的数字滤波技术[J].清华大学学报(自然科学版),1993,33(4):62-67.
</p>
<p>[8] Heider,E.R.&D.C.Oliver.The structure of color space in naming and memory of two languages [J].Foreign Language Teaching and Research,1999,(3):62-67.
</p>
<p>c.论文集中的析出文献
</p>
<p>[序号]析出文献主要责任者.析出文献题名[A].原文献主要责任者(任选).原文献题名[C].出版地:出版者,出版年.析出文献起止页码.
</p>
<p>[9]钟文发.非线性规划在可燃毒物配置中的应用[A].赵玮.运筹学的理论和应用--中国运筹学会第五届大会论文集[C].西安:西安电子科技大学出版社,1996.468-471.
</p>
<p>[10] Spivak,G."Can the Subaltern Speak?"[A].In C.Nelson &L.Grossberg(eds.).Victory in Limbo: Imigism[C].Urbana:University of Illinois Press,1988.271-313.
</p>
<p>d.报纸文章
</p>
<p>[序号]主要责任者.文献题名[N].报纸名,出版日期(版次).
</p>
<p>[11] 谢希德.创造学习的新思路[N].人民日报,1998-12-25(10).
</p>
<p>[12] French,W.Between Silences:A Voice from China[N].Atlantic Weekly,1987-8-15(33).
</p>
<p>e.国际、国家标准
</p>
<p>[序号]标准编号,标准名称[S].
</p>
<p>[13]GB/T 8561-1988,专业技术职务代码[S].
</p>
<p>f.专利
</p>
<p>[序号]专利所有者.专利题名[P].专利国别:专利号,出版日期.
</p>
<p>[14]姜锡洲.一种温热外敷药制备方案[P].中国专利:881056073,1989-07-26
</p>
<p>g.电子文献
</p>
<p>[序号]主要责任者.电子文献题名[电子文献和载体类型标识].电子文献的出处或可获得地址,发表或更新日期/引用日期(任选).
</p>
<p>[15]万锦坤.中国大学学报论文文摘(1983-1993).英文版[DB/CD].北京:中国大百科全书出版社,1996
</p>
<p>h.各种未定义类型的文献
</p>
<p>[序号]主要责任者.文献题名[Z].出版地:出版者,出版年.
</p>
<p>对于英文参考文献,还应注意以下两点:
</p>
<p>①作者姓名采用"姓在前名在后"原 则,具体格式是:姓,名字的首字母. 如: Malcolm Richard Cowley 应为:Cowley, M.R.,如果有两位作者,第一位作者方式不变,&之后第二位作者名字的首字母放在前面,姓放在后面,如:Frank Norris 与Irving Gordon应为:Norris, F. &I.Gordon.
</p>
<p>②书名、报刊名使用斜体字,如:Mastering English Literature,English Weekly.
</p>
</body>
</html>