Commit Graph

55 Commits

Author SHA1 Message Date
Gerwin Klein d815b87ce5 parse_doxygen_xml: minor typos and python lints
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2025-07-15 08:20:45 +10:00
Gerwin Klein dc66e46a62 parse_doxygen_xml: properly escape string literals
More recent Python versions complain, and they are not wrong.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2025-07-15 08:20:45 +10:00
Ivan Velickovic 67a812009a manual: remove dependency on 'six' Python package
Python2 is no longer supported and hence the dependency
on six is no longer necessary.

According to https://six.readthedocs.io/#six.string_types,
six.string_types is just str in Python3.

According to https://six.readthedocs.io/#six.next in Python2.6
and above, six.next is just next.

Signed-off-by: Ivan Velickovic <i.velickovic@unsw.edu.au>
2024-05-02 10:17:13 +01:00
Gerwin Klein b67c7310af
parse_doxygen_xml: avoid XMLParsedAsHTMLWarning
Explicitly select xml parser (instead of html) via "lxml-xml" in
BeatifulSoup to avoid warning.

Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
2023-11-07 16:01:49 +11:00
Jimmy Brush 9b5b0e9c8a manual: Swap API description and error code table
Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush 9890b78c2b manual: Remove some extra spaces after texttt
Extra spaces are inserted after texttt tags when generating doxygen
comments in order to ensure that xmlonly tags are readable by doxygen.

The extra spaces cause a description like this:

```
Testing <texttt text="1"/>, 2, 3
```

To be rendered like this:

```
Testing 1 , 2, 3
```

This change identifies text runs that start with extra spaces and either
a period or a comma and removes the extra spaces, allowing at least
common punctuation to be rendered correctly.

Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush 02a5f761f7 manual: Add returned error codes table to API
Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Jimmy Brush ae197ad146 libsel4: Generate doxygen tag for error element
Translate "error" elements into "retval" doxygen comment tags when
generating object invocation stubs.

Signed-off-by: Jimmy Brush <code@jimmah.com>
2021-10-17 15:02:45 +11:00
Gerwin Klein 79da079239 Convert license tags to SPDX identifiers
This commit also converts our own copyright headers to directly use
SPDX, but leaves all other copyright header intact, only adding the
SPDX ident. As far as possible this commit also merges multiple
Data61 copyright statements/headers into one for consistency.
2020-03-09 13:21:49 +08:00
Anna Lyons 7b25653de7 manual: parse all doxygen xml for refdict
Previously the manual would only parse the doxygen for a single xml
file, which meant references to symbols on other files would break.
Parse all doxygen files when constructing the ref dict to fix this.
2019-08-22 11:22:36 +10:00
Anna Lyons bc61a7f3bd python2 --> python3
Update all scripts and build system to call python3, given python2's
upcoming doom. Use sys.maxsize instead of sys.maxint in one script
(maxint does not exist in python3).
2019-08-08 10:19:24 +10:00
Anna Lyons cf57914c7f style: run autopep8 on python files 2019-03-27 10:43:58 +11:00
Adam Felizzi bc4580c64e parse_doxygen: Removed tab in Markdown doc format
Removed a trailing tab character in the Markdown API doc format
string.
2018-09-04 12:05:06 +10:00
Anna Lyons f3dc34f427 manual: add missing newline
fixes a missing new line in generated markdown
2018-05-14 15:34:37 +10:00
Anna Lyons d9780ec73e manual: label object groups in parse_doxygen_xml.py
This change adds a label to the latex generated object groups.
2018-05-10 11:36:05 +10:00
Anna Lyons b5ee12f00c manual: group generated API methods by object type
This change generates doxygen groups for each object type, which allows us to create sections in
output documents for each object. This has the advantage that we can later label those sections and
link to them from the main document. Additionally, it improves nagivation of the API docs.
2018-05-10 11:36:01 +10:00
Anna Lyons da1e73fe96 manual: use int level in parse_doxygen_xml.py
The level argument to parse_doxygen_xml.py was previously a latex section header (either subsection
or subsubsection). This change converts the argument to numerical which is more robust and is not
limited to 2 specific levels.

This change
- alters the level argument to be an int, where 0 = highest level header,
- removes the translation of latex header to markdown,
- adds a new 'level_to_header' function to the generator class, which translates the level number
  to a header for that specific output type.
2018-05-10 11:35:59 +10:00
Adam Felizzi e9b43006a3 manual: Added command line option for Markdown
Added a command line option for the user to specify the output
format i.e markdown or latex. The command option is used to either
create a Latex or Markdown class.
2018-05-01 13:50:39 +10:00
Adam Felizzi 8afce61b43 manual: Updated comments
Minor comment changes to the parse_doxygen_xml.py script.
2018-05-01 13:50:39 +10:00
Adam Felizzi 8ab5b3b7d1 manual: Markdown Generator Implementation
Added Markdown Generator implementation. This is a child class
to the Generator class. The Markdown generator class overrides
specific parsing table elements and methods to achieve Markdown
specific output, similar to the Latex Generator.
2018-05-01 13:50:26 +10:00
Adam Felizzi 336b73735f manual: Updated escape character regex
Updated the text_escape function to regex escape characters in the
generators escape set. This is for the case when a generators
special character set collides with regex's special character
set.
2018-05-01 12:28:03 +10:00
Adam Felizzi 8fd604eb13 manual: Added <docref> XML Tag to Doxygen
Introduced a new Doxygen XML tag '<docref>'. The intention of
this tag is to indicate a section of text in the Doxygen XML that
will contain a reference to another section in the Manual e.g.
"See \autoref<sec:x>". As other generation formats aren't aware of
other chapters/sections in the manual, the <docref> encapsulation
allows it to omit the text from the output. The Latex generator
has been modified to continue parsing the 'docref' contents.
2018-05-01 12:28:03 +10:00
Adam Felizzi 33f2fe7d92 manual: Added "heading" field to ref_dict
Updated the reference dictionary with a heading field. This is
the heading title given to the api doc section.
2018-05-01 12:28:03 +10:00
Adam Felizzi 0e6c45f69e manual: Added "original_name" field to ref_dict
Updated the reference dictionary with a non text escaped name
field. This is in case the generator doesn't need the name field
text escaped.
2018-05-01 10:42:09 +10:00
Adam Felizzi 50bffce06e manual: Parameterised escape in 'parse_prototype'
The option to escape the text when parsing the prototype can be
specified to the parse_prototype function. Markdown does not
require special C code characters to be escaped.
2018-05-01 10:42:09 +10:00
Adam Felizzi a0ce040af8 manual: Generalised param_string generation
Moved Latex specific param string generation out of the Generator
class. Added functions to generate the desired param string
format that the Latex class can then override.
2018-04-24 10:03:52 +10:00
Adam Felizzi 886e5f59e0 manual: Generalised Generator Class
Generalised the Generator class, removing Latex specific format
code. Generator class returns empty or plain text when used
by itself.
2018-04-24 10:03:52 +10:00
Adam Felizzi f636155acf manual: Added LatexGenerator Child class
Implemented LatexGenerator child class which extends the
Generator class. The Latex class overrides methods of the
Generator with Latex specific format. Currently a lot of
duplication between Generator and Latex class, need to
generalise the Generator class.
2018-04-24 10:03:52 +10:00
Adam Felizzi b51ca046a4 manual: Renamed methods in Generator class
Renamed select methods to more generic names that don't suggest
they create Latex output.
2018-04-24 10:03:52 +10:00
Adam Felizzi 561e005774 manual: Moved location of get_parse_table function
Code tidying. Moved get_parse_table to the top of the class
implementation to make it more clear/distinct from the other
methods.
2018-04-24 10:03:52 +10:00
Adam Felizzi a8ffb6e54d manual: Moved escape regex into latex_escape func
New generator classes are expected to override the ESCAPE_PATTERNS
variable. Moving the regex into an object method allows it to use
the overriden escape patterns.
2018-04-24 10:03:52 +10:00
Adam Felizzi 334514a7c8 manual: Parameterised the generator class
Parameterised the generator class for the
'generate_general_syscall_doc' method. This will allow the caller
to pass the desired generator to the function.
2018-04-24 10:03:52 +10:00
Adam Felizzi d64ebe473f manual: Created generate_api_doc methods
Moved api doc string format into a seperate function within the
Generator class. This will allow new generators to override the
function with their own api doc format.
2018-04-24 10:03:52 +10:00
Adam Felizzi 326c6fbf26 manual: Moved functionality into Generator class
Moved the parsing functionality into a object. The goal is to
refactor the script into an object model such that we can extend
and override parsing functions to output the doxygen to different
formats. Additionally updated the various methods and variable
accesses to use 'self' inorder to work in the new object oriented
paradigm.
2018-04-24 10:03:52 +10:00
Adam Felizzi e9611eaa9d manual: Moved parse table to function
The parse table has been moved to a function. Updated use
of the PARSE_TABLE to call the function instead.
2018-04-24 10:03:52 +10:00
Kent McLeod 76dd101fe1 manual: fix python script to be python3 compatible 2017-09-18 11:28:33 +10:00
Anna Lyons 192a4162ee manual: allow non sec autorefs
Previously anything in an autoref block was assumed to reference
a section, which isn't true. Change 'sec' to 'label' and move the
'sec' prefix into the label itself.
2017-06-27 16:22:34 +10:00
Anna Lyons adb7916041 manual: fix double escaping bug 2017-06-20 10:22:59 +10:00
Anna Lyons cd9e1c9a39 manual: support for itemized lists 2017-06-19 14:43:54 +10:00
Anna Lyons 93d2ed6a77 manual: fix script licenses 2017-06-19 13:59:08 +10:00
Anna Lyons 4d7c272ba7 manual: appease pylint 2017-06-19 13:59:08 +10:00
Anna Lyons b1ef79e32f manual: refactor + cleanup parse_doxygen_xml.py
- use 'recursive=False' rather than 'content' to only search children
- use a parse table instead of if a long if/else
- fix nested lists
- use get_text from beautiful_soup rather than home brewed
- don't call latex_escape explicitly
2017-06-19 13:59:08 +10:00
Anna Lyons 10801bd891 SELFOUR-962: allow API level description in manual 2017-06-19 13:59:08 +10:00
Anna Lyons c6056ecbe9 SELFOUR-961: allow lists in API docs
this change

- converts ordered doxygen lists to enumerate
- also wraps the benchmark config names in texttt
2017-06-19 13:59:08 +10:00
Anna Lyons 6b69024674 manual: use BeautifulSoup in parse_doxygen_xml
Use BeautifulSoup instead of minidom, for more powerful features
2017-06-19 13:59:08 +10:00
Stephen Sherratt e5c0d63c71 manual: Explicitly say TODO where doc is missing 2017-06-02 15:34:45 +10:00
Stephen Sherratt 7ee77f2933 manual: Comments to docstrings 2017-06-02 15:34:45 +10:00
Stephen Sherratt 748f571855 manual: Include prototypes for undocumented fns 2017-06-02 15:34:45 +10:00
Stephen Sherratt fee7c9bd0d manual: More robust hanlding of xml errors
When generating latex from doxygen-generated xml, if an expected element
is not found in the xml, raise a meaningful exception.
2017-06-02 15:34:45 +10:00
Stephen Sherratt d8e6a00115 manual: Improve handling of return type docs
If no documentation is provided for the return value of a function, the
documentation generator will attempt to infer the documentation based on
the return type.
2017-06-02 15:34:45 +10:00