Skip to content

index: add VPP repository #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions elixir/filters/cpppathinc.py
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 = []

Expand All @@ -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'<a href="{ ctx.get_absolute_source_url(path) }">{ w }</a>'
for p in self.prefix_path:
path = f'/%s/{ w }' % p
if ctx.query.file_exists(ctx.tag, path):
return f'<a href="{ ctx.get_absolute_source_url(path) }">{ w }</a>'
return w

return re.sub('__KEEPCPPPATHINC__([A-J]+)', replace_cpppathinc, html, flags=re.MULTILINE)

5 changes: 5 additions & 0 deletions elixir/filters/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions utils/index
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down