Repositories' functionalities: HOCR editor - documenti-aperti/documenti_aperti GitHub Wiki
How is it made?
The HOCR editor is built using the HOCR-proofreader library and material design templates.
The HOCR-proofreader library allows a linked view of both the original image and the parallel HOCR text. The material design templates give the GUI a simple, smooth and user-friendly look.
The GUI features
Depending to screen size, the page will display some buttons at the top of the page to better adapt the views to the user's necessity. The top right buttons allow the user to import an HOCR file, to export and download the HOCR file and to save the changes on the repository.
Importing and exporting an HOCR file can be useful for working offline but especially for working with pull requests made by the users: if an user wants to contribute to a repository by correcting a bad HOCR file, he can do that by modifying the HOCR file in this editor, exporting it, uploading the exported file in a new pull request, that, if the owner approves it, is saved in the main repository. Import function can be useful for the owner for checking users' requested changes in pull requests that involves HOCR files.
How is it interfaced with Gitea's structure?
The HOCR editor is hosted by the NGINX server that gets HTML, CSS and JS files from a local folder, and these can be accessed only through the main website, because for working the editor the references to a HOCR file and to the relative images, and those references are available only from the main page of the repository; for that reason the link for the editor is only placed there. The editor is called through a GET request that has the following parameters:
repo_id
which references to the actual repository and it's used for doing requests to the documenti_aperti APIrepo_name
which is the name of the actual repository- Optional data (added if the user is signed in Gitea)
user_id
which references to the signed in user and it's used in doing requests to the documenti_aperti APIuser_name
which is the name of the signed in user