From c8451c07aa75f5ec56c92d9bbb559ee78f3e7760 Mon Sep 17 00:00:00 2001 From: Christian Aribaud Date: Sun, 4 Jun 2023 20:46:43 +0200 Subject: [PATCH] Adding info about ESLint in README.md --- README.md | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b8a99d2..c162532 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,19 @@ flowchart TB ``` Melpomene is mainly one JS file and one CSS file. You only need to include them in you web page. They are : - + `melpomene.js` - + `melpomene.css` + ++ `melpomene.js` + ++ `melpomene.css` The JS files expect you to write some very specific HTML tags to be able to work. To simplify things, you only need to copy-paste the content of `melpomene.html` into your own page and change a few things : + + You must duplicate the `img` tag for each of you comic page and : + set `url` to the actual URL of your page + set `height` and `width` to the actual image sizes + set `data-zooms` with the zooms information, like so : `, , , ; ...` - + example : `` + + example : `` Because doing this by hand would be very tedious, Melpomene comes with an helper script that allows generating that HTML for you from SVGs. @@ -45,7 +48,7 @@ The following limitations are known and will be improved upon : + Mobile support is currently limited + There are some performences issues -# How to setup Melpomene ? +# How to use Melpomene ? ## Defining the zooms @@ -55,21 +58,21 @@ To do so, you can use your favorite SVG editor. If you don't have one, [Inkscape To create the zooms for a comic page, what you need to do is : 1. Open your comic page in your editor (make sure to keep the image's original size when importing!) - * If your software ask, there is no need to actually import the image, you only need to link it. + * If your software ask, there is no need to actually import the image, you only need to link it. 2. Create a simple rectangle over each zoom you want, in the order you want them to show up - * You can set the rectangle's color to be translucent so you can still see the page underneath them! - * If you want to change the zoom order, you can change their order in the layer view of your SVG tool if they support it + * You can set the rectangle's color to be translucent so you can still see the page underneath them! + * If you want to change the zoom order, you can change their order in the layer view of your SVG tool if they support it 3. Once you are done, save the SGV - ## Generating the HTML files Once the SVG for your pages are done, put them in one folder. Then, you can run the zoom generator. You need to open a terminal and then run : + + `python zooms_generator.py html -p -e ` + For example, if your comic pages are hosted at `static/comic/page_x.jpg`, the svg must be named `page_x.svg` - and you must run `python zooms_generator.py html -p /static/comic/ -e jpg` + and you must run `python zooms_generator.py html -p /static/comic/ -e jpg` + It will generate the following `img` tag : `` The pages need to be in alphabetical order! It assumes the first page is page 1, the next one is page 2, etc.. @@ -89,6 +92,24 @@ If you need to do some global scaling / offset of all zooms in HTML (if for exam + If they become greater than the page size, they get clamped to the page size and width / height get reduced to compensate + `data-global-zoom-scale=""` : scale all positions / sizes by this factor +# Developpement + +## Setting up quality checking for JS + + Regarding JS, quality checking is done using [eslint](https://eslint.org/). + +The configuration file is `eslint/eslintrc.json`. + +To setup eslint, you can either install it on your system reading it's documentation, or use the provided Dockerfile to run it. This requires [docker](https://www.docker.com/). + +To do so, assuming you are using linux, after installing docker, you can run from this repository root: + ++ `docker build -t melpomene-eslint eslint/`, once + ++ `docker run -v .:/melpomene:rw -w /melpomene --user $(id -u):$(id -g) melpomene-eslint`, every time you want to run the analysis + +You can now open `eslint_report.html` to see the result. + # Credits -Most examples and the documentation of Melpomene uses illustrations from David "Deevad" Revoy's "Pepper & Carrot" webcomic, which is published under CC-BY 4.0. Full licence [here](https://www.peppercarrot.com/en/license/index.html). +Most examples and the documentation of Melpomene uses illustrations from David "Deevad" Revoy's "Pepper & Carrot" webcomic, which is published under CC-BY 4.0. Full licence [here](https://www.peppercarrot.com/en/license/index.html).