Skip to content
Snippets Groups Projects
Commit 0a03d844 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Adding the generation of TOC to the pipeline

parent 2ebbfb8f
No related branches found
No related tags found
No related merge requests found
Pipeline #655 passed
...@@ -27,6 +27,7 @@ Build pythonForPandocFilter docker image: ...@@ -27,6 +27,7 @@ Build pythonForPandocFilter docker image:
- generateChangemarks/pandocFilter.py - generateChangemarks/pandocFilter.py
- generateChangemarks/changemarks.py - generateChangemarks/changemarks.py
- generateChangemarks/addTrackedChanges.py - generateChangemarks/addTrackedChanges.py
- generateChangemarks/generateTOC.py
Upgrade index for pages: Upgrade index for pages:
stage: upgrade stage: upgrade
......
File moved
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
from __future__ import annotations from __future__ import annotations
from typing import Tuple from typing import Tuple
import argparse, os, re import argparse, os, re, sys
from rich import print from rich import print
...@@ -82,6 +82,7 @@ def processDocument(args:argparse.Namespace) -> None: ...@@ -82,6 +82,7 @@ def processDocument(args:argparse.Namespace) -> None:
for h in headers: for h in headers:
toc += ' ' * (h[1] * args.indent) + f'[{h[0]}](#{prepareTOClink(h[0])}) \n' toc += ' ' * (h[1] * args.indent) + f'[{h[0]}](#{prepareTOClink(h[0])}) \n'
toc = re.sub('<[^<]+?>', '', toc) toc = re.sub('<[^<]+?>', '', toc)
toc += '\n'
# Write the TOC to the console # Write the TOC to the console
print(toc) print(toc)
...@@ -117,7 +118,7 @@ def processDocument(args:argparse.Namespace) -> None: ...@@ -117,7 +118,7 @@ def processDocument(args:argparse.Namespace) -> None:
if __name__ == '__main__': def main(args=None):
def nonNegativeInt(value:str) -> int: def nonNegativeInt(value:str) -> int:
"""Check if a value is a non-negative integer. """Check if a value is a non-negative integer.
...@@ -150,3 +151,5 @@ if __name__ == '__main__': ...@@ -150,3 +151,5 @@ if __name__ == '__main__':
processDocument(args) processDocument(args)
if __name__ == '__main__':
sys.exit(main())
...@@ -15,6 +15,7 @@ setup( ...@@ -15,6 +15,7 @@ setup(
'console_scripts' : ['pandocFilter=pandocFilter:main', 'console_scripts' : ['pandocFilter=pandocFilter:main',
'changemarks=changemarks:main', 'changemarks=changemarks:main',
'addTrackedChanges=addTrackedChanges:main', 'addTrackedChanges=addTrackedChanges:main',
'generateTOC=generateTOC:main',
] ]
} }
......
...@@ -28,6 +28,8 @@ if [ ! $specs ] ; then ...@@ -28,6 +28,8 @@ if [ ! $specs ] ; then
fi fi
for i in *.md ; do for i in *.md ; do
echo "\n------ Adding TOC to spec --------"
docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$TOOLS_DOCKER_IMAGE" generateTOC --add-content "/tmp/$i"
echo "\n------ Preparaing spec --------" echo "\n------ Preparaing spec --------"
docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$TOOLS_DOCKER_IMAGE" pandocFilter -o "/tmp/" "/tmp/$i" docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$TOOLS_DOCKER_IMAGE" pandocFilter -o "/tmp/" "/tmp/$i"
echo "\n------ Publishing spec --------" echo "\n------ Publishing spec --------"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment