diff --git a/elixir/filters/cpppathinc.py b/elixir/filters/cpppathinc.py
index 6d3c48c2..d37875a5 100755
--- a/elixir/filters/cpppathinc.py
+++ b/elixir/filters/cpppathinc.py
@@ -1,4 +1,5 @@
import re
+from typing import List
from .utils import Filter, FilterContext, encode_number, decode_number, extension_matches
# Filters for cpp includes like these:
@@ -8,8 +9,10 @@
# If we make references to other projects, we could
# end up with links to headers which are outside the project
# Example: u-boot/v2023.10/source/env/embedded.c#L16
+# prefix_path: a list of paths, will be used to replace the prefix path during the untransform_formatted_code step
class CppPathIncFilter(Filter):
- def __init__(self, *args, **kwargs):
+ def __init__(self, prefix_path: List[str] = ["include"], *args, **kwargs):
+ self.prefix_path = prefix_path
super().__init__(*args, **kwargs)
self.cpppathinc = []
@@ -35,8 +38,11 @@ def keep_cpppathinc(m):
def untransform_formatted_code(self, ctx: FilterContext, html: str) -> str:
def replace_cpppathinc(m):
w = self.cpppathinc[decode_number(m.group(1)) - 1]
- path = f'/include/{ w }'
- return f'{ w }'
+ for p in self.prefix_path:
+ path = f'/%s/{ w }' % p
+ if ctx.query.file_exists(ctx.tag, path):
+ return f'{ w }'
+ return w
return re.sub('__KEEPCPPPATHINC__([A-J]+)', replace_cpppathinc, html, flags=re.MULTILINE)
diff --git a/elixir/filters/projects.py b/elixir/filters/projects.py
index 1059ebd4..6715a7ab 100755
--- a/elixir/filters/projects.py
+++ b/elixir/filters/projects.py
@@ -102,6 +102,11 @@
*default_filters,
ConfigInFilter,
],
+ 'vpp': [
+ *default_filters,
+ (CppPathIncFilter, {"prefix_path": ['src', 'src/plugins', 'src/vpp-api', 'src/vpp-api/vapi']}),
+ MakefileFileFilter,
+ ],
'zephyr': [
*default_filters,
DtsiFilter,
diff --git a/utils/index b/utils/index
index 6e84a3e7..407bad4e 100755
--- a/utils/index
+++ b/utils/index
@@ -140,6 +140,7 @@ add_default_remotes $1 $# $2 linux https://git.kernel.org/pub/scm/linux/kernel/g
https://github.com/bootlin/linux-history.git
add_default_remotes $1 $# $2 xen https://xenbits.xen.org/git-http/xen.git
add_default_remotes $1 $# $2 freebsd https://git.freebsd.org/src.git
+add_default_remotes $1 $# $2 vpp https://gerrit.fd.io/r/vpp
# Index a single project
if test "x$2" != "x--all"; then