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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ Build pythonForPandocFilter docker image:
        - generateChangemarks/pandocFilter.py
        - generateChangemarks/changemarks.py
        - generateChangemarks/addTrackedChanges.py
        - generateChangemarks/generateTOC.py
        
Upgrade index for pages:
  stage: upgrade
+0 −0

File moved.

+6 −3
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@

from __future__ import annotations
from typing import Tuple
import argparse, os, re
import argparse, os, re, sys
from rich import print


@@ -82,6 +82,7 @@ def processDocument(args:argparse.Namespace) -> None:
	for h in headers:
		toc += ' ' * (h[1] * args.indent) + f'[{h[0]}](#{prepareTOClink(h[0])})  \n'
	toc = re.sub('<[^<]+?>', '', toc)
	toc += '\n'

	# Write the TOC to the console
	print(toc)
@@ -117,7 +118,7 @@ def processDocument(args:argparse.Namespace) -> None:
			


if __name__ == '__main__':
def main(args=None):

	def nonNegativeInt(value:str) -> int:
		"""Check if a value is a non-negative integer.
@@ -150,3 +151,5 @@ if __name__ == '__main__':

	processDocument(args)

if __name__ == '__main__':
	sys.exit(main())
+3 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ setup(
            'console_scripts' : ['pandocFilter=pandocFilter:main',
								'changemarks=changemarks:main',
								'addTrackedChanges=addTrackedChanges:main',
								'generateTOC=generateTOC:main',
			]
            }

+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ if [ ! $specs ] ; then
fi

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 --------" 
	docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$TOOLS_DOCKER_IMAGE" pandocFilter -o "/tmp/" "/tmp/$i"
	echo "\n------ Publishing spec --------"