Compare commits
7 Commits
b70f0200db
...
1b4b1b1e25
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b4b1b1e25 | |||
| f7cf62fbbe | |||
| 03877ae991 | |||
| 4313f2e7d7 | |||
| 7d2178c24a | |||
| f1f3597cf1 | |||
| e0b544da51 |
51
.gitea/workflows/deploy.yaml
Normal file
51
.gitea/workflows/deploy.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# GitHub recommends pinning actions to a commit SHA.
|
||||
# To get a newer version, you will need to update the SHA.
|
||||
# You can also reference a tag or branch, but the action may change without warning.
|
||||
|
||||
name: Publish Docker image
|
||||
on: push
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to Docker Hub
|
||||
runs-on: ubuntu-latest
|
||||
# permissions:
|
||||
# packages: write
|
||||
# contents: read
|
||||
# attestations: write
|
||||
# id-token: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: "check is REGISTRY_TOKEN exists"
|
||||
env:
|
||||
super_secret: ${{ secrets.REGISTRY_TOKEN }}
|
||||
if: ${{ env.super_secret == '' }}
|
||||
run: 'echo "echo the secret \"REGISTRY_TOKEN\" has not been made; echo please go to \"settings \> secrets \> actions\" to create it"'
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.letsstein.de
|
||||
username: jenkins
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
images: git.letsstein.de/tom/anki_convert
|
||||
|
||||
- name: Build and push Docker image
|
||||
id: push
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -50,10 +50,10 @@ def convert_text(text: str):
|
||||
|
||||
for line in seperate(text):
|
||||
# add anki field into line and count the number of changes
|
||||
line, num = re.subn("(:)(..+)", rf"\1 {{{{c{field_nr}::\2}}}}", line)
|
||||
line, num = re.subn("(:|\.)(..+)", rf"\1 {{{{c{field_nr}::\2}}}}", line)
|
||||
# if anki field added increase field number
|
||||
if num > 0:
|
||||
field_nr += 1
|
||||
# if num > 0:
|
||||
# field_nr += 1
|
||||
# add changed line to array
|
||||
changed_lines.append(line)
|
||||
|
||||
|
||||
@@ -1,32 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Anki Converter</title>
|
||||
<link rel="stylesheet" href='/static/style.css' />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div id="left">
|
||||
<h1>Upload File/Enter Text</h1>
|
||||
<form action="/upload" method="post" enctype="multipart/form-data">
|
||||
<label class="custom-file-upload">
|
||||
<input id="myfile" type="file" name="file" accept=".pdf"/>
|
||||
<span>Custom Upload</span>
|
||||
</label>
|
||||
<button type="submit">Upload</button>
|
||||
<br>
|
||||
<textarea name="text">{% if resp_text %}{{ base_text }}{% else %}Text in here{% endif %}</textarea>
|
||||
</form>
|
||||
</div>
|
||||
{% if resp_text %}
|
||||
<div id="right">
|
||||
<h1>Converted Text</h1>
|
||||
<button id="copy-btn">Copy Text</button>
|
||||
<pre id="myInput">{{ resp_text }}
|
||||
</pre>
|
||||
</div>
|
||||
{% endif %}
|
||||
</main>
|
||||
<script src="{{url_for('static', filename='script.js')}}"></script>
|
||||
</body>
|
||||
<head>
|
||||
<title>Anki Converter</title>
|
||||
<link rel="stylesheet" href="/static/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div id="left">
|
||||
<h1>Upload File/Enter Text</h1>
|
||||
<form action="/upload" method="post" enctype="multipart/form-data">
|
||||
<label class="custom-file-upload">
|
||||
<input id="myfile" type="file" name="file" accept=".pdf" />
|
||||
<span>Custom Upload</span>
|
||||
</label>
|
||||
<button type="submit">Convert</button>
|
||||
<br />
|
||||
<textarea name="text">{% if resp_text %}{{ base_text }}{% else %}Text in here{% endif %}</textarea>
|
||||
</form>
|
||||
</div>
|
||||
{% if resp_text %}
|
||||
<div id="right">
|
||||
<h1>Converted Text</h1>
|
||||
<button id="copy-btn">Copy Text</button>
|
||||
<pre id="myInput">
|
||||
{{ resp_text }}
|
||||
</pre
|
||||
>
|
||||
</div>
|
||||
{% endif %}
|
||||
</main>
|
||||
<script src="{{url_for('static', filename='script.js')}}"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user