简体   繁体   English

Doxygen打印bash文件内容

[英]Doxygen print bash file contents

I have a project with bash, python, and C files where I would like to simply print the contents of the bash file in the doxygen documentation. I have a project with bash, python, and C files where I would like to simply print the contents of the bash file in the doxygen documentation.

I am using Doxygen 1.9.4 and my Doxyfile has the following modified settings:我正在使用 Doxygen 1.9.4,我的 Doxyfile 具有以下修改设置:

JAVADOC_AUTOBRIEF      = YES
PYTHON_DOCSTRING       = NO
OPTIMIZE_OUTPUT_JAVA   = YES
EXTENSION_MAPPING      = sh=C
EXTRACT_ALL            = YES
SORT_BRIEF_DOCS        = YES
INPUT                  = .
FILTER_PATTERNS        =  *.sh="sh_filter"
FILE_PATTERNS          += *.sh

The sh_filter file has the following contents sh_filter文件有以下内容

#!/bin/bash

echo "\verbatim"
echo "$(cat $1)"
echo "\endverbatim"

After running doxygen, there is nothing that appears in the file reference for the bash file that is within the working directory.运行 doxygen 后,工作目录中的 bash 文件的文件参考中没有任何内容。

How can I get the file contents to be printed verbatim?如何获取要逐字打印的文件内容?

A bit long for a comment.有点长的评论。 The construction as requested is quite unusual as normally the purpose is to document routines / variables / classes / namespaces etc and support this with code.所要求的构造非常不寻常,因为通常目的是记录例程/变量/类/命名空间等并用代码支持这一点。 In this case the requirement is to just show the contents of the file.在这种情况下,要求只是显示文件的内容。 The bests solution I found is to create the filter like:我发现的最佳解决方案是创建过滤器,例如:

#!/bin/bash

echo "/** \file"
echo "\details \verbinclude $1 */"
echo "$(cat $1)"

and have the following added to the doxygen settings file:并将以下内容添加到 doxygen 设置文件中:

EXTENSION_MAPPING      = sh=C
INPUT                  = .
FILTER_PATTERNS        =  *.sh="./sh_filter"
FILE_PATTERNS += *.sh
EXAMPLE_PATH = .

(where the different paths are depending on the local situation) (不同路径视当地情况而定)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM