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

Adding dockerfile for pandocfilter image

parent 11136957
No related branches found
No related tags found
No related merge requests found
...@@ -8,12 +8,26 @@ workflow: ...@@ -8,12 +8,26 @@ workflow:
rules: rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "push"
variables: variables:
stages: stages:
- generation - generation
- publication - 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: Word CR text:
stage: generation stage: generation
...@@ -44,7 +58,7 @@ Publish spec: ...@@ -44,7 +58,7 @@ Publish spec:
- tags - tags
before_script: 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 - 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 # curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/onem2m_spec_template%2Edocx/raw?ref=master" >> onem2m_coversheet_template.docx
......
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
...@@ -86,8 +86,8 @@ def replaceTableCaptions(progress:Progress, mdLines:list[str]) -> list[str]: ...@@ -86,8 +86,8 @@ def replaceTableCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
_idx = len(_lines) - 1 _idx = len(_lines) - 1
while _idx >= 0 and _lines[_idx].startswith('|'): while _idx >= 0 and _lines[_idx].startswith('|'):
_idx -= 1 _idx -= 1
if _idx > 0: #if _idx > 0:
_lines.insert(_idx+1, f'Table: {matches[0]}\n') # _lines.insert(_idx+1, f'Table: {matches[0]}\n')
_lines.insert(_idx+1, f'Table: {matches[0]}\n') _lines.insert(_idx+1, f'Table: {matches[0]}\n')
else: else:
_lines.append(line) _lines.append(line)
...@@ -104,9 +104,7 @@ def process(document:str, outDirectory:str) -> None: ...@@ -104,9 +104,7 @@ def process(document:str, outDirectory:str) -> None:
mdLines = replaceTableCaptions(progress, mdLines) mdLines = replaceTableCaptions(progress, mdLines)
writeMDFile(progress, mdLines, document, outDirectory) writeMDFile(progress, mdLines, document, outDirectory)
def main(args=None):
if __name__ == '__main__':
# Parse command line arguments # Parse command line arguments
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) 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') parser.add_argument('--outdir', '-o', action='store', dest='outDirectory', default = 'out', metavar = '<output directory>', help = 'specify output directory')
...@@ -117,3 +115,6 @@ if __name__ == '__main__': ...@@ -117,3 +115,6 @@ if __name__ == '__main__':
os.makedirs(args.outDirectory, exist_ok = True) os.makedirs(args.outDirectory, exist_ok = True)
process(args.document, args.outDirectory) process(args.document, args.outDirectory)
if __name__ == '__main__':
sys.exit(main())
\ No newline at end of file
...@@ -9,5 +9,9 @@ setup( ...@@ -9,5 +9,9 @@ setup(
packages=find_packages(), packages=find_packages(),
install_requires=[ install_requires=[
'rich', 'rich',
] ],
entry_points= {
'console_scripts' : ['pandocFilter=pandocFilter:main']
}
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment