Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

A DocGen service using Jinja2 templating and DocRaptor PDF generation.

Notifications You must be signed in to change notification settings

Porchpass/doc-service-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DocRaptor Sandbox

A DocGen service using Jinja2 templating and DocRaptor PDF generation.

Usage

from src.doc_service import run_doc_service # TODO: how to make this import cleaner?

result = run_doc_service({
  "slug": str,
  "use_docraptor": bool,
  "test_mode": bool,
  "variables": dict,
})

# Returns:
# {
#   "success": bool,
#   "html": str,
#   "pdf_bytes": bytes | None
# }  

Dev Setup

Install Virtualenv and set up an environment:

virtualenv .venv

Make sure to activate it (Mac / Linux):

source .venv/bin/activate

Add ENV vars.

Create the file cp .env.sample .env and enter the values.

Install packages

pip3 install -r requirements.txt

Testing

Run pytest from the root of the project.

Previewing HTML

You can serve the html output locally by running python3 -m http.server -d ./tests/out and navigating to the file in in the browser.

NOTE: When looking at the HTML, the footer will be the first element you see, above the rest of the content. DocRaptor requires the repeated headers and footers to be output first in the markup. See https://docraptor.com/documentation/article/1067094-headers-footers for more info. 👈 We are now using multiple header/footer partials per doc instead of DocRaptor's header/footer functionality.

Helpful links

About

A DocGen service using Jinja2 templating and DocRaptor PDF generation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published