diff --git a/docs/antora/supplemental-ui/css/figures.css b/docs/antora/supplemental-ui/css/figures.css index e0aed6204..206253178 100644 --- a/docs/antora/supplemental-ui/css/figures.css +++ b/docs/antora/supplemental-ui/css/figures.css @@ -1,31 +1,26 @@ .figure-container { position: relative; - margin: 1.5rem auto; - padding: 1rem; - background-color: #fff; - border: 1px solid #ddd; - border-radius: 8px; - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08); + width: 100%; + max-width: 100%; + box-sizing: border-box; + margin: 1.2rem 0; + background: none; + box-shadow: none; + padding: 0.5rem; + border: 1px solid #ccc; + border-radius: 4px; } .subfigure-container { position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background-color: #f9f9f9; - padding: 1rem; - border: 1px solid #ddd; - border-top: none; - border-radius: 0 0 8px 8px; + inset: 0; + background: none; + padding: 0; + border: none; } .subfigure-container.active { position: relative; - opacity: 1; - pointer-events: auto; - z-index: 1; } .subfigure-container.inactive { @@ -37,42 +32,76 @@ /* Tabs container: display buttons inline with a bottom border to indicate grouping */ .tabs-container { display: flex; - border-bottom: 2px solid #007acc; - margin-bottom: 0.5rem; + justify-content: flex-start; + gap: 0; + margin-bottom: 0.4rem; } -/* Figure tab button styling */ + .figure-tab { - background: transparent; + background: none; border: none; - outline: none; - padding: 0.5rem 1rem; - margin-right: 0.3rem; - font-size: 1rem; - color: #007acc; + font-size: 0.9rem; + color: #444; cursor: pointer; - border-radius: 4px 4px 0 0; - transition: background-color 0.2s ease, color 0.2s ease; + border: 1px solid #ccc; + padding: 0.2rem 0.5rem; +} + +.figure-tab:hover { + color: #000; /* subtle darkening on hover */ + background: none; /* no hover background */ } -.figure-tab:hover, -.figure-tab.active { - background-color: #007acc; - color: #fff; + +.export-container { + display: flex; + justify-content: flex-end; + gap: 0.3rem; + margin-bottom: 0.3rem; } .export-container button { - background-color: #007acc; - color: #fff; + background: none; + color: #666; border: none; - padding: 0.4rem 0.8rem; - margin-right: 0.4rem; - border-radius: 4px; + padding: 0; + font-size: 0.75rem; cursor: pointer; - font-size: 0.9rem; - transition: background-color 0.2s ease; + text-decoration: underline; } .export-container button:hover { - background-color: #005fa3; -} \ No newline at end of file + color: #000; +} + +.exampleblock.plot{ + border: 1px solid #ccc; + border-radius: 4px; +} + +/* Example block styling for plots */ +.exampleblock.plot,.exampleblock.grid,.exampleblock.image { + border: none; + padding: 0; + margin: 1.5rem 0; + display: flex; + flex-direction: column; +} + +.exampleblock.plot>.content,.exampleblock.grid>.content ,.exampleblock.image>.content { + order: 1; + padding: 0; + border: none; +} + +.exampleblock.plot>.title,.exampleblock.grid>.title,.exampleblock.image>.title, .plotly-figure-caption{ + order: 2; + text-align: center; + font-style: italic; + margin-top: 0.5rem; +} + +.exampleblock.example { + border-left: 4px solid var(--brand-primary); +} diff --git a/docs/modules/json_report/pages/json_schema/content/figure.adoc b/docs/modules/json_report/pages/json_schema/content/figure.adoc index 4a684d344..ff85915c7 100644 --- a/docs/modules/json_report/pages/json_schema/content/figure.adoc +++ b/docs/modules/json_report/pages/json_schema/content/figure.adoc @@ -10,7 +10,9 @@ The **Plot Node** defines a data visualization within the report. It specifies t |=== |Field|Type|Description|Default Value +|`id`|string| *Optional.* Identifies the plot node within the report. Used for internal cross referencing |`null` |`type`|string|Must be set to `"plot"`.|`"plot"` +|`caption`|string|*Optional.* A descriptive caption for the figure.|`null` |`ref`|string|The unique `name` of the data file (from the root `data` list) to reference for building the figure.|*Required* |`plot`|object|The nested configuration object (`Plot` schema) defining the figure's dimensions, type, and transformation.|*Required* |=== diff --git a/docs/modules/json_report/pages/json_schema/content/grid.adoc b/docs/modules/json_report/pages/json_schema/content/grid.adoc index 27ea11aa8..2cef35996 100644 --- a/docs/modules/json_report/pages/json_schema/content/grid.adoc +++ b/docs/modules/json_report/pages/json_schema/content/grid.adoc @@ -1,11 +1,13 @@ = Grid Node -The **Grid Node** is a layout node that can be used to structure content into a grid. +The **Grid Node** is a layout node that can be used to structure content into a grid. Mainly used to arrange images, plots, or tables side by side in a visually appealing manner. Sub figures or sub plots can be created using this node, but numbering and labeling must be handled manually within the captions of the child nodes. |=== |Field|Type|Description|Default Value +|`id`|string| *Optional.* Identifies the grid node within the report. Used for internal cross referencing |`null` |`type`|string|Must be set to `"grid"`.|`"grid"` +|`caption`|string|*Optional.* A descriptive caption for the grid.|`null` |`contents`|array of objects| A list of other (non-recursive) content nodes.|[] |columns|int| Number of columns for the grid. Must be between 1 and 4.| 1 |gap|int| Must be beween 1 and 3| 2. diff --git a/docs/modules/json_report/pages/json_schema/content/image.adoc b/docs/modules/json_report/pages/json_schema/content/image.adoc index e2bb8f84d..ec20829b2 100644 --- a/docs/modules/json_report/pages/json_schema/content/image.adoc +++ b/docs/modules/json_report/pages/json_schema/content/image.adoc @@ -12,7 +12,9 @@ The `src` file path is typically resolved relative to the passed configuration f |=== |Field|Type|Description|Default Value +|`id`|string| *Optional.* Identifies the image node within the report. Used for internal cross referencing |`null` |`type`|string|Must be set to `"image"`.|`"image"` +|`caption`|string|*Optional.* A descriptive caption for the image.|`null` |`src`|string|The file path or URL of the image to embed.|*Required* |`caption`|string|An optional caption displayed beneath the image. If provided, the image is rendered using the `title` attribute in AsciiDoc.|`null` |`alt`|string|Alternative text for the image, used for accessibility and when the image cannot be displayed.|`null` diff --git a/docs/modules/json_report/pages/json_schema/content/latex.adoc b/docs/modules/json_report/pages/json_schema/content/latex.adoc index c3d0eea92..78ae79fd1 100644 --- a/docs/modules/json_report/pages/json_schema/content/latex.adoc +++ b/docs/modules/json_report/pages/json_schema/content/latex.adoc @@ -5,6 +5,8 @@ The **LaTeX Node** is designed for the direct embedding of mathematical formulas |=== |Field|Type|Description|Default Value +|`id`|string| *Optional.* Identifies the LaTeX node within the report. Used for internal cross referencing |`null` +|`is_equation`|boolean|*Optional.* Indicates if the LaTeX content represents a standalone equation. It adds `\begin\{equation\}` and `\end\{equation\}` around the content if true.|`false` |`type`|string|Must be set to `"latex"`.|`"latex"` |`latex`|string|The raw LaTeX content (e.g., a mathematical equation or a custom LaTeX block).|*Required* |`ref`|string|The `name` of the data field to reference for dynamic placeholder resolution.|`null` diff --git a/docs/modules/json_report/pages/json_schema/content/list.adoc b/docs/modules/json_report/pages/json_schema/content/list.adoc index e3067e104..de605e914 100644 --- a/docs/modules/json_report/pages/json_schema/content/list.adoc +++ b/docs/modules/json_report/pages/json_schema/content/list.adoc @@ -7,6 +7,7 @@ The **List Node** is used to render ordered lists. Its primary strength is that |=== |Field|Type|Description|Default Value +|`id`|string| *Optional.* Identifies the list node within the report. Used for internal cross referencing |`null` |`type`|string|Must be set to `"itemize"`.|`"itemize"` |`items`|array of objects/strings|The contents of the list. Each entry can be a simple string, a full `Text Node` object, or a `Text Configuration` object.|*Required* |`ref`|string|The `name` of the data field to reference for dynamic placeholder resolution within all list items.|`null` diff --git a/docs/modules/json_report/pages/json_schema/content/section.adoc b/docs/modules/json_report/pages/json_schema/content/section.adoc index 609ade1e9..549c22205 100644 --- a/docs/modules/json_report/pages/json_schema/content/section.adoc +++ b/docs/modules/json_report/pages/json_schema/content/section.adoc @@ -5,6 +5,7 @@ The **Section Node** is the fundamental building block for structuring your repo |=== |Field|Type|Description|Default Value +|`id`|string| *Optional.* Identifies the section node within the report. Used for internal cross referencing |`null` |`type`|string|Must be set to `"section"`.|`"section"` |`title`|string|The title of the section.|*Required* |`contents`|array of objects|A recursive list of other content nodes, including nested `SectionNode`s.| [] diff --git a/docs/modules/json_report/pages/json_schema/content/table.adoc b/docs/modules/json_report/pages/json_schema/content/table.adoc index 5ffd6d3a6..3b82b09a0 100644 --- a/docs/modules/json_report/pages/json_schema/content/table.adoc +++ b/docs/modules/json_report/pages/json_schema/content/table.adoc @@ -10,6 +10,8 @@ The structure is composed of the `TableNode` container and the nested `Table` co |=== |Field|Type|Description|Default Value + +|`id`|string| *Optional.* Identifies the table node within the report. Used for internal cross referencing |`null` |`type`|string|Must be set to `"table"`.|`"table"` |`ref`|string|The unique reference of the data file (from the root `data` list) containing the table to be rendered.|*Required* |`caption`|string|*Optional.* Table caption.| `null` diff --git a/docs/modules/json_report/pages/json_schema/content/text.adoc b/docs/modules/json_report/pages/json_schema/content/text.adoc index 34d543fe4..5cc3de0a9 100644 --- a/docs/modules/json_report/pages/json_schema/content/text.adoc +++ b/docs/modules/json_report/pages/json_schema/content/text.adoc @@ -5,6 +5,7 @@ The **Text Node** is used to insert narrative content into your report. It suppo |=== |Field|Type|Description|Default Value +|`id`|string| *Optional.* Identifies the text node within the report. Used for internal cross referencing |`null` |`type`|string|Must be set to `"text"`.|`"text"` |`text`|string or object|The text content or a nested `Text` object.|*Required* |`ref`|string|The `name` of the data field to reference for dynamic placeholder resolution.|`null` diff --git a/docs/modules/json_report/pages/json_schema/referencing.adoc b/docs/modules/json_report/pages/json_schema/referencing.adoc new file mode 100644 index 000000000..c9d590204 --- /dev/null +++ b/docs/modules/json_report/pages/json_schema/referencing.adoc @@ -0,0 +1,83 @@ += Internal Cross References + +It is possible to assign an optional unique identifier to any content node within the JSON report schema. This identifier can then be used to create internal cross-references within the report, allowing for easy navigation between different sections or elements. + +== Assigning Identifiers + +To assign an identifier to a content node, include the `id` field in the node's JSON object. The value of this field should be a unique string that serves as the identifier for that node. + +[source,json] +---- +{ + "type": "section", + "id": "introduction", + "title": "Introduction", + "contents": [ + // Other content nodes + ] +} +---- +In this example, the section node is assigned the identifier `"introduction"`. + +[IMPORTANT] +Ensure that each id contains only alphanumeric characters, underscores, or hyphens, and does not start with a number. This ensures compatibility with AsciiDoc cross-referencing conventions. + +== Figure and Table Numbering + +Tables, figures and images are automatically numbered in the order they appear in the report. However, tables will be prefixed with "Table", figures, plots and images will be prefixed with "Figure". This means that automatic numbering will be independent between tables and figures/images. + +[IMPORTANT] +Elements included inside a grid node are NOT automatically numbered. You must manually include numbering in the caption if desired (e.g. "Figure 1a: ..."). The counter for the automatic numbering will not be incremented for these elements. + +== Creating Cross-References + +To create a cross-reference to a content node with an assigned identifier, use the link:https://docs.asciidoctor.org/asciidoc/latest/macros/xref/#internal-cross-references[AsciiDoc cross-referencing syntax]. The format is `\<>`, where `id` is the identifier of the target node, and `Display Text` is the text that will be displayed as the link in the report. + +[source,asciidoc] +---- +See <> for more details. +---- + +In this example, the text "Introduction Section" will be a clickable link that navigates to the section with the identifier `"introduction"`. + +[TIP] +For images, figures and tables, it is possible to reference via their caption without the use of an explicit id (though it is discouraged for clarity). To do so, remove any parentheses from the reference, and replace spaces with hyphens. For example, if a table has the caption "Performance Metrics", you can reference it using `\<>`. + +[IMPORTANT] +Ensure that the identifiers used in cross-references match exactly with those assigned to the content nodes, including case sensitivity. Mismatched identifiers will result in broken links in the final report. + +== Example + +[source,json] +---- +{ + "contents": [ + { + "type":"text", + "id":"intro_text", + "text":"Welcome to the report." + }, + { + "type":"section", + "id":"data_analysis", + "title":"Data Analysis", + "contents":[ + { + "type":"table", + "id":"results_table", + "ref":"results_data", + "caption":"Results Overview" + }, + { + "type":"text", + "text":"Refer to <> for context." + } + ] + }, + { + "type":"text", + "text":"See <> for detailed metrics." + } + ] +} +---- \ No newline at end of file diff --git a/docs/modules/json_report/pages/json_schema/report_schema.adoc b/docs/modules/json_report/pages/json_schema/report_schema.adoc index 2712975c6..f85d9efa3 100644 --- a/docs/modules/json_report/pages/json_schema/report_schema.adoc +++ b/docs/modules/json_report/pages/json_schema/report_schema.adoc @@ -58,7 +58,7 @@ include::data.adoc[leveloffset=+1] include::content/section.adoc[leveloffset=+1] -include::content/section.adoc[leveloffset=+1] +include::content/grid.adoc[leveloffset=+1] include::content/text.adoc[leveloffset=+1] @@ -70,4 +70,6 @@ include::content/image.adoc[leveloffset=+1] include::content/table.adoc[leveloffset=+1] -include::content/figure.adoc[leveloffset=+1] \ No newline at end of file +include::content/figure.adoc[leveloffset=+1] + +include::referencing.adoc[leveloffset=+1] \ No newline at end of file diff --git a/examples/matrixvector/plots.json b/examples/matrixvector/plots.json index 1f3188743..6d98c7ea4 100644 --- a/examples/matrixvector/plots.json +++ b/examples/matrixvector/plots.json @@ -46,7 +46,7 @@ "contents":[ { "type":"table", - "ref": "reframe_df", + "ref": "parameter_table", "layout":{ "rename":{ "testcases.time_total":"Total Time (s)", diff --git a/examples/parallelsum/plots.json b/examples/parallelsum/plots.json index e239a4058..016514012 100644 --- a/examples/parallelsum/plots.json +++ b/examples/parallelsum/plots.json @@ -47,33 +47,22 @@ "contents": [ { "type": "table", - "ref": "reframe_df", + "ref": "parameter_table", "layout": { - "columns": ["result", "testcases.hashcode", "tasks", "elements", "testcases.time_total"], - "computed_columns":{ - "logs_link":"f'link:logs/{row[\"testcases.hashcode\"]}.html[Logs]'" - }, "rename": { "testcases.time_total": "Total Time (s)", "testcases.hashcode": "Hash", "result": "", "logs_link":"" }, - "group_by": { "columns": ["testcases.hashcode"], "agg": "first" }, - "format": { - "testcases.time_total": "%.3f", - "tasks":"%.0f", - "elements":"%.0f", - "result": { "pass": "🟢", "fail": "🔴" } - }, - "column_order": ["result", "testcases.hashcode", "tasks", "elements", "testcases.time_total","logs_link"], - "style": { - "column_align": { "result": "center" }, - "column_width":{ "result":1,"logs_link":1}, - "classnames": ["scrollable", "sortable"] - } + "column_order": ["result", "testcases.hashcode", "tasks", "elements", "testcases.time_total","logs_link"] }, - "filter": { "placeholder": "Filter testcases..." } + "filter": { "placeholder": "Filter testcases..." }, + "style": { + "column_align": { "result": "center" }, + "column_width":{ "result":1,"logs_link":1}, + "classnames": ["scrollable", "sortable"] + } } ] }, diff --git a/examples/sorting/plots.json b/examples/sorting/plots.json index 9e9deb3ed..4fa4cbe99 100644 --- a/examples/sorting/plots.json +++ b/examples/sorting/plots.json @@ -47,7 +47,7 @@ "contents": [ { "type": "table", - "ref": "reframe_df", + "ref": "parameter_table", "layout": { "rename": { "testcases.time_total": "Execution Time (s)", diff --git a/src/feelpp/benchmarking/json_report/schemas/jsonReport.py b/src/feelpp/benchmarking/json_report/schemas/jsonReport.py index f51aab761..5aa4fbb3b 100644 --- a/src/feelpp/benchmarking/json_report/schemas/jsonReport.py +++ b/src/feelpp/benchmarking/json_report/schemas/jsonReport.py @@ -8,6 +8,7 @@ class ReportNode(BaseModel): type:str + id: Optional[str] = None ref: Optional[str] = None model_config = ConfigDict( extra="forbid" ) @@ -19,6 +20,7 @@ class TextNode(ReportNode): class LatexNode(ReportNode): type:Literal["latex"] + is_equation: Optional[bool] = False latex: str class ImageNode(ReportNode): @@ -30,6 +32,7 @@ class ImageNode(ReportNode): class PlotNode(ReportNode): type: Literal["plot"] + caption: Optional[str] = None plot: Plot @@ -68,6 +71,7 @@ class SectionNode(ReportNode): class GridNode(ReportNode): type: Literal["grid"] contents: Optional[List[Node]] = [] + caption: Optional[str] = None columns: Optional[int] = 1 justify: Optional[Literal["start","center","end"]] = "start" align: Optional[Literal["start","center","end"]] = "start" diff --git a/src/feelpp/benchmarking/json_report/templates/json2adoc_report.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/json2adoc_report.adoc.j2 index 0340d76b6..4fa47bf99 100644 --- a/src/feelpp/benchmarking/json_report/templates/json2adoc_report.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/json2adoc_report.adoc.j2 @@ -1,3 +1,4 @@ +:example-caption: Figure {% if report.description %} :description: {{ report.description }} {% endif %} diff --git a/src/feelpp/benchmarking/json_report/templates/macros/grid.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/macros/grid.adoc.j2 index 42db4b9bd..1412541b9 100644 --- a/src/feelpp/benchmarking/json_report/templates/macros/grid.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/macros/grid.adoc.j2 @@ -5,23 +5,34 @@ {% import "macros/table.adoc.j2" as table %} {% import "macros/itemize.adoc.j2" as itemize %} -{% set handlers = { - "plot": plot.render, - "text": text.render, - "image": image.render, - "latex": latex.render, - "table": table.render, - "itemize": itemize.render -} %} - {% macro render(gridNode,report_data) %} -[.grid.grid-{{gridNode.columns}}.grid-{{gridNode.gap}}.justify-{{gridNode.justify}}.align-{{gridNode.align}}] +{% if gridNode.id %} +[[{{gridNode.id}}]] +{% endif %} +[example.grid] +{% if gridNode.caption %} +.{{gridNode.caption}} +{% endif %} +==== +[.grid.grid-{{gridNode.columns}}.gap-{{gridNode.gap}}.justify-{{gridNode.justify}}.align-{{gridNode.align}}] -- +:figure-caption!: {%for node in gridNode.contents%} -{% set handler = handlers.get(node.type) %} -{% if handler %} -{{ handler(node,report_data.get(node.ref)) }} +{% if node.type == "image" %} +{{ image.render(node,report_data.get(node.ref), make_block=False) }} +{% elif node.type == "plot" %} +{{ plot.render(node,report_data.get(node.ref), make_block=False) }} +{% elif node.type == "latex" %} +{{ latex.render(node,report_data.get(node.ref)) }} +{% elif node.type == "text" %} +{{ text.render(node,report_data.get(node.ref)) }} +{% elif node.type == "table" %} +{{ table.render(node,report_data.get(node.ref)) }} +{% elif node.type == "itemize" %} +{{ itemize.render(node,report_data.get(node.ref)) }} {% endif %} {% endfor %} +:figure-caption: Figure -- -{% endmacro %} +==== +{% endmacro %} \ No newline at end of file diff --git a/src/feelpp/benchmarking/json_report/templates/macros/image.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/macros/image.adoc.j2 index 88c221a09..bf5305e7f 100644 --- a/src/feelpp/benchmarking/json_report/templates/macros/image.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/macros/image.adoc.j2 @@ -1,12 +1,22 @@ -{% macro render(imageNode,data) %} +{% macro render(imageNode,data,make_block = True) %} {% set src = imageNode.src %} {% set alt = imageNode.alt or imageNode.caption or "" %} {% set styles = imageNode.style | join(' ')%} +{% if imageNode.id %} +[[{{imageNode.id}}]] +{% elif imageNode.caption %} +[[{{imageNode.caption | replace(' ','-') | replace('(','') | replace(')','') }}]] +{% endif %} {% if imageNode.caption %} -image::{{src}}[role="{{styles}}",alt={{alt}},title={{imageNode.caption}}] +.{{imageNode.caption}} +{% endif %} +{% if make_block %} +[example.image] +==== +image::{{src}}[role="{{styles}}",alt={{alt}}] +==== {% else %} -image::{{src}}[role=""{{styles}}"",alt={{alt}}] +image::{{src}}[role="{{styles}}",alt={{alt}}] {% endif %} - {% endmacro %} diff --git a/src/feelpp/benchmarking/json_report/templates/macros/itemize.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/macros/itemize.adoc.j2 index 25e2d2e2a..e828e3dd2 100644 --- a/src/feelpp/benchmarking/json_report/templates/macros/itemize.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/macros/itemize.adoc.j2 @@ -2,6 +2,9 @@ {% macro render(listNode,data) %} +{% if listNode.id %} +[[{{listNode.id}}]] +{% endif %} {% for item in listNode.items %} - {{text.render(item,data)}} {% endfor %} diff --git a/src/feelpp/benchmarking/json_report/templates/macros/latex.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/macros/latex.adoc.j2 index cdfebdf1e..795bb455c 100644 --- a/src/feelpp/benchmarking/json_report/templates/macros/latex.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/macros/latex.adoc.j2 @@ -1,8 +1,17 @@ {% macro render(latexNode,data) %} +{% if latexNode.id %} +[[{{latexNode.id}}]] +{% endif %} [stem] ++++ +{%if latexNode.is_equation %} +\begin{equation} {{ latexNode.latex }} +\end{equation} +{% else %} +{{ latexNode.latex }} +{% endif %} ++++ {% endmacro %} \ No newline at end of file diff --git a/src/feelpp/benchmarking/json_report/templates/macros/plot.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/macros/plot.adoc.j2 index 8660519bf..3d1611787 100644 --- a/src/feelpp/benchmarking/json_report/templates/macros/plot.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/macros/plot.adoc.j2 @@ -1,5 +1,18 @@ -{% macro render(plotNode,data) %} - +{% macro render(plotNode,data, make_block=True) %} + + +{% if plotNode.id %} +[[{{plotNode.id}}]] +{% elif plotNode.caption %} +[[{{plotNode.caption | replace(' ','-')}}]] +{% endif %} +{% if make_block %} +[example.plot] +{%if plotNode.caption %} +.{{plotNode.caption}} +{% endif %} +==== +{% endif %} ++++ {% for figure in FiguresController(data.get(plotNode.ref),plotNode.plot).generateAll() %} @@ -15,6 +28,7 @@ {% for subfigure in figure.subfigures %}
+ {{subfigure.html}}
{% for export in subfigure.exports %} @@ -24,13 +38,19 @@ {% endfor %}
- {{subfigure.html}}
{% endfor %} + + {%if plotNode.caption and make_block==False %} +
{{plotNode.caption}}
+ {% endif %} {% endfor %} ++++ +{% if make_block %} +==== +{% endif %} {% endmacro %} \ No newline at end of file diff --git a/src/feelpp/benchmarking/json_report/templates/macros/section.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/macros/section.adoc.j2 index d04566a27..2b801fe0b 100644 --- a/src/feelpp/benchmarking/json_report/templates/macros/section.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/macros/section.adoc.j2 @@ -17,6 +17,9 @@ {% macro render(sectionNode, report_data, level=1) %} +{% if sectionNode.id %} +[[{{sectionNode.id}}]] +{% endif %} {%if sectionNode.title %} {{ '=' * level }} {{ sectionNode.title }} {%endif%} diff --git a/src/feelpp/benchmarking/json_report/templates/macros/table.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/macros/table.adoc.j2 index 9d22dd8b9..58506cbf7 100644 --- a/src/feelpp/benchmarking/json_report/templates/macros/table.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/macros/table.adoc.j2 @@ -4,13 +4,18 @@ {%set table = table_controller.generate() %} -{% if tableNode.caption %} -.{{tableNode.caption}} -{% endif %} {% if tableNode.style.classnames %} [{% for classname in tableNode.style.classnames %}.{{classname}}{% endfor %}] {% endif %} -- +{% if tableNode.id %} +[[{{tableNode.id}}]] +{% elif tableNode.caption %} +[[{{tableNode.caption | replace(' ','-')}}]] +{% endif %} +{% if tableNode.caption %} +.{{tableNode.caption}} +{% endif %} [cols="{{ table_controller.getColsAlignment() }}",options="header"] |=== diff --git a/src/feelpp/benchmarking/json_report/templates/macros/text.adoc.j2 b/src/feelpp/benchmarking/json_report/templates/macros/text.adoc.j2 index 37eeda3f2..e952e14d7 100644 --- a/src/feelpp/benchmarking/json_report/templates/macros/text.adoc.j2 +++ b/src/feelpp/benchmarking/json_report/templates/macros/text.adoc.j2 @@ -1,3 +1,6 @@ {% macro render(textNode,data) %} +{%if textNode.id %} +[[{{textNode.id}}]] +{% endif %} {{ TextController((data or {}).get(textNode.ref),textNode.text).generate() }} {% endmacro %} \ No newline at end of file diff --git a/src/feelpp/benchmarking/json_report/tests/data/golden/basic_text.adoc b/src/feelpp/benchmarking/json_report/tests/data/golden/basic_text.adoc index 855535a60..0eafa3059 100644 --- a/src/feelpp/benchmarking/json_report/tests/data/golden/basic_text.adoc +++ b/src/feelpp/benchmarking/json_report/tests/data/golden/basic_text.adoc @@ -1,3 +1,4 @@ +:example-caption: Figure :docdatetime: == Introduction diff --git a/src/feelpp/benchmarking/json_report/tests/data/golden/list_with_data.adoc b/src/feelpp/benchmarking/json_report/tests/data/golden/list_with_data.adoc index 2586d7ebc..8992f2fa5 100644 --- a/src/feelpp/benchmarking/json_report/tests/data/golden/list_with_data.adoc +++ b/src/feelpp/benchmarking/json_report/tests/data/golden/list_with_data.adoc @@ -1,3 +1,4 @@ +:example-caption: Figure :docdatetime: == Metadata diff --git a/src/feelpp/benchmarking/json_report/tests/data/golden/plot_features.adoc b/src/feelpp/benchmarking/json_report/tests/data/golden/plot_features.adoc index 6c080f5b0..eef395eda 100644 --- a/src/feelpp/benchmarking/json_report/tests/data/golden/plot_features.adoc +++ b/src/feelpp/benchmarking/json_report/tests/data/golden/plot_features.adoc @@ -1,27 +1,34 @@ +:example-caption: Figure :docdatetime: == Score Analysis +[example.plot] +==== ++++
-
- - -
FIGURE
+
+ + +
++++ +==== + +[example.plot] +==== ++++
@@ -31,34 +38,33 @@
- -
- - -
FIGURE
- -
-
-
+ +
+ +
FIGURE
+
+ + +
++++ - +==== The scatter plot shows the average score per subject for each student, while the stacked bar plot visualizes how many subjects each student passed. diff --git a/src/feelpp/benchmarking/json_report/tests/data/golden/preprocessor.adoc b/src/feelpp/benchmarking/json_report/tests/data/golden/preprocessor.adoc index 307df8f72..6b7c4d16c 100644 --- a/src/feelpp/benchmarking/json_report/tests/data/golden/preprocessor.adoc +++ b/src/feelpp/benchmarking/json_report/tests/data/golden/preprocessor.adoc @@ -1,3 +1,4 @@ +:example-caption: Figure :docdatetime: Processed Text: Foo Foo Baz diff --git a/src/feelpp/benchmarking/json_report/tests/data/golden/report.adoc b/src/feelpp/benchmarking/json_report/tests/data/golden/report.adoc index 9b462f10f..0146176db 100644 --- a/src/feelpp/benchmarking/json_report/tests/data/golden/report.adoc +++ b/src/feelpp/benchmarking/json_report/tests/data/golden/report.adoc @@ -1,3 +1,4 @@ +:example-caption: Figure :docdatetime: @@ -94,44 +95,48 @@ Placeholders in this report allow dynamic insertion of values from the datasets. == Performance Analysis +[example.plot] +==== ++++
-
- - -
FIGURE
+
+ + +
++++ +==== - +[example.plot] +==== ++++
-
- - -
FIGURE
+
+ + +
++++ - +==== The scatter plot shows average scores per subject, while the bar chart shows average attendance rates for each student. diff --git a/src/feelpp/benchmarking/json_report/tests/data/golden/table_features.adoc b/src/feelpp/benchmarking/json_report/tests/data/golden/table_features.adoc index 80d5f4e20..c70e2a35c 100644 --- a/src/feelpp/benchmarking/json_report/tests/data/golden/table_features.adoc +++ b/src/feelpp/benchmarking/json_report/tests/data/golden/table_features.adoc @@ -1,3 +1,4 @@ +:example-caption: Figure :docdatetime: == Student Performance diff --git a/src/feelpp/benchmarking/reframe/schemas/defaultJsonReport.py b/src/feelpp/benchmarking/reframe/schemas/defaultJsonReport.py index 6db87b007..799edb2b8 100644 --- a/src/feelpp/benchmarking/reframe/schemas/defaultJsonReport.py +++ b/src/feelpp/benchmarking/reframe/schemas/defaultJsonReport.py @@ -80,7 +80,8 @@ def applyDefaultPlots(cls, values): item = { "type": "plot", "ref":"reframe_df", - "plot": DefaultPlot.model_validate(item["plot"]) + "plot": DefaultPlot.model_validate(item["plot"]), + "caption": item.get("caption", None) } elif isinstance(item, dict) and (item.get("type") == "section" or item.get("type")=="grid"): item = cls.applyDefaultPlots(item)