Commit bc2a53c4 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Handle frontmatter if generated, do nothing otherwise (assuming md contains the whole document)

parent 0ac786ac
Loading
Loading
Loading
Loading
+21 −18
Original line number Diff line number Diff line
@@ -61,12 +61,12 @@ for i in *.md ; do
    if [ $i != 'README.md' ]; then
    	if [[ $i =~ (GS|GR).*\.md ]] ; then
        	echo "\n------ Processing MD file to combine all clauses (::include) -------"
            docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) -w "/tmp" "$MARKDOWN_TOOLS_DOCKER_IMAGE" processMDSpec -fmo "$i" > frontmatter.md
            docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) -w "/tmp" "$MARKDOWN_TOOLS_DOCKER_IMAGE" processMDSpec -fmo "$i" -fmf frontmatter.md
            docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) -w "/tmp" "$MARKDOWN_TOOLS_DOCKER_IMAGE" processMDSpec "$i" > combined.md
            cat combined.md > $i
			echo "\n------ Adding TOC to spec --------"
	      	docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$GENERATE_BASELINE_DOCKER_IMAGE" generateTOC --add-content "/tmp/$i"
	  	fi

            echo "\n------ Preparaing spec --------"
	        docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$GENERATE_BASELINE_DOCKER_IMAGE" pandocFilter -o "/tmp/" "/tmp/$i"
	        echo "\n------ Publishing spec --------"
@@ -74,7 +74,9 @@ for i in *.md ; do
	        # Word output
	        docker run --rm -v $(pwd):/data -u $(id -u):$(id -g) -w "/data" "$PANDOC_DOCKER_IMAGE" "/data/$i" -F mermaid-filter -f markdown+escaped_line_breaks -t docx --reference-doc "/data/${3}" -o "baseline/${4}_${2}.docx"
	        #echo 'docker run --rm -v $(pwd):/data -u $(id -u):$(id -g) "$DOCKER_IMAGE" "/data/$i" -F mermaid-filter -f markdown+escaped_line_breaks -t pdf -o "${4}_${2}.pdf"'
            if [ -f "frontmatter.md" ] && [ "$(cat frontmatter.md | tr -d ' \n\t')" != "{}" ]; then
	            docker container run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) -w "/tmp" "$FORGELIB_DOCKER_IMAGE" forgelib-baseline $5 frontmatter.md "baseline/${4}_${2}.docx"
	        fi
		    #if [ "$6" != "onlyDocx" ]; then
			    #Do not convert to PDF or EPUB until a solution is found to include the spec cover pages
			    # PDF Output
@@ -84,6 +86,7 @@ for i in *.md ; do
                #hip Project"
		    #fi
	    fi
	fi
done