Skip to content

Commit 11078b2

Browse files
committed
WIP: Add tools section to Boost library views and templates
- Introduced a new TOOLS constant in constants.py containing various Boost tools with descriptions and URLs. - Implemented a get_tools function in utils.py to retrieve and sort the tools. - Updated LibraryListBase to include tools in the context data for library views. - Enhanced categorized_list.html, grid_list.html, and vertical_list.html templates to display tools alongside libraries, with appropriate descriptions and formatting.
1 parent 00c5be9 commit 11078b2

9 files changed

Lines changed: 198 additions & 2 deletions

libraries/constants.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,3 +369,47 @@
369369
DOCKER_CONTAINER_URL_WEB = "http://web:8000"
370370

371371
RELEASE_REPORT_AUTHORS_PER_PAGE_THRESHOLD = 6
372+
TOOLS = [
373+
{
374+
"name": "Boost.Build",
375+
"slug": "build",
376+
"description": "The Boost build system, including the full Boost version of the jam sources.",
377+
"url": "libs/latest/tools/build/doc/html/index.html",
378+
},
379+
{
380+
"name": "Regression",
381+
"slug": "regression",
382+
"description": "The Boost regression testing system reporting sources.",
383+
"url": "tools/regression/index.html",
384+
},
385+
{
386+
"name": "Inspect",
387+
"slug": "inspect",
388+
"description": "The inspection tool used to detect errors in the Boost directory hierarchy.",
389+
"url": "tools/inspect/index.html",
390+
},
391+
{
392+
"name": "BoostBook",
393+
"slug": "boostbook",
394+
"description": "A Boost documentation system, based on DocBook and the Extensible Stylesheet Language (XSL), used by some Boost libraries.",
395+
"url": "tools/boostbook/index.html",
396+
},
397+
{
398+
"name": "bcp",
399+
"slug": "bcp",
400+
"description": "A utility to extract subsets of Boost; to determine which parts of Boost your code is using; and to print reports on Boost usage (including Licence information).",
401+
"url": "tools/bcp/",
402+
},
403+
{
404+
"name": "QuickBook",
405+
"slug": "quickbook",
406+
"description": "QuickBook is a WikiWiki style documentation tool geared towards C++ documentation using simple rules and markup for simple formatting tasks. QuickBook generates BoostBook XML.",
407+
"url": "",
408+
},
409+
{
410+
"name": "Wave",
411+
"slug": "wave",
412+
"description": "A Standards conformant C/C++ preprocessor usable on top of any other compiler. Usable for instance for the debugging of the expansion of macros in your code or as a replacement for your built-in preprocessor.",
413+
"url": "",
414+
},
415+
]

libraries/utils.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
LEGACY_LATEST_RELEASE_URL_PATH_STR,
2020
DEVELOP_RELEASE_URL_PATH_STR,
2121
MASTER_RELEASE_URL_PATH_STR,
22+
TOOLS,
2223
)
2324
from versions.models import Version
2425

@@ -370,3 +371,21 @@ def generate_release_report_filename(version_slug: str, published_format: bool =
370371
filename_data.append(datetime.now(timezone.utc).isoformat())
371372
filename = f"{'-'.join(filename_data)}.pdf"
372373
return filename
374+
375+
376+
def get_tools():
377+
"""
378+
Return list of tool dictionaries.
379+
380+
Tools are utilities used by Boost developers and users,
381+
separate from libraries. They appear alongside libraries
382+
in library list views.
383+
384+
Returns:
385+
list: List of tool dictionaries with keys:
386+
- name: str
387+
- slug: str
388+
- description: str
389+
- url: str
390+
"""
391+
return sorted(TOOLS.copy(), key=lambda tool: tool["name"].lower())

libraries/views.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
get_documentation_url_redirect,
3636
get_prioritized_version,
3737
get_version_from_cookie,
38+
get_tools,
3839
)
3940
from .constants import LATEST_RELEASE_URL_PATH_STR
4041

@@ -104,6 +105,7 @@ def get_queryset(self):
104105
def get_context_data(self, **kwargs):
105106
context = super().get_context_data(**self.kwargs)
106107
context["categories"] = self.get_categories(context["selected_version"])
108+
context["tools"] = get_tools()
107109
# todo: add tests for sort order
108110
if self.kwargs.get("category_slug"):
109111
context["category"] = Category.objects.get(
@@ -210,6 +212,23 @@ def get_results_by_category(self, version: Version | None):
210212
results_by_category.append(
211213
{"category": category, "library_version_list": library_versions}
212214
)
215+
216+
# Add tools as a separate category
217+
tools = get_tools()
218+
if tools:
219+
# Create a simple object for tools category
220+
class ToolsCategory:
221+
name = "Tools"
222+
slug = "tools"
223+
224+
results_by_category.append(
225+
{
226+
"category": ToolsCategory(),
227+
"library_version_list": [],
228+
"tools": tools,
229+
}
230+
)
231+
213232
return results_by_category
214233

215234

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-200 ease-in-out">
2+
<td class="py-2 align-top md:w-1/5">
3+
{% if tool.url %}
4+
<a class="mr-1 font-bold capitalize text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange"
5+
href="{{ tool.url }}" target="_blank" rel="noopener noreferrer">{{ tool.name }}</a>
6+
{% else %}
7+
<span class="mr-1 font-bold capitalize text-sky-600 dark:text-sky-300">{{ tool.name }}</span>
8+
{% endif %}
9+
</td>
10+
11+
<td class="w-12 align-top pt-2.5 pr-2">
12+
{# Empty cell for alignment with library rows #}
13+
</td>
14+
<td class="w-8 pt-2 px-2 text-center align-top">
15+
{# Empty cell for alignment with library rows #}
16+
</td>
17+
<td class="w-8 text-center align-top">
18+
{% if tool.url %}
19+
<a class="text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange text-base block py-3 text-center" href="{{ tool.url }}" target="_blank" rel="noopener noreferrer" title="Website">
20+
<i class="fa fa-globe align-top"></i>
21+
</a>
22+
{% endif %}
23+
</td>
24+
<td class="hidden md:block py-2 pl-3 align-top">{{ tool.description }}</td>
25+
</tr>
26+
<tr class="block md:hidden">
27+
<td>{{ tool.description }}</td>
28+
</tr>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{% load static %}
2+
3+
<div class="relative content-between p-3 bg-white md:rounded-lg md:shadow-lg md:p-5 dark:bg-charcoal hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-200 ease-in-out">
4+
<div class="">
5+
<h3 class="pb-2 text-xl md:text-2xl capitalize border-b border-gray-700">
6+
<div class="flex justify-between">
7+
{% if tool.url %}
8+
<a class="link-header" href="{{ tool.url }}" target="_blank" rel="noopener noreferrer">{{ tool.name }}</a>
9+
{% else %}
10+
<span class="link-header">{{ tool.name }}</span>
11+
{% endif %}
12+
{% if tool.url %}
13+
<a class="text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange text-base block py-3 text-center" href="{{ tool.url }}" target="_blank" rel="noopener noreferrer" title="Website">
14+
<i class="fa fa-globe align-top"></i>
15+
</a>
16+
{% endif %}
17+
</div>
18+
</h3>
19+
</div>
20+
<div class="mb-3 pb-3">
21+
<p class="mb-3 text-gray-700 dark:text-gray-300">{{ tool.description }}</p>
22+
</div>
23+
</div>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-300 ease-in-out">
2+
<td class="align-top md:w-1/5 pt-3">
3+
{% if tool.url %}
4+
<a class="mr-1 pl-1 font-bold capitalize text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange"
5+
href="{{ tool.url }}" target="_blank" rel="noopener noreferrer">{{ tool.name }}</a>
6+
{% else %}
7+
<span class="mr-1 pl-1 font-bold capitalize text-sky-600 dark:text-sky-300">{{ tool.name }}</span>
8+
{% endif %}
9+
</td>
10+
<td class="w-12 align-top pt-3 pr-2">
11+
{# Empty cell for alignment with library rows #}
12+
</td>
13+
<td class="w-8 text-center align-top pt-3">
14+
{# Empty cell for alignment with library rows #}
15+
</td>
16+
<td class="w-8 align-top">
17+
{% if tool.url %}
18+
<a class="text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange text-base block py-3 text-center" href="{{ tool.url }}" target="_blank" rel="noopener noreferrer" title="Website">
19+
<i class="fa fa-globe align-top"></i>
20+
</a>
21+
{% endif %}
22+
</td>
23+
<td class="align-top hidden md:block mt-2 pl-3 md:items-center h-full">{{ tool.description }}</td>
24+
</tr>
25+
<tr class="block md:hidden pl-1 align-top">
26+
<td>{{ tool.description }}</td>
27+
</tr>

templates/libraries/categorized_list.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,24 @@
1717
<div class="space-y-3">
1818
{% for result in library_versions_by_category %}
1919
<div class="relative content-between p-3 w-full bg-white md:rounded-lg md:shadow-lg md:p-5 dark:bg-charcoal">
20-
<h5 class="mb-2 pb-2 text-xl md:text-2xl leading-tight text-orange border-b border-gray-300 dark:border-slate">{{ result.category }}</h5>
20+
<h5 class="mb-2 pb-2 text-xl md:text-2xl leading-tight text-orange border-b border-gray-300 dark:border-slate">{{ result.category.name }}</h5>
21+
{% if result.tools %}
22+
<p class="text-gray-600 dark:text-gray-400 mb-4 mt-2 text-sm">Boost developers, testers, and maintainers have developed various programs to help with the administration of the Boost Libraries. Like everything else about Boost, these tools are available in source form, and are part of the regular Boost distribution.</p>
23+
{% endif %}
2124
<table class="table-auto w-full">
2225
<tbody>
2326
{% for library_version in result.library_version_list %}
2427
{% include "libraries/_library_categorized_list_item.html" %}
2528
{% empty %}
26-
<p class="text-gray-600 dark:text-gray-400">No libraries in this category yet.</p>
29+
{% if not result.tools %}
30+
<p class="text-gray-600 dark:text-gray-400">No libraries in this category yet.</p>
31+
{% endif %}
2732
{% endfor %}
33+
{% if result.tools %}
34+
{% for tool in result.tools %}
35+
{% include "libraries/_tool_categorized_list_item.html" %}
36+
{% endfor %}
37+
{% endif %}
2838
</tbody>
2939
</table>
3040
</div>

templates/libraries/grid_list.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@
2020
</div>
2121
{# end libraries list #}
2222

23+
{# Tools section #}
24+
<div class="mt-8 mb-5">
25+
<h2 class="text-2xl md:text-3xl font-bold text-orange mb-2">Tools</h2>
26+
<p class="text-gray-600 dark:text-gray-400 mb-4">Boost developers, testers, and maintainers have developed various programs to help with the administration of the Boost Libraries. Like everything else about Boost, these tools are available in source form, and are part of the regular Boost distribution.</p>
27+
<div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
28+
{% for tool in tools %}
29+
{% include "libraries/_tool_grid_list_item.html" %}
30+
{% endfor %}
31+
</div>
32+
</div>
33+
{# end tools section #}
34+
2335
{% if page_obj.paginator %}
2436
{# pagination #}
2537
<div class="space-x-3 text-center">

templates/libraries/vertical_list.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,20 @@ <h5 class="pb-2 text-xl md:text-2xl leading-tight text-orange border-b border-gr
2828
</div>
2929
{# end libraries list #}
3030

31+
{# Tools section #}
32+
<div class="relative content-between p-3 w-full bg-white md:rounded-lg md:shadow-lg md:p-5 dark:bg-charcoal mt-3">
33+
<h5 class="pb-2 text-xl md:text-2xl leading-tight text-orange border-b border-gray-300 dark:border-slate">Tools</h5>
34+
<p class="text-gray-600 dark:text-gray-400 mb-4 mt-2 text-sm">Boost developers, testers, and maintainers have developed various programs to help with the administration of the Boost Libraries. Like everything else about Boost, these tools are available in source form, and are part of the regular Boost distribution.</p>
35+
<table class="table-auto w-full">
36+
<tbody>
37+
{% for tool in tools %}
38+
{% include "libraries/_tool_vertical_list_item.html" %}
39+
{% endfor %}
40+
</tbody>
41+
</table>
42+
</div>
43+
{# end tools section #}
44+
3145
{% if page_obj.paginator %}
3246
{# Pagination #}
3347
<div class="space-x-3 text-center">

0 commit comments

Comments
 (0)