Skip to content

Commit

Permalink
add pandoc flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloud User committed Nov 17, 2023
1 parent 5bc3d7e commit 091dd0b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Once JinjaFx Server has been started with the `-s` argument then point your web
jinjafx_server -s [-l <address>] [-p <port>]
[-r <directory> | -s3 <aws s3 url> | -github <owner>/<repo>[:<branch>]]
[-rl <rate/limit>] [-tl <time limit>] [-ml <memory limit>]
[-logfile <logfile>] [-weblog] [-pandoc] [-v]
-s - start the JinjaFx Server
-l <address> - specify a listen address (default is '127.0.0.1')
Expand All @@ -32,6 +33,7 @@ Once JinjaFx Server has been started with the `-s` argument then point your web
-ml <memory limit> - specify a global memory limit (megabytes < total)
-logfile <logfile> - specify a logfile for persistent logging
-weblog - enable web log interface (/logs)
-pandoc - enable support for DOCX using pandoc (requires pandoc)
-v - log all HTTP requests
Environment Variables:
Expand Down
2 changes: 1 addition & 1 deletion docker/jinjafx-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# GITHUB_URL=<owner>/<repo>[:<branch>]
# GITHUB_TOKEN="<github_token>"

ARGS="-rl 5/20s -logfile /var/log/jinjafx.log"
ARGS="-rl 5/20s -logfile /var/log/jinjafx.log -pandoc"

if [[ "$(id -u)" != "0" ]]; then
echo 'requires root'
Expand Down
15 changes: 11 additions & 4 deletions jinjafx_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@
import re, argparse, hashlib, traceback, glob, hmac, uuid, struct, binascii, gzip, requests, ctypes, subprocess
import cmarkgfm, emoji

from shutil import which
pandoc = which('pandoc')

__version__ = '23.11.0'
__version__ = '23.11.1'

llock = threading.RLock()
rlock = threading.RLock()
Expand All @@ -45,6 +42,7 @@
jfx_weblog_key = None
repository = None
verbose = False
pandoc = None

rtable = {}
rl_rate = 0
Expand Down Expand Up @@ -920,6 +918,7 @@ def main(rflag=[0]):
global timelimit
global logfile
global verbose
global pandoc

try:
print('JinjaFx Server v' + __version__ + ' - Jinja2 Templating Tool')
Expand All @@ -940,10 +939,18 @@ def main(rflag=[0]):
parser.add_argument('-ml', metavar='<memory limit>', type=int, default=0)
parser.add_argument('-logfile', metavar='<logfile>', type=str)
parser.add_argument('-weblog', action='store_true', default=False)
parser.add_argument('-pandoc', action='store_true', default=False)
parser.add_argument('-v', action='store_true', default=False)
args = parser.parse_args()
verbose = args.v

if args.pandoc:
from shutil import which
pandoc = which('pandoc')

if not pandoc:
parser.error("argument -pandoc: unable to find pandoc within the path")

if args.weblog:
jfx_weblog_key = os.getenv('JFX_WEBLOG_KEY')

Expand Down

0 comments on commit 091dd0b

Please sign in to comment.