Physlib

Physlib.Meta.Notes.ToHTML

11 declarations

definition

Ordering of `HTMLNote` by file index and line number

#sortLE

The function `Physlib.NoteFile.sortLE` defines a "less than or equal to" comparison between two `HTMLNote` objects, ni1ni_1 and ni2ni_2. The comparison first checks the indices of the file names of the notes within a list N.filesN.\text{files}. If the file names are different, the result is true if the index of the file name of ni1ni_1 is less than or equal to the index of the file name of ni2ni_2. If the file names are the same, the function returns true if the line number of ni1ni_1 is less than or equal to the line number of ni2ni_2.

definition

Sorted list of HTMLNote\text{HTMLNote} objects for files in NN

#getNodeInfo

This function, operating within the `CoreM` monad, retrieves and aggregates a list of `HTMLNote` objects from the environment. It collects data from three sources: standard notes (from `noteExtension`), formal declarations (from `noteDeclExtension`), and informal declarations (from `noteInformalDeclExtension`), converting them into `HTMLNote` structures using `ofNodeInfo`, `ofFormal`, and `ofInformal` respectively. The resulting list is filtered to include only those notes whose file path is contained in the list N.filesN.\text{files}. Finally, the function returns this list sorted according to the ordering relation N.sortLEN.\text{sortLE}, which compares notes based on their file index and line number.

definition

HTML code for Lean syntax highlighting

#codeBlockHTML

The constant `Physlib.NoteFile.codeBlockHTML` is a string containing the HTML header elements and JavaScript configuration required to enable syntax highlighting for code blocks in generated documentation. It includes metadata for character encoding and responsive design, imports the `highlight.js` library and its default CSS, and registers a custom language definition for Lean. This custom definition identifies specific keywords such as `def`, `theorem`, `axiomatic`, `structure`, and `lemma`, and provides regex-based rules for identifying comments and mathematical operators.

definition

CSS styling for informal definitions

#informalDefStyle

The constant `Physlib.NoteFile.informalDefStyle` is a string containing the CSS (Cascading Style Sheets) code used to define the visual styling for informal definitions in HTML documentation. It specifies properties for the `.informal-def` class, including a light red background (hex #f8d7da\text{hex } \#f8d7da), a solid dark red border (hex #dc3545\text{hex } \#dc3545), and relative positioning. It also defines the appearance of buttons within these blocks, including their absolute positioning, transparency (rgba(220,53,69,0.4)\text{rgba}(220, 53, 69, 0.4)), and a hover state that changes the background color to blue (hex #0056b3\text{hex } \#0056b3).

definition

CSS styling for HTML code buttons

#codeButton

The constant `Physlib.NoteFile.codeButton` is a string containing the CSS (Cascading Style Sheets) code used to define the visual appearance and layout of buttons within code blocks in HTML documentation. It specifies properties for the `.code-button` class, such as its absolute positioning, a semi-transparent red background (rgba(220,53,69,0.4)\text{rgba}(220, 53, 69, 0.4)), white text color, and a blue background transition upon hovering.

definition

HTML script for MathJax configuration and loading

#mathJaxScript

The constant `Physlib.NoteFile.mathJaxScript` is a string containing the HTML `<script>` tags used to configure and load the MathJax library. It specifies that LaTeX mathematical expressions should be delimited by `forinlinemathand` for inline math and `$` for display math, and it loads the MathJax 3 engine from a content delivery network (CDN) to ensure proper rendering of mathematical notation in HTML documents.

definition

HTML header for documentation files

#headerHTML

The constant `Physlib.NoteFile.headerHTML` is a string that defines the initial HTML structure and metadata for generated documentation files. It contains a YAML front matter block specifying a default layout, followed by the opening `<html>` and `<head>` tags. The header section includes concatenated strings for Lean syntax highlighting (`codeBlockHTML`), MathJax configuration for rendering mathematical expressions (`mathJaxScript`), and CSS styles for informal definitions (`informalDefStyle`) and interactive buttons (`codeButton`). The string concludes by closing the `<head>` section and opening the `<body>` tag.

definition

HTML snippet for title, authors, and abstract

#titleHTML

The function `Physlib.NoteFile.titleHTML` generates an HTML string to display the metadata of a note NN. It formats the title N.titleN.\text{title} within a centered level-1 heading with a font size of 50px50\text{px}, followed by a centered list of authors N.authorsN.\text{authors} separated by commas, and a centered block containing the abstract N.abstractN.\text{abstract}.

definition

HTML snippet for the Lean and Physlib informational note

#leanNote

The constant `leanNote` is a string containing HTML code intended to display a standardized informational notice. This notice informs the reader that the document was created using the Lean interactive theorem prover to formally verify mathematical and physical content. It further identifies the work as part of the Physlib project for the digitalization of high energy physics and provides hyperlinks for community contribution and feedback via GitHub.

definition

HTML footer string

#footerHTML

The string `footerHTML` represents the footer of an HTML document, consisting of the closing tags `</body>` and `</html>`.

definition

HTML string generation for a `NoteFile` NN

#toHTMLString

This function, operating within the `MetaM` monad, constructs a complete HTML document as a string for a given `NoteFile` NN. It retrieves a list of `HTMLNote` objects associated with NN using `getNodeInfo`, extracts their content strings, and joins them together with newline characters. The final output is formed by concatenating the following components in order: the standard HTML header `headerHTML`, the formatted title and metadata N.titleHTMLN.\text{titleHTML}, the project-specific `leanNote` snippet, the joined content strings from the retrieved notes, and the HTML footer `footerHTML`.