Skip to content

Commit

Permalink
Merge pull request #36 from GSA-TTS/remove-pandoc
Browse files Browse the repository at this point in the history
Remove pandoc
  • Loading branch information
rahearn authored Sep 11, 2024
2 parents 09429c6 + cdfd99e commit 9e3ccd1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN adduser \
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
# Leverage a bind mount to requirements.txt to avoid having to copy them into
# into this layer.
RUN apt-get update && apt-get install -y git pandoc && apt-get clean
RUN apt-get update && apt-get install -y git && apt-get clean
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
python -m pip install -r requirements.txt
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,20 @@ Edit the files within `ssp-markdown` to populate data for the rendered SSP that

### Render SSP

Output the SSP as a markdown file and html file, both within `ssp-render`
Output the SSP as a markdown file within `./ssp-render`

`render-ssp`

You can optionally use pandoc to transform the markdown file into a variety of formats. For example:

#### PDF

`docker run --rm --volume "/dir/with/rendered_ssp.md:/data" pandoc/latex rendered_ssp.md -o your-pdf-file-name.pdf`

#### HTML

`docker run --rm --volume "/dir/with/rendered_ssp.md:/data" pandoc/latex rendered_ssp.md -s -o your-html-file-name.html --metadata title="SSP Title"`

### Import profile into working space:

If you are using a `PROFILE_NAME` that does not ship with this docker container then you must first manually import it using:
Expand Down
47 changes: 6 additions & 41 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Docker Compose reference guide at
# https://docs.docker.com/go/compose-spec-reference/

# Here the instructions define your application as a service called "cli".
# This service is built from the Dockerfile in the current directory.
# You can add other services your application may depend on here, such as a
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose
services:
cli:
build:
Expand All @@ -15,35 +6,9 @@ services:
- ./working_dir:/app/docs
- ./templates:/app/templates

# The commented out section below is an example of how to define a PostgreSQL
# database that your application can use. `depends_on` tells Docker Compose to
# start the database before your application. The `db-data` volume persists the
# database data between container restarts. The `db-password` secret is used
# to set the database password. You must create `db/password.txt` and add
# a password of your choosing to it before running `docker compose up`.
# depends_on:
# db:
# condition: service_healthy
# db:
# image: postgres
# restart: always
# user: postgres
# secrets:
# - db-password
# volumes:
# - db-data:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=example
# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
# expose:
# - 5432
# healthcheck:
# test: [ "CMD", "pg_isready" ]
# interval: 10s
# timeout: 5s
# retries: 5
# volumes:
# db-data:
# secrets:
# db-password:
# file: db/password.txt
# a helper pandoc just to easily properly set the volume for local testing.
# use with `docker compose run --rm pandoc <insert pandoc args here>`
pandoc:
image: pandoc/latex
volumes:
- ./working_dir/ssp-render:/data
2 changes: 0 additions & 2 deletions scripts/render-ssp
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,3 @@ echo "Validating ssp before attempting to render"
validate-ssp-json -n "$system_name"

trestle author jinja -i "$template" -ssp "$system_name" -p "$profile" -o "$output" -lut ssp-markdown/ssp_data.yaml -elp gsa -bf "[.]" -vap "$system_name Assigned:" -vnap "Assignment:"

pandoc "$output" --from markdown -t html -s -o "$output.html" --metadata title="${system_name} SSP"
11 changes: 7 additions & 4 deletions templates/ssp-rendering/lato/templates/section_7.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{% macro system_status(state_value, display_text) -%}
{{"**" if ssp.system_characteristics.status.state.value == state_value}}{{display_text}}{{"**" if ssp.system_characteristics.status.state.value == state_value}}
{%- endmacro %}
# 7 Information System Operational Status

The system is currently in the life-cycle phase noted in the following table.
Expand All @@ -6,7 +9,7 @@ Table 7-1. System Operational Status

| System Operational Status | Status Description |
| ------------------------- | ------------------ |
| {{"☒" if ssp.system_characteristics.status.state.value == "operational" else "☐"}} Operational | The system is operating and in production |
| {{"☒" if ssp.system_characteristics.status.state.value == "under-development" else "☐"}} Under Development | The system is being designed, developed, or implemented. |
| {{"☒" if ssp.system_characteristics.status.state.value == "under-major-modification" else "☐"}} Major Modification | The system is undergoing a major change, development, or transition. |
| {{"☒" if ssp.system_characteristics.status.state.value == "other" else "☐"}} Other | Explain: {{ "Edit the section_7.md template to explain the status" if ssp.system_characteristics.status.state.value == "other" else "" }} |
| {{ system_status('operational', 'Operational') }} | {{ system_status('operational', 'The system is operating and in production') }} |
| {{ system_status('under-development', 'Under Development') }} | {{ system_status('under-development', 'The system is being designed, developed, or implemented.') }} |
| {{ system_status('under-major-modification', 'Major Modification') }} | {{ system_status('under-development', 'The system is undergoing a major change, development, or transition.') }} |
| {{ system_status('other', 'Other') }} | Explain: {{ "Edit the section_7.md template to explain the status" if ssp.system_characteristics.status.state.value == "other" else "" }} |

0 comments on commit 9e3ccd1

Please sign in to comment.