File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -20,19 +20,27 @@ def get_extra_field_data(self):
20
20
ref = None
21
21
fields = None
22
22
datasheet = None
23
+ libsource = None
23
24
for f in c [1 :]:
24
25
if f [0 ] == 'ref' :
25
26
ref = f [1 ]
26
27
if f [0 ] == 'fields' :
27
28
fields = f [1 :]
28
29
if f [0 ] == 'datasheet' :
29
30
datasheet = f [1 ]
31
+ if f [0 ] == 'libsource' :
32
+ libsource = f [1 :]
30
33
if ref is None :
31
34
return None
32
35
ref_fields = comp_dict .setdefault (ref , {})
33
36
if datasheet and datasheet != '~' :
34
- field_set .add ('datasheet' )
35
- ref_fields ['datasheet' ] = datasheet
37
+ field_set .add ('Datasheet' )
38
+ ref_fields ['Datasheet' ] = datasheet
39
+ if libsource is not None :
40
+ for lib_field in libsource :
41
+ if lib_field [0 ] == 'description' :
42
+ field_set .add ('Description' )
43
+ ref_fields ['Description' ] = lib_field [1 ]
36
44
if fields is None :
37
45
continue
38
46
for f in fields :
Original file line number Diff line number Diff line change 1
1
class ParserBase :
2
- DEFAULT_FIELDS = []
3
2
4
3
def __init__ (self , file_name ):
5
4
"""
@@ -29,7 +28,7 @@ def parse(self, normalize_case):
29
28
def get_extra_field_data (self ):
30
29
# type: () -> tuple
31
30
"""
32
- Parses the file and returns a extra field data.
31
+ Parses the file and returns extra field data.
33
32
:return: tuple of the format
34
33
(
35
34
[field_name1, field_name2,... ],
Original file line number Diff line number Diff line change @@ -23,12 +23,16 @@ def get_extra_field_data(self):
23
23
if datasheet :
24
24
datasheet = self .get_text (datasheet [0 ].childNodes )
25
25
if datasheet != '~' :
26
- field_set .add ('datasheet' )
27
- ref_fields ['datasheet' ] = datasheet
26
+ field_set .add ('Datasheet' )
27
+ ref_fields ['Datasheet' ] = datasheet
28
+ libsource = c .getElementsByTagName ('libsource' )
29
+ if libsource and libsource [0 ].hasAttribute ('description' ):
30
+ field_set .add ('Description' )
31
+ attr = libsource [0 ].attributes ['description' ]
32
+ ref_fields ['Description' ] = attr .value
28
33
for f in c .getElementsByTagName ('field' ):
29
34
name = f .attributes ['name' ].value
30
- if name not in self .DEFAULT_FIELDS :
31
- field_set .add (name )
32
- ref_fields [name ] = self .get_text (f .childNodes )
35
+ field_set .add (name )
36
+ ref_fields [name ] = self .get_text (f .childNodes )
33
37
34
38
return list (field_set ), comp_dict
You can’t perform that action at this time.
0 commit comments