Merge commit '2953f98805434534094068a52bf983b71282cf5c' into wip
authorNiki Roo <niki@nikiroo.be>
Wed, 28 Mar 2018 13:21:37 +0000 (15:21 +0200)
committerNiki Roo <niki@nikiroo.be>
Wed, 28 Mar 2018 13:21:37 +0000 (15:21 +0200)
Makefile.base
README-fr.md
README.md

index 651b10c1fbfaea632874bb80fb1801465857e734..ba407111c6307d6384ad5e800d6d95083670af6b 100644 (file)
@@ -5,6 +5,7 @@
 # - 1.1.0: add 'help', 'sjar'
 # - 1.2.0: add 'apk'
 # - 1.2.1: improve 'apk' and add 'android'
+# - 1.3.0: add 'man' for man(ual) pages
 
 # Required parameters (the commented out ones are supposed to be per project):
 
@@ -29,12 +30,12 @@ JAR = jar
 RJAR = java
 RJAR_FLAGS += -jar
 
-all: build jar
+all: build jar man
 
 help:
        @echo "Usual options:"
        @echo "=============="
-       @echo " make            : to build the jar file"
+       @echo " make            : to build the jar file and man pages IF possible"
        @echo " make help       : to get this help screen"
        @echo " make libs       : to update the libraries into src/"
        @echo " make build      : to update the binaries (not the jar)"
@@ -49,8 +50,10 @@ help:
        @echo " make install    : to install the application into $$PREFIX"
        @echo " make android    : to prepare the sources in android/ for Studio"
        @echo " make apk        : to compile the APK file"
+       @echo " make ifman      : to make the manual pages (if pandoc is found)"
+       @echo " make man        : to make the manual pages (requires pandoc)"
 
-.PHONY: all clean mrproper mrpropre build run jrun jar sjar resources test-resources install libs love apk android
+.PHONY: all clean mrproper mrpropre build run jrun jar sjar resources test-resources install libs love apk android ifman man
 
 bin:
        @mkdir -p bin
@@ -238,3 +241,48 @@ ${NAME}-debug.apk: android
                ); \
        )
 
+ifman:
+       @if pandoc -v >/dev/null 2>&1; then \
+               make man; \
+       else \
+               echo "man pages not generated: "'`'"pandoc' required"; \
+       fi
+
+man: 
+       @echo Checking for possible manual pages...
+       @if [ -e README.md ]; then \
+               echo Sources found for man pages; \
+               if pandoc -v >/dev/null 2>&1; then \
+                       ls README*.md 2>/dev/null \
+                                       | grep 'README\(-..\|\)\.md' \
+                                       | while read man; do \
+                               echo "  Processing page $$lang..."; \
+                               lang="`echo "$$man" \
+                                       | sed 's:README\.md:en:' \
+                                       | sed 's:README-\(.*\)\.md:\1:'`"; \
+                               mkdir -p man/"$$lang"/man1; \
+                               ( \
+                                       echo ".TH \"${NAME}\" 1 `\
+                                               date +%Y-%m-%d\
+                                               ` \"version `cat VERSION`\""; \
+                                       echo; \
+                                       UNAME="`echo "${NAME}" \
+                                               | sed 's:\(.*\):\U\1:g'`"; \
+                                       ( \
+                                               cat "$$man" | head -n1 \
+       | sed 's:.*(README\(-fr\|\)\.md).*::g'; \
+                                               cat "$$man" | tail -n+2; \
+                                       ) | sed 's:^#\(#.*\):\1:g' \
+       | sed 's:^\(#.*\):\U\1:g;s:# *'"$$UNAME"':# NAME\n'"${NAME}"' \\- :g' \
+       | sed 's:--:——:g' \
+       | pandoc -f markdown -t man | sed 's:——:--:g' ; \
+                               ) > man/"$$lang"/man1/"${NAME}.1"; \
+                       done; \
+                       mkdir -p "man/man1"; \
+                       cp man/en/man1/"${NAME}".1 man/man1/; \
+               else \
+                       echo "man pages generation: pandoc required" >&2; \
+                       false; \
+               fi; \
+       fi;
+
index 59837e452faf6b3f37dcb29397a8a1dd69e89659..01d6c7e249c3d155f7444f58fdce398124f5266d 100644 (file)
@@ -1,9 +1,24 @@
 [English](README.md) Français
 
 # Fanfix
-
 Fanfix est un petit programme Java qui peut télécharger des histoires sur internet et les afficher hors ligne.
 
+## Synopsis
+
+- ```fanfix``` --import [*URL*]
+- ```fanfix``` --export [*id*] [*output_type*] [*target*]
+- ```fanfix``` --convert [*URL*] [*output_type*] [*target*] (+info)
+- ```fanfix``` --read [*id*] ([*chapter number*])
+- ```fanfix``` --read-url [*URL*] ([*chapter number*])
+- ```fanfix``` --list
+- ```fanfix``` --set-reader [*reader type*]
+- ```fanfix``` --server [*key*] [*port*]
+- ```fanfix``` --stop-server [*key*] [*port*]
+- ```fanfix``` --remote [*key*] [*host*] [*port*]
+- ```fanfix``` --help
+
+## Description
+
 (Si vous voulez juste voir les derniers changements, vous pouvez regarder le [Changelog](changelog-fr.md) -- remarquez que le programme affiche le changelog si une version plus récente est détectée depuis la version 1.4.0.)
 
 (Il y a aussi une [TODO list](TODO.md) sur le site parlant du futur du programme.)
@@ -15,14 +30,16 @@ TODO: screenshots TUI + Android (+ FR quand traduit)
 Le fonctionnement du programme est assez simple : il converti une URL venant d'un site supporté en un fichier .epub pour les histoires ou .cbz pour les comics (d'autres options d'enregistrement sont disponibles, comme du texte simple, du HTML...)
 
 Pour vous aider à organiser vos histoires, il peut aussi servir de bibliothèque locale vous permettant :
+
 - d'importer une histoire depuis son URL (ou depuis un fichier)
 - d'exporter une histoire dans un des formats supportés vers un fichier
 - d'afficher une histoire en mode texte
 - d'afficher une histoire en mode GUI **en appelant un programme natif pour lire le fichier** (mais Fanfix peut convertir le fichier en HTML avant, pour que n'importe quel navigateur web puisse l'afficher)
 
-## Sites supportés
+### Sites supportés
 
 Pour le moment, les sites suivants sont supportés :
+
 - http://FimFiction.net/ : fanfictions dévouées à la série My Little Pony
 - http://Fanfiction.net/ : fanfictions venant d'une multitude d'univers différents, depuis les shows télévisés aux livres en passant par les jeux-vidéos
 - http://mangafox.me/ : un site répertoriant une quantité non négligeable de mangas
@@ -30,21 +47,22 @@ Pour le moment, les sites suivants sont supportés :
 - https://sofurry.com/ : même chose, mais orienté sur les histoires plutôt que les images
 - https://e-hentai.org/ : support ajouté sur demande : n'hésitez pas à demander un site !
 
-## À propos des types de fichiers supportés
+### Types de fichiers supportés
 
 Nous supportons les types de fichiers suivants (aussi bien en entrée qu'en sortie) :
+
 - epub : les fichiers .epub créés avec Fanfix (nous ne supportons pas les autres fichiers .epub, du moins pour le moment)
 - text : les histoires enregistrées en texte (.txt), avec quelques règles spécifiques :
-  - le titre doit être sur la première ligne
-  - l'auteur (précédé de rien, ```Par ```, ```De ``` ou ```©```) doit être sur la deuxième ligne, optionnellement suivi de la date de publication entre parenthèses (i.e., ```Par Quelqu'un (3 octobre 1998)```)
-  - les chapitres doivent être déclarés avec ```Chapitre x``` ou ```Chapitre x: NOM DU CHAPTITRE```, où ```x``` est le numéro du chapitre
-  - une description de l'histoire doit être donnée en tant que chaptire 0
-  - une image de couverture peut être présente avec le même nom de fichier que l'histoire, mais une extension .png, .jpeg ou .jpg
+       - le titre doit être sur la première ligne
+       - l'auteur (précédé de rien, ```Par ```, ```De ``` ou ```©```) doit être sur la deuxième ligne, optionnellement suivi de la date de publication entre parenthèses (i.e., ```Par Quelqu'un (3 octobre 1998)```)
+       - les chapitres doivent être déclarés avec ```Chapitre x``` ou ```Chapitre x: NOM DU CHAPTITRE```, où ```x``` est le numéro du chapitre
+       - une description de l'histoire doit être donnée en tant que chaptire 0
+       - une image de couverture peut être présente avec le même nom de fichier que l'histoire, mais une extension .png, .jpeg ou .jpg
 - info_text : fort proche du format texte, mais avec un fichier .info accompagnant l'histoire pour y enregistrer quelques metadata (le fichier de metadata est supposé être créé par Fanfix, ou être compatible avec)
 - cbz : les fichiers .cbz (une collection d'images zipées), de préférence créés avec Fanfix (même si les autres .cbz sont aussi supportés, mais sans la majorité des metadata de Fanfix dans ce cas)
 - html : les fichiers HTML que vous pouvez ouvrir avec n'importe quel navigateur ; remarquez que Fanfix créera un répertoire pour y mettre les fichiers nécessaires, dont un fichier ```index.html``` pour afficher le tout -- nous ne supportons en entrée que les fichiers HTML créés par Fanfix
 
-## Plateformes supportées
+### Plateformes supportées
 
 Toute plateforme supportant Java 1.6 devrait suffire.
 
@@ -52,12 +70,15 @@ Le programme a été testé sur Linux (Debian, Slackware et Ubuntu), MacOS X et
 
 Si vous avez des difficultés pour le compiler avec une version supportée de Java (1.6+), contactez-nous.
 
-## Utilisation
+## Options
 
 Vous pouvez démarrer le programme en mode graphique (comme dans le screenshot en haut) :
+
 - ```java -jar fanfix.jar```
+- ```fanfix``` (si vous avez utilisé *make install*)
 
 Les arguments suivants sont aussi supportés :
+
 - ```--import [URL]```: importer une histoire dans la librairie
 - ```--export [id] [output_type] [target]```: exporter l'histoire "id" vers le fichier donné
 - ```--convert [URL] [output_type] [target] (+info)```: convertir l'histoire vers le fichier donné, et forcer l'ajout d'un fichier .info si +info est utilisé
@@ -71,9 +92,10 @@ Les arguments suivants sont aussi supportés :
 - ```--help```: afficher la liste des options disponibles
 - ```--version```: retourne la version du programme
 
-### Variables d'environnement
+### Environnement
 
 Certaines variables d'environnement sont reconnues par le programme :
+
 - ```LANG=en```: forcer la langue du programme en anglais
 - ```CONFIG_DIR=$HOME/.fanfix```: utilise ce répertoire pour les fichiers de configuration du programme (et copie les fichiers de configuration par défaut si besoin)
 - ```NOUTF=1```: essaye d'utiliser des caractères non-unicode quand possible (cela peut avoir un impact sur les fichiers générés, pas uniquement sur les messages à l'utilisateur)
@@ -92,14 +114,21 @@ Quelques tests unitaires sont disponibles :
 ### Librairies dépendantes (incluses)
 
 Nécessaires :
-- libs/nikiroo-utils-sources.jar: quelques utilitaires partagés
-- [libs/unbescape-sources.jar](https://github.com/unbescape/unbescape): une librairie sympathique pour convertir du texte depuis/vers beaucoup de formats ; utilisée ici pour la partie HTML
-- [libs/jsoup-sources.jar](https://jsoup.org/): une libraririe pour parser du HTML
+
+- ```libs/nikiroo-utils-sources.jar```: quelques utilitaires partagés
+- [```libs/unbescape-sources.jar```](https://github.com/unbescape/unbescape): une librairie sympathique pour convertir du texte depuis/vers beaucoup de formats ; utilisée ici pour la partie HTML
+- [```libs/jsoup-sources.jar```](https://jsoup.org/): une libraririe pour parser du HTML
 
 Optionnelles :
-- [libs/jexer-sources.jar](https://github.com/klamonte/jexer): une petite librairie qui offre des widgets en mode TUI
+
+- [```libs/jexer-sources.jar```](https://github.com/klamonte/jexer): une petite librairie qui offre des widgets en mode TUI
+- [```pandoc```](http://pandoc.org/): pour générer les man pages depuis les fichiers README
 
 Rien d'autre, si ce n'est Java 1.6+.
 
 À noter : ```make libs``` exporte ces librairies dans le répertoire src/.
 
+## Auteur
+
+Fanfix a été écrit par Niki Roo <niki@nikiroo.be>
+
index e2312686b308f158ec03a62d46c7eadcdb45d144..9f971086b341946f9fb5f2a4bab2a25f8ffebe7d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,9 +1,24 @@
 English [Français](README-fr.md)
 
 # Fanfix
-
 Fanfix is a small Java program that can download stories from some supported websites and render them offline.
 
+## Synopsis
+
+- ```fanfix``` --import [*URL*]
+- ```fanfix``` --export [*id*] [*output_type*] [*target*]
+- ```fanfix``` --convert [*URL*] [*output_type*] [*target*] (+info)
+- ```fanfix``` --read [*id*] ([*chapter number*])
+- ```fanfix``` --read-url [*URL*] ([*chapter number*])
+- ```fanfix``` --list
+- ```fanfix``` --set-reader [*reader type*]
+- ```fanfix``` --server [*key*] [*port*]
+- ```fanfix``` --stop-server [*key*] [*port*]
+- ```fanfix``` --remote [*key*] [*host*] [*port*]
+- ```fanfix``` --help
+
+## Description
+
 (If you are interested in the recent changes, please check the [Changelog](changelog.md) -- note that starting from version 1.4.0, the changelog is checked at startup.)
 
 (A [TODO list](TODO.md) is also available to know what is expected to come in the future.)
@@ -15,14 +30,16 @@ TODO: new screenshots + TUI screenshots
 It will convert from a (supported) URL to an .epub file for stories or a .cbz file for comics (a few other output types are also available, like Plain Text, LaTeX, HTML...).
 
 To help organize your stories, it can also work as a local library so you can:
+
 - Import a story from its URL (or just from a file)
 - Export a story to a file (in any of the supported output types)
 - Display a story from the local library in text format in the console
 - Display a story from the local library graphically **by calling a native program to handle it** (though Fanfix can automatically process it into HTML so any browser can open it)
 
-## Supported websites
+### Supported websites
 
 Currently, the following websites are supported:
+
 - http://FimFiction.net/: fan fictions devoted to the My Little Pony show
 - http://Fanfiction.net/: fan fictions of many, many different universes, from TV shows to novels to games
 - http://mangafox.me/: a well filled repository of mangas, or, as their website states: most popular manga scanlations read online for free at mangafox, as well as a close-knit community to chat and make friends
@@ -30,21 +47,22 @@ Currently, the following websites are supported:
 - https://sofurry.com/: same thing, but story-oriented
 - https://e-hentai.org/: done upon request (so, feel free to ask for more websites!)
 
-## A note about file support
+### Support file types
 
 We support a few file types for local story conversion (both as input and as output):
+
 - epub: .epub files created by this program (we do not support "all" .epub files, at least for now)
 - text: local stories encoded in plain text format, with a few specific rules:
-  - the title must be on the first line
-  - the author (preceded by nothing, ```by ``` or ```©```) must be on the second line, possibly with the publication date in parenthesis (i.e., ```By Unknown (3rd October 1998)```)
-  - chapters must be declared with ```Chapter x``` or ```Chapter x: NAME OF THE CHAPTER```, where ```x``` is the chapter number
-  - a description of the story must be given as chapter number 0
-  - a cover image may be present with the same filename as the story, but a .png, .jpeg or .jpg extension
+       - the title must be on the first line
+       - the author (preceded by nothing, ```by ``` or ```©```) must be on the second line, possibly with the publication date in parenthesis (i.e., ```By Unknown (3rd October 1998)```)
+       - chapters must be declared with ```Chapter x``` or ```Chapter x: NAME OF THE CHAPTER```, where ```x``` is the chapter number
+       - a description of the story must be given as chapter number 0
+       - a cover image may be present with the same filename as the story, but a .png, .jpeg or .jpg extension
 - info_text: contains the same information as the text format, but with a companion .info file to store some metadata (the .info file is supposed to be created by Fanfix or compatible with it)
 - cbz: .cbz (collection of images) files, preferably created with Fanfix (but any .cbz file is supported, though without most of Fanfix metadata, obviously)
 - html: HTML files that you can open with any browser; note that it will create a directory structure with ```index.html``` as the main file -- we only support importing HTML files created by Fanfix
 
-## Supported platforms
+### Supported platforms
 
 Any platform with at lest Java 1.6 on it should be ok.
 
@@ -52,12 +70,15 @@ It has been tested on Linux (Debian, Slackware, Ubuntu), MacOS X and Windows for
 
 If you have any problems to compile it with a supported Java version (1.6+), please contact us.
 
-## Usage
+## Options
 
 You can start the program in GUI mode (as in the screenshot on top):
+
 - ```java -jar fanfix.jar```
+- ```fanfix``` (if you used *make install*)
 
 The following arguments are also allowed:
+
 - ```--import [URL]```: import the story at URL into the local library
 - ```--export [id] [output_type] [target]```: export the story denoted by ID to the target file
 - ```--convert [URL] [output_type] [target] (+info)```: convert the story at URL into target, and force-add the .info and cover if +info is passed
@@ -66,14 +87,15 @@ The following arguments are also allowed:
 - ```--list```: list the stories present in the library and their associated IDs
 - ```--set-reader [reader type]```: set the reader type to CLI, TUI or GUI for this command
 - ```--server [key] [port]```: start a story server on this port
-- ```--stop-server [key] [port]: stop the remote server running on this port (key must be set to the same value)
+- ```--stop-server [key] [port]```: stop the remote server running on this port (key must be set to the same value)
 - ```--remote [key] [host] [port]```: contact this server instead of the usual library (key must be set to the same value)
 - ```--help```: display the available options
 - ```--version```: return the version of the program
 
-### Environment variables
+### Environment
 
 Some environment variables are recognized by the program:
+
 - ```LANG=en```: force the language to English
 - ```CONFIG_DIR=$HOME/.fanfix```: use the given directory as a config directory (and copy the default configuration if needed)
 - ```NOUTF=1```: try to fallback to non-unicode values when possible (can have an impact on the resulting files, not only on user messages)
@@ -91,12 +113,22 @@ There are some unit tests you can run, too:
 
 ### Dependant libraries (included)
 
-- libs/nikiroo-utils-sources.jar: some shared utility functions
-- [libs/unbescape-sources.jar](https://github.com/unbescape/unbescape): a nice library to escape/unescape a lot of text formats; used here for HTML
-- [libs/jexer-sources.jar](https://github.com/klamonte/jexer): a small library that offers TUI widgets
-- [libs/jsoup-sources.jar](https://jsoup.org/): a library to parse HTML
+Required:
+
+- ```libs/nikiroo-utils-sources.jar```: some shared utility functions
+- [```libs/unbescape-sources.jar```](https://github.com/unbescape/unbescape): a nice library to escape/unescape a lot of text formats; used here for HTML
+- [```libs/jsoup-sources.jar```](https://jsoup.org/): a library to parse HTML
+
+Optional:
+
+- [```libs/jexer-sources.jar```](https://github.com/klamonte/jexer): a small library that offers TUI widgets
+- [```pandoc```](http://pandoc.org/): to generate the man pages from the README files
 
 Nothing else but Java 1.6+.
 
 Note that calling ```make libs``` will export the libraries into the src/ directory.
 
+## Author
+
+Fanfix was written by Niki Roo <niki@nikiroo.be>
+