How do you specify an option to Doxygen's \fileinfo command?

27 Views Asked by At

All commands in the documentation start with a backslash () or an at-sign (@). If you prefer you can replace all commands starting with a backslash below by their counterparts that start with an at-sign.
https://www.doxygen.nl/manual/commands.html

\fileinfo['{'option'}']
Shows (part) of the file name in which this command is placed. The option can be name, extension, filename, directory or, full, with

  • name the name of the file without extension
  • extension the extension of the file
  • filename the filename i.e. name plus extension
  • directory the directory of the given file full the full path and filename of the given file.

In case no option is specified the filename is used unless FULL_PATH_NAMES is set to YES in which case full is used.
https://www.doxygen.nl/manual/commands.html#cmdfileinfo

My Doxyfile:

PROJECT_NAME = hello-world
PROJECT_NUMBER = 0.1.0

INPUT = "C:/dev/hello-world/src" 
INPUT += "C:/dev/hello-world/doc/mainpage.txt"

OUTPUT_DIRECTORY = "C:/dev/hello-world/build/doc"

OUTPUT_LANGUAGE = English

FILE_PATTERNS = *.c *.h
RECURSIVE = YES

My attempted main page, mainpage.txt:

/**
  @mainpage Main page
  @page My test main page
  Generated from @fileinfo['{'directory'}']
*/

Here is some normal text.

The text from the resulting generated HTML page:

Generated from C:/dev/hello-world/doc/mainpage.txt ['{'directory'}']

What is the proper syntax to manipulate Doxygen's \fileinfo command with its advertised options?
I want to be able to manipulate the generated HTML with the file's name, extension, filename, and directory.

I have tried the following variations on the \fileinfo['{'option'}'] command:

  • @fileinfo['{'directory'}'] result: Generated from C:/dev/hello-world/doc/mainpage.txt ['{'directory'}']
  • @fileinfo['{directory}'] result: Generated from C:/dev/hello-world/doc/mainpage.txt ['{directory}']
  • @fileinfo[{directory}] result: Generated from C:/dev/hello-world/doc/mainpage.txt [{directory}]
  • @fileinfo[directory] result: Generated from C:/dev/hello-world/doc/mainpage.txt [directory]
  • @fileinfo[{'directory'}] result: Generated from C:/dev/hello-world/doc/mainpage.txt [{'directory'}]
  • @fileinfodirectory result: Generated from @fileinfodirectory

What is the magic combination of quotes, curly braces, and square brackets to make this work?

1

There are 1 best solutions below

6
StoneThrow On

The magic combination of quotes, curly braces, and square brackets is:

  1. No quotes at all.
  2. No square brackets at all.
  3. Curly braces around the enumerated option.

E.g.: @fileinfo{directory} result: Generated from C:/dev/hello-world/doc