Merge pull request #171 from MaximeChretien/defconfigs
http/filters: Add links to Kconfig in defconfig files
This commit is contained in:
commit
04c2458710
3 changed files with 28 additions and 2 deletions
|
|
@ -2,3 +2,4 @@
|
|||
|
||||
exec(open('kconfig.py').read())
|
||||
exec(open('kconfigidents.py').read())
|
||||
exec(open('defconfig.py').read())
|
||||
|
|
|
|||
23
http/filters/defconfig.py
Normal file
23
http/filters/defconfig.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Filter for kconfig identifier in defconfigs
|
||||
|
||||
defconfigidents = []
|
||||
|
||||
def keep_defconfigidents(m):
|
||||
defconfigidents.append(m.group(1))
|
||||
return '__KEEPDEFCONFIGIDENTS__' + encode_number(len(defconfigidents))
|
||||
|
||||
def replace_defconfigidents(m):
|
||||
i = defconfigidents[decode_number(m.group(1)) - 1]
|
||||
|
||||
return '<a href="'+version+'/K/ident/'+i+'">'+i+'</a>'
|
||||
|
||||
defconfigident_filters = {
|
||||
'case': 'filename_extension',
|
||||
'match': {'defconfig'},
|
||||
'prerex': '(CONFIG_[\w]+)',
|
||||
'prefunc': keep_defconfigidents,
|
||||
'postrex': '__KEEPDEFCONFIGIDENTS__([A-J]+)',
|
||||
'postfunc': replace_defconfigidents
|
||||
}
|
||||
|
||||
filters.append(defconfigident_filters)
|
||||
|
|
@ -284,7 +284,8 @@ if mode == 'source':
|
|||
if (c == 'any' or
|
||||
(c == 'filename' and filename in f['match']) or
|
||||
(c == 'extension' and extension in f['match']) or
|
||||
(c == 'path' and fdir.startswith(tuple(f['match'])))):
|
||||
(c == 'path' and fdir.startswith(tuple(f['match']))) or
|
||||
(c == 'filename_extension' and filename.endswith(tuple(f['match'])))):
|
||||
|
||||
apply_filter = True
|
||||
|
||||
|
|
@ -314,7 +315,8 @@ if mode == 'source':
|
|||
if (c == 'any' or
|
||||
(c == 'filename' and filename in f['match']) or
|
||||
(c == 'extension' and extension in f['match']) or
|
||||
(c == 'path' and fdir.startswith(tuple(f['match'])))):
|
||||
(c == 'path' and fdir.startswith(tuple(f['match']))) or
|
||||
(c == 'filename_extension' and filename.endswith(tuple(f['match'])))):
|
||||
|
||||
result = sub(f ['postrex'], f ['postfunc'], result)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue