@@ -14,8 +14,16 @@ export const getMetadata = (note: EvernoteNoteData, notebookName: string): MetaD
14
14
return {
15
15
createdAt : getCreationTime ( note ) ,
16
16
updatedAt : getUpdateTime ( note ) ,
17
+ subjectDate : getSubjectDate ( note ) ,
18
+ author : getAuthor ( note ) ,
19
+ source : getSource ( note ) ,
17
20
sourceUrl : getSourceUrl ( note ) ,
21
+ sourceApplication : getSourceApplication ( note ) ,
18
22
location : getLatLong ( note ) ,
23
+ altitude : getAltitude ( note ) ,
24
+ placeName : getPlaceName ( note ) ,
25
+ contentClass : getContentClass ( note ) ,
26
+ applicationData : getApplicationData ( note ) ,
19
27
linkToOriginal : getLinkToOriginal ( note ) ,
20
28
reminderTime : getReminderTime ( note ) ,
21
29
reminderOrder : getReminderOrder ( note ) ,
@@ -40,32 +48,100 @@ export const getUpdateTime = (note: EvernoteNoteData): string => {
40
48
: undefined ;
41
49
} ;
42
50
51
+ //////// Note Attributes
52
+ export const getSubjectDate = ( note : EvernoteNoteData ) : string => {
53
+ return ! yarleOptions . skipSubjectDate &&
54
+ note [ 'note-attributes' ]
55
+ ? note [ 'note-attributes' ] [ 'subject-date' ]
56
+ : undefined ;
57
+ } ;
58
+
59
+ export const getLatLong = ( note : EvernoteNoteData ) : string => {
60
+ return ! yarleOptions . skipLocation &&
61
+ note [ 'note-attributes' ] &&
62
+ note [ 'note-attributes' ] . longitude
63
+ ? `${ note [ 'note-attributes' ] . latitude } ,${ note [ 'note-attributes' ] . longitude } `
64
+ : undefined ;
65
+ } ;
66
+
67
+ export const getAltitude = ( note : EvernoteNoteData ) : string => {
68
+ return ! yarleOptions . skipAltitude &&
69
+ note [ 'note-attributes' ]
70
+ ? note [ 'note-attributes' ] [ 'altitude' ]
71
+ : undefined ;
72
+ } ;
73
+
74
+ export const getAuthor = ( note : EvernoteNoteData ) : string => {
75
+ return ! yarleOptions . skipAuthor &&
76
+ note [ 'note-attributes' ]
77
+ ? note [ 'note-attributes' ] [ 'author' ]
78
+ : undefined ;
79
+ } ;
80
+
81
+ export const getSource = ( note : EvernoteNoteData ) : string => {
82
+ return ! yarleOptions . skipSource &&
83
+ note [ 'note-attributes' ]
84
+ ? note [ 'note-attributes' ] [ 'source' ]
85
+ : undefined ;
86
+ } ;
87
+
43
88
export const getSourceUrl = ( note : EvernoteNoteData ) : string => {
44
89
return ! yarleOptions . skipSourceUrl &&
45
90
note [ 'note-attributes' ]
46
91
? note [ 'note-attributes' ] [ 'source-url' ]
47
92
: undefined ;
48
93
} ;
49
94
95
+ export const getSourceApplication = ( note : EvernoteNoteData ) : string => {
96
+ return ! yarleOptions . skipSourceApplication &&
97
+ note [ 'note-attributes' ]
98
+ ? note [ 'note-attributes' ] [ 'source-application' ]
99
+ : undefined ;
100
+ } ;
101
+
102
+ export const getPlaceName = ( note : EvernoteNoteData ) : string => {
103
+ return ! yarleOptions . skipPlaceName &&
104
+ note [ 'note-attributes' ]
105
+ ? note [ 'note-attributes' ] [ 'place-name' ]
106
+ : undefined ;
107
+ } ;
108
+
109
+ export const getContentClass = ( note : EvernoteNoteData ) : string => {
110
+ return ! yarleOptions . skipContentClass &&
111
+ note [ 'note-attributes' ]
112
+ ? note [ 'note-attributes' ] [ 'content-class' ]
113
+ : undefined ;
114
+ } ;
115
+
116
+ export const getApplicationData = ( note : EvernoteNoteData ) : string => {
117
+ if ( ! yarleOptions . skipApplicationData && note [ 'note-attributes' ] && note [ 'note-attributes' ] [ 'application-data' ] ) {
118
+ const appdataArray = Array . isArray ( note [ 'note-attributes' ] [ 'application-data' ] )
119
+ ? note [ 'note-attributes' ] [ 'application-data' ]
120
+ : [ note [ 'note-attributes' ] [ 'application-data' ] ] ;
121
+ const appdata = appdataArray . map ( ( enexNode ) => {
122
+ return ` - ${ enexNode . $attrs . key } : ${ enexNode . $text } ` ;
123
+ } ) ;
124
+ return '\n' + appdata . join ( '\n' ) ;
125
+ }
126
+ else
127
+ {
128
+ return undefined ;
129
+ }
130
+ } ;
131
+
50
132
export const getLinkToOriginal = ( note : EvernoteNoteData ) : string => {
51
133
return yarleOptions . keepOriginalHtml ?
52
134
getHtmlFileLink ( note ) : undefined ;
53
135
} ;
54
136
55
- export const getLatLong = ( note : EvernoteNoteData ) : string => {
56
- return ! yarleOptions . skipLocation &&
57
- note [ 'note-attributes' ] &&
58
- note [ 'note-attributes' ] . longitude
59
- ? `${ note [ 'note-attributes' ] . latitude } ,${ note [ 'note-attributes' ] . longitude } `
60
- : undefined ;
61
- } ;
62
137
export const getReminderTime = ( note : EvernoteNoteData ) : string => {
63
138
return ! yarleOptions . skipReminderTime &&
64
139
note [ 'note-attributes' ] &&
65
140
note [ 'note-attributes' ] [ 'reminder-time' ]
66
141
? Moment ( note [ 'note-attributes' ] [ 'reminder-time' ] ) . format ( yarleOptions . dateFormat )
67
142
: undefined ;
68
143
} ;
144
+
69
145
export const getReminderOrder = ( note : EvernoteNoteData ) : string => {
70
146
return ! yarleOptions . skipReminderOrder &&
71
147
note [ 'note-attributes' ] &&
0 commit comments