adapt
This commit is contained in:
parent
47e535b9e6
commit
7ea505e27b
6 changed files with 27 additions and 6 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1 +1,3 @@
|
|||
.env
|
||||
.venv
|
||||
|
||||
|
|
|
|||
1
.python-version
Normal file
1
.python-version
Normal file
|
|
@ -0,0 +1 @@
|
|||
3.12.5
|
||||
BIN
__pycache__/octomode.cpython-312.pyc
Normal file
BIN
__pycache__/octomode.cpython-312.pyc
Normal file
Binary file not shown.
26
octomode.py
26
octomode.py
|
|
@ -118,12 +118,12 @@ def main(name):
|
|||
|
||||
@APP.route('/<name>/pad/')
|
||||
def pad(name):
|
||||
url = f"{ APP.config['PAD_URL'] }/{ name }.md"
|
||||
url = f"{ APP.config['PAD_URL'] }/p/{ name }.md"
|
||||
return render_template('iframe.html', url=url, name=name.strip(), pad_url=APP.config['PAD_URL'])
|
||||
|
||||
@APP.route('/<name>/stylesheet/')
|
||||
def stylesheet(name):
|
||||
url = f"{ APP.config['PAD_URL'] }/{ name }.css"
|
||||
url = f"{ APP.config['PAD_URL'] }/p/{ name }.css"
|
||||
return render_template('iframe.html', url=url, name=name.strip(), pad_url=APP.config['PAD_URL'])
|
||||
|
||||
@APP.route('/<name>/html/')
|
||||
|
|
@ -175,7 +175,16 @@ def preview(name):
|
|||
lang = "en"
|
||||
title = "No title"
|
||||
|
||||
return render_template('preview.html', name=name.strip(), pad_content=html, lang=lang, title=title)
|
||||
# only here we need application root to make all the URLs work.....
|
||||
if APP.config['APPLICATION_ROOT'] == '/':
|
||||
app_root = ''
|
||||
elif APP.config['APPLICATION_ROOT'].endswith('/'):
|
||||
app_root = APP.config['APPLICATION_ROOT'][:-1]
|
||||
else:
|
||||
app_root = APP.config['APPLICATION_ROOT']
|
||||
urn = f"{ app_root }/{ name }"
|
||||
|
||||
return render_template('preview.html', urn=urn, name=name.strip(), pad_content=html, lang=lang, title=title)
|
||||
|
||||
@APP.route('/<name>/pagedjs.html')
|
||||
def pagedjs(name):
|
||||
|
|
@ -186,7 +195,16 @@ def pagedjs(name):
|
|||
lang = metadata['language'][0]
|
||||
title = metadata['title'][0]
|
||||
|
||||
return render_template('pagedjs.html', name=name.strip(), pad_content=html, lang=lang, title=title)
|
||||
# only here we need application root to make all the URLs work.....
|
||||
if APP.config['APPLICATION_ROOT'] == '/':
|
||||
app_root = ''
|
||||
elif APP.config['APPLICATION_ROOT'].endswith('/'):
|
||||
app_root = APP.config['APPLICATION_ROOT'][:-1]
|
||||
else:
|
||||
app_root = APP.config['APPLICATION_ROOT']
|
||||
urn = f"{ app_root }/{ name }"
|
||||
|
||||
return render_template('pagedjs.html', urn=urn, name=name.strip(), pad_content=html, lang=lang, title=title)
|
||||
|
||||
# //////////////////
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="{{ url_for('static', filename='paged.polyfill.js') }}" type="text/javascript"></script>
|
||||
<link href="{{ url_for('static', filename='pagedjs.css') }}" rel="stylesheet" type="text/css" media="screen">
|
||||
<link href="/{{ name }}/stylesheet.css" rel="stylesheet" type="text/css" media="print">
|
||||
<link href="{{ urn }}/stylesheet.css" rel="stylesheet" type="text/css" media="print">
|
||||
<title>{{ title }}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="/{{ name }}/stylesheet.css" rel="stylesheet" type="text/css" media="screen">
|
||||
<link href="{{ urn }}/stylesheet.css" rel="stylesheet" type="text/css" media="screen">
|
||||
<title>{{ title }}</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Reference in a new issue