### Convert DOCX to TEI Source: https://github.com/teic/teigarage/blob/dev/README.md This example demonstrates how to convert a DOCX file to a TEI XML file using the TEIGarage API. It utilizes a curl command to send the file for conversion. ```APIDOC ## POST /ege-webservice/Conversions/docx:application:vnd.openxmlformats-officedocument.wordprocessingml.document/TEI:text:xml/ ### Description Converts a DOCX file to a TEI XML file. ### Method POST ### Endpoint /ege-webservice/Conversions/docx:application:vnd.openxmlformats-officedocument.wordprocessingml.document/TEI:text:xml/ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **upload** (file) - Required - The DOCX file to be converted. ### Request Example ```bash curl -o output.xml -F upload=@input.docx https://teigarage.tei-c.org/ege-webservice/Conversions/docx%3Aapplication%3Avnd.openxmlformats-officedocument.wordprocessingml.document/TEI%3Atext%3Axml/ ``` ### Response #### Success Response (200) - The converted TEI XML content will be saved to the specified output file. #### Response Example (Output is saved to a file, no direct response body example provided in source) ``` -------------------------------- ### Mount Stylesheet and ODD Paths in Docker Source: https://github.com/teic/teigarage/blob/dev/README.md Example of using the --volume parameter to mount local stylesheet and ODD paths to the TEIGarage Docker container. This allows the container to access custom TEI stylesheets and ODD files. ```bash -v /your/path/to/Stylesheets:/usr/share/xml/tei/stylesheet \ -v /your/path/to/TEI/P5:/usr/share/xml/tei/odd ``` -------------------------------- ### Convert DOCX to TEI using curl Source: https://github.com/teic/teigarage/blob/dev/README.md Example of using curl to convert a DOCX file to a TEI XML file via the TEIGarage API. The output is saved to 'output.xml'. ```bash curl -o output.xml -F upload=@input.docx https://teigarage.tei-c.org/ege-webservice/Conversions/docx%3Aapplication%3Avnd.openxmlformats-officedocument.wordprocessingml.document/TEI%3Atext%3Axml/ ``` -------------------------------- ### Convert TEI to DOCX using Curl Source: https://github.com/teic/teigarage/blob/dev/README.md Example of using Curl to send a TEI XML file to the TEIGarage webservice for conversion to DOCX format. Ensure the webservice is running and accessible. ```bash curl -s -o test.docx -F upload=@test.xml http://localhost:8080/ege-webservice/Conversions/TEI%3Atext%3Axml/docx%3Aapplication%3Avnd.openxmlformats-officedocument.wordprocessingml.document ``` -------------------------------- ### Maven Settings XML for GitHub Packages Source: https://github.com/teic/teigarage/blob/dev/README.md This XML configuration is for your Maven settings.xml file. It enables access to GitHub Packages by defining repositories and server credentials. Replace YOURGITHUBUSERNAME and YOURGITHUBPAT with your actual GitHub username and Personal Access Token. ```xml github github central https://repo1.maven.org/maven2 githubtei https://maven.pkg.github.com/TEIC/* true githubtei YOURGITHUBUSERNAME YOURGITHUBPAT ``` -------------------------------- ### Build TEIGarage Docker with Specific Versions Source: https://github.com/teic/teigarage/blob/dev/README.md Build the Docker image locally while specifying versions for TEI stylesheets and ODD sources using build arguments. ```bash docker build \ --build-arg VERSION_STYLESHEET=7.52.0 \ --build-arg VERSION_ODD=4.3.0 \ . ``` -------------------------------- ### Run TEIGarage Docker with Local TEI Sources Source: https://github.com/teic/teigarage/blob/dev/README.md Mount local TEI stylesheet and source directories into the Docker container to use custom versions. Ensure the paths are correct for your system. ```bash docker run --rm \ -p 8080:8080 \ -e WEBSERVICE_URL=http://localhost:8080/ege-webservice/ \ -v /your/path/to/tei/stylesheet:/usr/share/xml/tei/stylesheet \ -v /your/path/to/tei/odd:/usr/share/xml/tei/odd \ --name teigarage ghcr.io/teic/teigarage ``` -------------------------------- ### Build Docker Image Locally Source: https://github.com/teic/teigarage/blob/dev/CONTRIBUTING.md Build a Docker image for your locally checked out branch. This command tags the image with a name that includes your branch name. ```sh docker build --tag teigarage:issue-33 . ``` -------------------------------- ### Build TEIGarage with Maven Source: https://github.com/teic/teigarage/blob/dev/README.md Command to build the TEIGarage Java project using Maven. This command packages the application, typically creating a WAR file. ```bash mvn -B package --file pom.xml ``` -------------------------------- ### Create a Git Branch Source: https://github.com/teic/teigarage/blob/dev/CONTRIBUTING.md Create a new Git branch for your work, using a descriptive name that references the issue number you are addressing. ```sh git checkout -b issue-33 ``` -------------------------------- ### Run Docker Container Locally Source: https://github.com/teic/teigarage/blob/dev/CONTRIBUTING.md Run a Docker container from the image you just built. This command maps port 8080 and runs the container in detached mode. ```sh docker run --name teigarage-issue-33 -p 8080:8080 -d teigarage:issue-33 ``` -------------------------------- ### Run TEIGarage Docker Container Source: https://github.com/teic/teigarage/blob/dev/README.md Command to run the TEIGarage Docker container, mapping port 8080 and setting the WEBSERVICE_URL environment variable. The container is named 'teigarage'. ```bash docker run --rm \ -p 8080:8080 \ -e WEBSERVICE_URL=http://localhost:8080/ege-webservice/ \ --name teigarage ghcr.io/teic/teigarage ``` -------------------------------- ### Pull TEIGarage Docker Image Source: https://github.com/teic/teigarage/blob/dev/README.md Command to pull the latest TEIGarage Docker image from the GitHub Container Registry. ```bash docker pull ghcr.io/teic/teigarage:latest ``` -------------------------------- ### OAuth2 Redirect Logic Source: https://github.com/teic/teigarage/blob/dev/src/main/webapp/oauth2-redirect.html This script handles the OAuth2 redirect process for Swagger UI. It extracts authorization codes or tokens from the URL, validates the state, and calls back to the opener window. It supports 'accessCode', 'authorizationCode', and 'authorization_code' flows. ```javascript 'use strict'; function run () { var oauth2 = window.opener.swaggerUIRedirectOauth2; var sentState = oauth2.state; var redirectUrl = oauth2.redirectUrl; var isValid, qp, arr; if (/code|token|error/.test(window.location.hash)) { qp = window.location.hash.substring(1); } else { qp = location.search.substring(1); } arr = qp.split("&"); arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"'; }); qp = qp ? JSON.parse('{' + arr.join() + '}', function (key, value) { return key === "" ? value : decodeURIComponent(value); } ) : {}; isValid = qp.state === sentState; if (( oauth2.auth.schema.get("flow") === "accessCode" || oauth2.auth.schema.get("flow") === "authorizationCode" || oauth2.auth.schema.get("flow") === "authorization_code" ) && !oauth2.auth.code) { if (!isValid) { oauth2.errCb({ authId: oauth2.auth.name, source: "auth", level: "warning", message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server." }); } if (qp.code) { delete oauth2.state; oauth2.auth.code = qp.code; oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl}); } else { let oauthErrorMsg; if (qp.error) { oauthErrorMsg = "["+qp.error+"]: " + (qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") + (qp.error_uri ? "More info: "+qp.error_uri : ""); } oauth2.errCb({ authId: oauth2.auth.name, source: "auth", level: "error", message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server." }); } } else { oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl}); } window.close(); } if (document.readyState !== 'loading') { run(); } else { document.addEventListener('DOMContentLoaded', function () { run(); }); } ``` -------------------------------- ### Update Feature Branch from Develop Source: https://github.com/teic/teigarage/blob/dev/CONTRIBUTING.md Update your feature branch by rebasing it onto the latest 'dev' branch. This ensures your changes are based on the most recent code. ```sh git remote add upstream git@github.com:teic/TEIGarage.git git checkout dev git pull upstream dev git checkout issue-33 git rebase dev git push --set-upstream origin issue-33 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.