Loading .gitlab-ci.yml +15 −1 Original line number Diff line number Diff line Loading @@ -8,12 +8,26 @@ workflow: rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_TAG - if: $CI_PIPELINE_SOURCE == "push" variables: stages: - generation - publication - build Build pythonForPandocFilter docker image: stage: build before_script: cd pandocFilter script: docker build --tag pandocFilter:latest -f dockerfile . rules: - if: $CI_PIPELINE_SOURCE == "push" changes: - pandocFilter/dockerfile - pandocFilter/setup.py - pandocFilter/requirements.txt Word CR text: stage: generation Loading Loading @@ -44,7 +58,7 @@ Publish spec: - tags before_script: - | curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/publish_spec%2Esh/raw?ref=publication" >> publish_spec.sh curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/publish_spec%2Esh/raw?ref=master" >> publish_spec.sh - chmod +x publish_spec.sh #- | # curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/onem2m_spec_template%2Edocx/raw?ref=master" >> onem2m_coversheet_template.docx Loading pandocFilter/dockerfile 0 → 100644 +7 −0 Original line number Diff line number Diff line FROM python:3.9-slim-bullseye ADD . /pandocFilter/ RUN apt-get update -y && \ rm -rf /var/lib/apt/lists/* &&\ pip install -e pandocFilter/ &&\ pip install -r pandocFilter/requirements.txt pandocFilter/pandocFilter.py +6 −5 Original line number Diff line number Diff line Loading @@ -86,8 +86,8 @@ def replaceTableCaptions(progress:Progress, mdLines:list[str]) -> list[str]: _idx = len(_lines) - 1 while _idx >= 0 and _lines[_idx].startswith('|'): _idx -= 1 if _idx > 0: _lines.insert(_idx+1, f'Table: {matches[0]}\n') #if _idx > 0: # _lines.insert(_idx+1, f'Table: {matches[0]}\n') _lines.insert(_idx+1, f'Table: {matches[0]}\n') else: _lines.append(line) Loading @@ -104,9 +104,7 @@ def process(document:str, outDirectory:str) -> None: mdLines = replaceTableCaptions(progress, mdLines) writeMDFile(progress, mdLines, document, outDirectory) if __name__ == '__main__': def main(args=None): # Parse command line arguments parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--outdir', '-o', action='store', dest='outDirectory', default = 'out', metavar = '<output directory>', help = 'specify output directory') Loading @@ -117,3 +115,6 @@ if __name__ == '__main__': os.makedirs(args.outDirectory, exist_ok = True) process(args.document, args.outDirectory) if __name__ == '__main__': sys.exit(main()) No newline at end of file pandocFilter/setup.py +5 −1 Original line number Diff line number Diff line Loading @@ -9,5 +9,9 @@ setup( packages=find_packages(), install_requires=[ 'rich', ] ], entry_points= { 'console_scripts' : ['pandocFilter=pandocFilter:main'] } ) Loading
.gitlab-ci.yml +15 −1 Original line number Diff line number Diff line Loading @@ -8,12 +8,26 @@ workflow: rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_TAG - if: $CI_PIPELINE_SOURCE == "push" variables: stages: - generation - publication - build Build pythonForPandocFilter docker image: stage: build before_script: cd pandocFilter script: docker build --tag pandocFilter:latest -f dockerfile . rules: - if: $CI_PIPELINE_SOURCE == "push" changes: - pandocFilter/dockerfile - pandocFilter/setup.py - pandocFilter/requirements.txt Word CR text: stage: generation Loading Loading @@ -44,7 +58,7 @@ Publish spec: - tags before_script: - | curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/publish_spec%2Esh/raw?ref=publication" >> publish_spec.sh curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/publish_spec%2Esh/raw?ref=master" >> publish_spec.sh - chmod +x publish_spec.sh #- | # curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/onem2m_spec_template%2Edocx/raw?ref=master" >> onem2m_coversheet_template.docx Loading
pandocFilter/dockerfile 0 → 100644 +7 −0 Original line number Diff line number Diff line FROM python:3.9-slim-bullseye ADD . /pandocFilter/ RUN apt-get update -y && \ rm -rf /var/lib/apt/lists/* &&\ pip install -e pandocFilter/ &&\ pip install -r pandocFilter/requirements.txt
pandocFilter/pandocFilter.py +6 −5 Original line number Diff line number Diff line Loading @@ -86,8 +86,8 @@ def replaceTableCaptions(progress:Progress, mdLines:list[str]) -> list[str]: _idx = len(_lines) - 1 while _idx >= 0 and _lines[_idx].startswith('|'): _idx -= 1 if _idx > 0: _lines.insert(_idx+1, f'Table: {matches[0]}\n') #if _idx > 0: # _lines.insert(_idx+1, f'Table: {matches[0]}\n') _lines.insert(_idx+1, f'Table: {matches[0]}\n') else: _lines.append(line) Loading @@ -104,9 +104,7 @@ def process(document:str, outDirectory:str) -> None: mdLines = replaceTableCaptions(progress, mdLines) writeMDFile(progress, mdLines, document, outDirectory) if __name__ == '__main__': def main(args=None): # Parse command line arguments parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--outdir', '-o', action='store', dest='outDirectory', default = 'out', metavar = '<output directory>', help = 'specify output directory') Loading @@ -117,3 +115,6 @@ if __name__ == '__main__': os.makedirs(args.outDirectory, exist_ok = True) process(args.document, args.outDirectory) if __name__ == '__main__': sys.exit(main()) No newline at end of file
pandocFilter/setup.py +5 −1 Original line number Diff line number Diff line Loading @@ -9,5 +9,9 @@ setup( packages=find_packages(), install_requires=[ 'rich', ] ], entry_points= { 'console_scripts' : ['pandocFilter=pandocFilter:main'] } )