Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux
Commits
84ac0dcc
Commit
84ac0dcc
authored
2 years ago
by
Dennis Gläser
Browse files
Options
Downloads
Patches
Plain Diff
[doxygen][md-filter] hardcode main readme modification
parent
a7d6402c
No related branches found
No related tags found
1 merge request
!3453
Feature/doxygen markdown main readme
Pipeline
#29237
passed
2 years ago
Stage: check-status
Stage: trigger dumux pipelines
+3
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/doxygen/Doxylocal
+1
-2
1 addition, 2 deletions
doc/doxygen/Doxylocal
doc/doxygen/markdown-filter.py
+32
-29
32 additions, 29 deletions
doc/doxygen/markdown-filter.py
with
33 additions
and
31 deletions
doc/doxygen/Doxylocal
+
1
−
2
View file @
84ac0dcc
...
@@ -18,8 +18,7 @@ TOC_INCLUDE_HEADINGS = 4
...
@@ -18,8 +18,7 @@ TOC_INCLUDE_HEADINGS = 4
# Input filters run over content before it is parsed by Doxygen.
# Input filters run over content before it is parsed by Doxygen.
# - Format markdown math for Doxygen. See the documentation in
# - Format markdown math for Doxygen. See the documentation in
# `markdown-math-filter.pl` for details.
# `markdown-math-filter.pl` for details.
FILTER_PATTERNS = *README.md="python3 @srcdir@/markdown-filter.py -p Introduction -f" \
FILTER_PATTERNS = *.md="python3 @srcdir@/markdown-filter.py"
*.md="python3 @srcdir@/markdown-filter.py -f"
FILE_PATTERNS = *.md,*.cc,*.hh
FILE_PATTERNS = *.md,*.cc,*.hh
...
...
This diff is collapsed.
Click to expand it.
doc/doxygen/markdown-filter.py
+
32
−
29
View file @
84ac0dcc
#!/usr/bin/python3
#!/usr/bin/python3
import
sys
import
string
import
string
import
argparse
import
subprocess
import
subprocess
from
os.path
import
join
,
dirname
,
abspath
from
os.path
import
join
,
dirname
,
abspath
,
exists
THIS_DIR
=
dirname
(
__file__
)
DOC_DIR
=
dirname
(
THIS_DIR
)
TOP_LEVEL_DIR
=
dirname
(
DOC_DIR
)
MAIN_README
=
abspath
(
join
(
TOP_LEVEL_DIR
,
"
README.md
"
))
assert
exists
(
MAIN_README
)
def
_filter_characters
(
text
:
str
)
->
str
:
def
_filter_characters
(
text
:
str
)
->
str
:
...
@@ -23,30 +30,26 @@ def _invoke_and_retrieve_output(cmd) -> str:
...
@@ -23,30 +30,26 @@ def _invoke_and_retrieve_output(cmd) -> str:
return
subprocess
.
check_output
(
cmd
,
text
=
True
)
return
subprocess
.
check_output
(
cmd
,
text
=
True
)
if
__name__
==
"
__main__
"
:
def
_is_main_readme_file
(
path
)
->
bool
:
parser
=
argparse
.
ArgumentParser
(
description
=
"
Process markdown files to be consumed by Doxygen
"
)
return
path
==
MAIN_README
parser
.
add_argument
(
"
-f
"
,
"
--file
"
,
required
=
True
,
help
=
"
The markdown file to be processed
"
)
parser
.
add_argument
(
"
-p
"
,
assert
len
(
sys
.
argv
[
1
])
>
1
"
--prepend-header
"
,
filePath
=
abspath
(
sys
.
argv
[
1
])
required
=
False
,
help
=
"
Adds the given header at the top of the file
"
# Invoke math filter to translate GitLab flavoured math to such supported by Doxygen
)
math_conversion_script
=
join
(
dirname
(
abspath
(
__file__
)),
"
markdown-math-filter.pl
"
)
args
=
vars
(
parser
.
parse_args
())
result
=
_invoke_and_retrieve_output
([
"
perl
"
,
"
-0777
"
,
"
-p
"
,
math_conversion_script
,
filePath
])
# Invoke math filter to translate GitLab flavoured math to such supported by Doxygen
# for the main readme, prepend "Introduction" header
math_conversion_script
=
join
(
dirname
(
abspath
(
__file__
)),
"
markdown-math-filter.pl
"
)
if
_is_main_readme_file
(
filePath
):
result
=
_invoke_and_retrieve_output
([
"
perl
"
,
"
-0777
"
,
"
-p
"
,
math_conversion_script
,
args
[
"
file
"
]])
result
=
f
"
# Introduction
\n\n
{
result
}
"
# (maybe) prepend the given header
# Give all headers anchors (labels) s.t. doxygen cross-linking works
if
args
[
"
prepend_header
"
]:
# correctly (may be fixed in the most recent Doxygen version)
result
=
f
"
#
{
args
[
'
prepend_header
'
]
}
\n\n
{
result
}
"
result_lines
=
[]
for
line
in
result
.
split
(
"
\n
"
):
# Give all headers anchors (labels) s.t. doxygen cross-linking works
result_lines
.
append
(
_add_header_label
(
line
))
# correctly (may be fixed in the most recent Doxygen version)
result_lines
=
[]
# Print the final result for Doxygen to pick it up
for
line
in
result
.
split
(
"
\n
"
):
print
(
"
\n
"
.
join
(
result_lines
))
result_lines
.
append
(
_add_header_label
(
line
))
# Print the final result for Doxygen to pick it up
print
(
"
\n
"
.
join
(
result_lines
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment