Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c1b2d23

Browse files
author
zhaili
committed
extract id from file content
1 parent 9824b12 commit c1b2d23

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/file.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ file.meta = function(filename) {
172172
}
173173
});
174174

175+
const line2 = this.data(filename).split('\n')
176+
.find(x => x.indexOf(' @lc ') >= 0) || '';
177+
line2.split(' ').forEach(function(x) {
178+
const v = x.split('=');
179+
if (v.length == 2) {
180+
if (v[0]==='id') m.id = v[1].trim();
181+
}
182+
});
183+
175184
// otherwise, look into file name
176185
if (!m.id || !m.lang) {
177186
const olddata = this.metaByName(filename);

0 commit comments

Comments
 (0)