-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent-types.js
More file actions
78 lines (61 loc) · 1.59 KB
/
content-types.js
File metadata and controls
78 lines (61 loc) · 1.59 KB
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
const PART_TYPE={
fontName: "Times",
fontSize: "20.0",
fontStyle: "Bold",
}; const CHAPTER_TYPE={
fontName: "Times",
fontSize: "15.0",
fontStyle: "Bold",
};
const SECTION_TYPE={
fontName: "Times",
fontSize: "11.0",
fontStyle:null
};
const SIDE_NOTE_TYPE = {
fontName: "Times New Roman",
fontSize: "12.0",
fontStyle:null
}
const PAGE_NUM_MARKER_TYPE = {
fontName: "Times New Roman",
fontSize: "10.0",
fontStyle:null
}
const EMPTY_SPACES= {
fontName:null,
fontSize:null,
fontStyle:null
}
module.exports.SECTION_TYPE = SECTION_TYPE;
module.exports.SIDE_NOTE_TYPE = SIDE_NOTE_TYPE;
module.exports.CHAPTER_TYPE = CHAPTER_TYPE;
module.exports.PART_TYPE = PART_TYPE;
module.exports.EMPTY_SPACES = EMPTY_SPACES;
module.exports.getContentType = function getContentType(type){
let contentType = undefined;
if(isContentMatch(type,SECTION_TYPE)){
contentType= SECTION_TYPE;
}
else if(isContentMatch(type,SIDE_NOTE_TYPE)){
contentType = SECTION_TYPE;
}
else if(isContentMatch(type,CHAPTER_TYPE)){
contentType = CHAPTER_TYPE;
}
else if(isContentMatch(type,PART_TYPE)){
contentType = PART_TYPE;
}
else if(isContentMatch(type,EMPTY_SPACES)){
contentType = EMPTY_SPACES;
}
else if(isContentMatch(type,PAGE_NUM_MARKER_TYPE)){
contentType = EMPTY_SPACES;
}
return contentType;
}
function isContentMatch(source,target){
return source.fontName === target.fontName
&& source.fontStyle===target.fontStyle
&& source.fontSize === target.fontSize;
}