Initial commit

This commit is contained in:
Cyrille L 2022-07-20 19:37:21 +02:00
commit df52514e42
20 changed files with 5224 additions and 0 deletions

661
LICENSE Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
GSL Statique Littérateur
Copyright (C) 2022 Libre en Communs / Commissions / Infrastructure
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

150
README.md Normal file
View File

@ -0,0 +1,150 @@
# STL: Statique Littérateur
STL est une évolution du projet GSL. STL permet de créer un ou plusieurs
sites web/blogs statiques, en fonction de leur nom de domaine.
Tout comme GSL, STL reprend une grande partie de l'écriture nouvelle de
vos articles, en apportant quelques évolutions. Les articles sont donc
au format .stl.
# Fonctionnement de STL ; le dossier de base
Contrairement à GSL, vos articles et les pages de votre site web sont
situés dans le même dossier de base. Pour obtenir ce dossier de base,
et configurer votre domaine, vous devez d'abord vous placer dans le
dossier de votre choix, puis lancer la commande de configuration.
```
cd MON-DOSSIER-PREFERE
stl domain new
# Vous pouvez également pré-remplir votre domaine en fonction de l'URL
stl domain new https://mon-site.xyz
```
Dans ce dossier de base (MON-DOSSIER-PREFERE), après la configuration de
votre domaine, vous trouverez de nouveaux dossiers :
- articles/
- - images/
- - files/
Les sous-dossiers images/ et files/ sont proposés afin de faciliter la
réutilisation d'images et de fichiers (PDF, ou autres) déjà présents
dans un autre article. Lors de la synchronisation, il seront copiés à la
racine wip de votre serveur. Le but : faire en sorte que le
navigateur n'ait pas à recharger un même fichier depuis une URL
différente - ce qui plomberait la rapidité d'affichage de la page et
l'intérêt d'un site statique. L'utilisation de cette fonction dans vos
articles est simple ; voir la documentation expliquant comment écrire un
article dans le dossier help.
Dans le dossier du serveur (/var/www est un exemple), vous trouverez
les dossiers suivants :
- /var/www/DOMAIN/wip/
- - template (logos, styles.css, sidebar.html, footer.html, metas.html...)
- - images
- - files
- /var/www/DOMAIN/www/ (non créé pour une installation locale)
- - template/
- - images
- - files
## Installation (serveur, ou localeà
Il est possible d'utiliser STL de 2 manières différentes. Lors de la
configuation d'un nouveau domaine, vous devrez choisir entre une
installation sur un serveur distant, et une installation uniquement en
local (sur votre PC). Vous pouvez bien sûr choisir une installation
serveur sur votre PC, mais il n'y a pas d'intérêt. Voici les différences.
### Installation sur un serveur distant
Lorsque vous installez STL, sur votre serveur distant, vous pouvez gérer
pour un même nom de domaine, votre site sur 2 adresses URL différentes.
La version WIP, permet de prévisualiser les modifications apportées à
vos pages (sans modifier www) avant de les valider sur WWW.
Concernant la décoration du site (styles.css, logos), les fichiers
devront être placés dans le dossier /wip/template/ (créé par STL lors
de l'ajout d'un domaine) depuis votre dossier de base. Lorsque votre site
prévisualisé sur WIP vous plaît, vous pouvez alors synchroniser le dossier
wip sur www grâce à la commande :
```
stl sync
```
Note : cette commande crée automatiquement le flux RSS dans wip, avant
de tous synchroniser.
### Installation sur un PC local
Lors d'une utilisation locale, la prévisualisation WIP ne sert à rien.
En effet, lorsque vous créez des pages, celles-ci sont placées dans
votre dossier de serveur local wip. Vous pouvez déjà ouvrir les pages
HTML dedans avec votre navigateur. Si vous êtes satisfait de vos pages
sur votre serveur local, vous pouvez directement transférer votre dossier
"/var/wip" local vers votre serveur www distant, par exemple, via SSH.
De ce fait, vous n'avez même pas besoin, d'instaler STL sur votre serveur
distant. Pour générer votre flux RSS, utilisez la commande :
```
stl rss
```
# Utilisation de STL
Afin de gérer vos articles, vous devez vous placer dans MON-DOSSIER-PREFERE.
L'autocomplétion est activee et personnalisée pour vous aider à trouver
(ARTICLE.stl).
## Créer votre arborescence
Dans MON-DOSSIER-PREFERE, vous trouverez le dossier "articles". Celui-ci
sert de base à votre domain.xyz sur votre serveur. C'est dans ce dossier
"articles", que vous pouvez créer vos articles et vos sous-dossiers.
Il est à noter que le nom de l'article est important, puisque STL
l'utilisera en le transformant en .html. Il est donc recommandé - mais
pas obligatoire - de nommer vos articles index.stl, pour obtenir une page
index.html. Si vous voulez créer une page 404, nommez votre article 404.stl
à la racine du dossier "articles".
## Convertir votre article en HTML
Placez vous dans MON-DOSSIER-PREFERE.
Avant de pouvoir convertir votre article, STL dispose d'un système de
vérification de la syntaxe STL. Si des erreeurs sont trouvées, un système
de logs vous aidera à corriger ces erreurs.
```
# N'oubliez pas d'utiliser l'autocomplétion
stl check (ARTICLE.stl)
```
Vous pouvez maintenant le convertir en HTMl dans le dossier wip
```
stl wip (ARTICLE.stl)
```
# Utilisation de la sidebar
C'est la seule partie du site qui est semi-statique. STL fait appel à
nginx, qui va se charger de traduire en HTML "include", le rendu du fichier
sidebar.html
Chaque article, une fois convertit avec wip peut être placé dans la
sidebar à la position désirée, entre 1 et la valeur maximum décidée, lors
de la configuration du domaine.
```
stl sidebar add 1 (ARTICLE.stl)
```
Vous pouvez également décider de placer un article ausitôt convertit dans
la sidebar
```
stl wip sidebar=2 (ARTICLE.stl)
```
## Dépendances
STL est écrit en bash, et a besoin des utilitaires
- gawk
- rsync
- nano
Oui, pour l'instant, c'est tout ;)

10
control Normal file
View File

@ -0,0 +1,10 @@
Package: estl
Version: 0.2.0
Section: custom
Priority: optional
Architecture: all
Essential: no
Depends: rsync,nano,gawk
Installed-Size: `du -ks usr|cut -f 1`
Maintainer: echolib <echolib@a-lec.org>
Description: STL: Statique Littérateur by echolib, is a multiple blogs/websites generator based on their domain, written in bash, for minimal dependancies. The websites are static, except for the sidebar, that nginx can easily get, in your webserver.

44
etc/stl/stl.conf Normal file
View File

@ -0,0 +1,44 @@
#!/bin/bash
# Name: Statique Littérateur
# Type: Configuration file
# file: stl.conf
# Folder: /etc/stl/stl.conf
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# Register main app folders
#======================================================================
stl_dir="/var/lib/stl"
stl_dir_help="$stl_dir/help"
stl_dir_db="$stl_dir/db"
stl_dir_scripts="$stl_dir/scripts"
stl_dir_log="/var/log/stl"
#======================================================================
# Register main scripts files
#======================================================================
stl_file_help_args="$stl_dir_help/help"
stl_file_log="$stl_dir_log/stl.log"
stl_file_last_log="$stl_dir_log/last_stl.log"
stl_file_pwd_conf='.stl.conf'
#======================================================================
# Logs
#======================================================================
stl_log_e="Err"
stl_log_w="War"
stl_log_i='Inf'
#======================================================================
# colors
#======================================================================
NC="\e[0m"
CY="\e[33m"
CR="\e[0;91m"

123
usr/local/bin/stl Executable file
View File

@ -0,0 +1,123 @@
#!/bin/bash
# Version: 0.2.0
# Name: Statique Littérateur
# Type: Executable
# file: stl
# Folder: /usr/local/bin
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# Main Tools functions
#======================================================================
#----------------------------------------------------------------------
# Unknown argument
#----------------------------------------------------------------------
noarg() {
echo "! Invalid argument '$1'. $2"
exit
}
#----------------------------------------------------------------------
# Check if file exists
# $1: file
# $2: Options
#----------------------------------------------------------------------
if__file() {
[[ "$1" ]] || exit
! [[ -f "$1" ]] \
&& echo "! Missing file: $1" \
&& exit
case "$2" in
source) source "$1" || exit ;;
read) cat -n "$1";exit ;;
esac
}
#----------------------------------------------------------------------
# Check if file or directory is writeable
#----------------------------------------------------------------------
if__folder() {
! [[ -d "$1" ]] \
&& echo "! Missing folder $1" \
&& exit
}
#----------------------------------------------------------------------
# Check if file or directory is writeable
#----------------------------------------------------------------------
if__writeable() {
! [[ -w "$1" ]] \
&& echo "! $1 is not writeable" \
&& exit
}
#======================================================================
# Source dependancies from /scripts
# Confirm not missing directories and files
#======================================================================
if__file "/etc/stl/stl.conf" source # Main Config
if__folder "$stl_dir_help"
if__folder "$stl_dir_scripts"
if__folder "$stl_dir_db"
if__writeable "$stl_dir_db"
if__folder "$stl_dir_log"
if__writeable "$stl_dir_log"
touch "$stl_file_log"
if__file "$stl_dir_scripts/manage__domain" source
if__file "$stl_dir_scripts/manage__articles" source
if__file "$stl_dir_scripts/manage__logs" source
if__file "$stl_dir_scripts/manage__db" source
if__file "$stl_dir_scripts/manage__HTML" source
if__file "$stl_dir_scripts/manage__sidebar" source
if__file "$stl_dir_scripts/check__article" source
if__file "$stl_dir_scripts/wip__article" source
#======================================================================
# Analyse Arguments from command line
# Check Options in each dedicated files scripts
#======================================================================
case "$1" in
domain) domain__OPTIONS "$@" ;; # manage__domain
help|-h) if__file "$stl_file_help_args" read;exit ;;
readme) if__file "$stl_dir_help/README.md" read;exit ;;
check) check__OPTIONS "$@" ;; # check__article
wip) wip__OPTIONS "$@" ;; # wip__article
sidebar) sidebar__OPTIONS "$@" ;; # manage__sidebar
rss) domain__get;create__RSS_feed ;; # mamage__HTML
sync) sync_wip_to_www ;; # manage__HTML
read) read__OPTIONS "$@" ;; # manage__articles
edit) edit__OPTIONS "$@" ;; # manage__articles
log) log__OPTIONS "$@" ;; # manage__articles
db) db__OPTIONS "$@" ;; # manage__db
*) noarg "$1" ;;
esac
#======================================================================
# Print & create new logs
#======================================================================
logs__print "$stl_file_last_log" # exit if none
# Create whole logs
cat "$stl_file_last_log" >> "$stl_file_log"
echo -e "---\t" >> "$stl_file_log"
# Create logs for specific article
cat "$stl_file_last_log" >> "$stl_dir_log/$article_id.log"
echo -e "---\t" >> "$stl_dir_log/$article_id.log"
# Remove last log session
rm -f "$stl_file_last_log"
exit

View File

@ -0,0 +1,13 @@
_stl_completions()
{
local stlfiles cur
stlfiles=$(find . -type f -name "*.stl" 2>/dev/null \
| awk -F"./articles/" '{print $2}')
cur="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=( $(compgen -W "$stlfiles" -- ${cur}) )
return 0
}
complete -F _stl_completions 'stl'

0
var/lib/stl/db/.gitkeep Normal file
View File

View File

@ -0,0 +1,425 @@
# Écriture d'un article STL (.stl)
## Métas
Les métas utilisent le format suivant :
```
valeur: Champ 1 : Champ 2 : Champ 3
# Séparation des champs par ' : '
```
### Métas Obligatoires (uniques)
Les métas obligatoire à renseigner dans votre article :
Note: Ne pas mettre le signe `"` dans les metas
```
date: YYYY-MM-DD
title: Mon titre
author: auteur
about: Informations concernant l'article
tags: tag,tag 2,tag 3
```
### Métas Optionnelles (non uniques)
Ces métas permettent de définir vos liens ainsi que leur description
pour vos fichiers et vos textes.
- NAME peut être un numéro ou un nom à reprendre dans l'article
- (URI)FILENAME est le nom du fichier
- - Commençant par @ : le fichier est dans le dossier files ou images
- - Sous-dossiers possibles
- ALT-TEXT est utilisé pour la balise
HTML `title="ALT-TEXT"`
```
image: NAME : (URI)FILENAME : ALT-TEXT
abbr: COURT : Long text : écriture (Champ 3 optionnel)
file: NAME : (URI)FILENAME : ALT-TEXT
link: NAME : URL : ALT-TEXT*
code: NAME : (URI)FILENAME : ALT-TEXT
brut: NAME : (URI)FILENAME
```
## Contenu de l'article
Sont postées dans les exemples en commentaires les classes CSS utilisées
pour chaque module. "xxx_" représente la valeur choisie lors de la
configuration du domaine (```stl domain new```)
### Séparateur de contenus (metas, article)
Dans l'article, mettre après les métas, une barre d'au moins 5 ```-```,
servant de repère pour détermier le début du contenu de l'article qui
sera repris dans la page HTML.
### Écrire des titres
Dans l'article placez ```#X``` ou X est compris eentre 1 et 6 :
```
#1 Titre 1 # <h1 class="xxx_title xxx_title-1">Titre 1</h1>
#2 Titre 2 # <h2 class="xxx_title xxx_title-2">Titre 2</h2>
mon contenu
# Classe CSS utilisée : xxx_title xxx_title-X
```
Noter qu'entre les titres une balise div est créée si, il y a du contenu
```
#1 Titre 1
#2 Titre 2
mon contenu
# Sortie HTML
<h1 class="xxx_title xxx_title-1">Titre 1</h1>
<h2 class="xxx_title xxx_title-2">Titre 2</h2>
<div class="xxx_content xxx_content-h2"
mon contenu
</div>
# Classe CSS utilisée : xxx_content xxx_content-hX
```
### Écrire des paragraphes
Dans l'article :
```
(
ceci est un paragraphe simple
)
# Classe CSS utilisée : xxx_p
( maclasse
ceci est un paragraphe personnalisable en CSS.
)
# Classe CSS utilisée : xxx_p maclasse
```
### Écrire un lien vers une URL
En méta (2 premiers champs obligatoire) :
```
link: ce super site : https//... : Ce site parle de ça
```
Dans l'article :
```
Tout est marqué sur _ce super site et c'est top !
# Classe CSS utilisée : xxx_link
```
### Liens vers fichier interne
En méta (2 premiers champs obligatoire) :
```
file: cette documentation : FILENAME : Ouvrez le fichier
```
Dans l'article :
```
Reportez vous à __cette documentation
# Classe CSS utilisée : xxx_link-file
```
### Afficher des Images
En métas (Les 3 champs sont obligatoires) :
```
image: 1 : STL_file_conf.png : Utiliser 'stl read conf'
image: 2 : @avatar-1.png : Image réutilisable dans d'autres articles
image: logo : @logos/STL.png : Image réutilisable dans le dossier logos
```
Dans l'article :
Chaque marqueur d'image doit se trouver sur sa propre ligne.
- Le marqueur `_image:CHAMP1` est obligatoire
- Les valeurs suivantes sont optionnelles (séparées par un espace)
- - t=(TARGET)
- - - t=+ # Ouvre l'image affichée en taille originale, ou
- - - t=http|ftp # Pointe l'image vers le site http|ftp
- - c=(CLASS)
- - - c=maclasse # Définir la classe CSS "maclasse" : xxx_image maclasse
- - w=(WIDTH) # Si pas d'unité, défaut = 'px'
- - - w=480 # Affiche l'image avec une largeur de 480px
- - h=(HEIGHT) # Si pas d'unité, défaut = 'px'
- - - h=30% # Affiche l'image avec une hauteur de 30%
Si WIDTH ou HEIGHT renseigné uniquement, affiche l'image avec
HEIGHT ou WIDTH addapté
#### Quelques exemples de marqueurs d'images
```
_image:1 c=echolib w=720 h=360 t=https://blog.echolib.re/
# Affiche l'image 1, avec une largeur de 720px et une hauteur de 360px
# pointant vers le site https://blog.echolib.re/
# Classe CSS utilisée : xxx_image echolib
_image:2 c=d t=+ w=50%
# Affiche l'image 2, avec une largeur de 50%, et une hauteur adaptée
# cliquable vers sa taille originale
# Classe CSS utilisée : xxx_image right
_image:logo h=10em
# Affiche l'image logo avec une hauteur de 10em et une largeur adaptée
# (non cliquble)
# Classe CSS utilisée : xxx_image center
# Pour afficher les images les unes en dessous des autres, utiliser des
# paragraphes '()' ou le signe '|' pour définir un <br />. Sans, les
# images s'affichent les unes à côté des autres
(
_image:1
|
_image:2
)
```
### Abréviations
En métas (2 premiers champs obligatoire) :
```
abbr: POUET : Descriptif : Pouets
# "POUET" doit être écrit en majuscule
# 3ème champ optionnel : écrit "Pouets" au lieu de POUET
# 3ème champ vide : écrit le 1er champ "POUET"
```
Dans l'article :
```
Des POUET très inscructifs
# "POUET" doit avoir un espace, avant ou après pour être pris en compte
# "Descriptif" est utilisé dans la balise title HTML
# Classe CSS utilisée : xxx_abbr
```
### Écrire en gras
Dans l'article, entourer le ou les mots par :
```
+_Ceci est en gras_+
# Classe CSS utilisée : xxx_bold
```
### Écrire en très gras (strong)
Dans l'article, entourer le ou les mots par :
```
*_Ceci est en super gras_*
# Classe CSS utilisée : xxx_strong
```
### Écrire en italique
Dans l'article, entourer le ou les mots par :
```
\_Ceci est en italique_\
# Classe CSS utilisée : xxx_em
```
### Écrire un ou plusieurs mots en classe personnalisée (cross)
Dans l'article, entourer le ou les mots par :
```
# × : combinaisaon de touche altgr + shift + ; sur clavier FR défaut
×_Géniale, cet affichage de ces mots_×
# Classe CSS utilisée : xxx_cross
```
### Écrire en "barré"
Dans l'article, entourer le ou les mots par :
```
C'est ~_vrai_~ faux !
# Classe CSS utilisée : xxx_del
```
### Écrire du code en ligne
Dans l'article, entourer le code par :
```
Recopiez ce code : _`code python, html ou autres *...`_
# Classe CSS utilisée : xxx_icode
```
### Écrire des citations
Il y a 2 sortes de citations disponibles. Les citations simples, et les
citations avancées. Une citation doit être définie et entourée par 3
```-``` au début d'une ligne. Si besoin d'utiliser une classe CSS
personnalisée, il suffit de définir le nom de cette classe après les 3
```-```.
#### Citations simples
Dans l'article :
```
---
Ceci est une citation simple sans classe CSS personnalisée
---
# Classe CSS utilisée : xxx_quote (sur <blockquote>)
--- maclasse
_lang: fr
Ceci est une citation définie en français simple avec la classe CSS maclasse
---
# Classe CSS utilisée : xxx_quote maclasse (sur <blockquote>)
```
#### Citations avancées
Il est possible de définir plusieurs références à la citation. Définir
son auteur permet d'avoir un rendu HTML utilisant les balises
```<figure>``` et ```<figcaption>``` en HTML
Dans l'article :
Même si cette citation est réelle, noter que les références "_year" et
"_book" sont fictives, et ne sont là qu'à titres d'exemples.
```
--- Stallman
_cite : Richard Matthew Stallman
_link : https://stallman.org/
_lang : en
_year : 1995
_book : Le mouvement du logiciel libre
(
In the free/libre software movement, we develop software that respects
users' freedom, so we and you can escape from software that doesn't. I
could have made money this way, and perhaps amused myself writing code.
But I knew that at the end of my career, I would look back on years of
building walls to divide people, and feel I had spent my life making the
world a worse place
)
---
# Classe CSS utilisée : xxx_quote Stallman (sur <figure>)
```
### Écrire des listes
Pour définir une liste, elle doit être entourée de ```<<``` et ```>>```
Il est possible de personnaliser la classe de sa liste ```<< maclasse```
Il y a 2 marqueurs pour les listes.
- ```=``` pour les listes simples
- ```+``` pour les listes ordonnées
Les listes sont infinies, et dépendent du nombre de marqueurs par itmm.
Il est possible de mixer les marqueurs, sous condition de respecter la
logique du nombre de marqueurs.
Dans l'article :
```
# Liste avec classe personnalisée "couverture"
<< couverture
= Livre 1
+ Chapitre 1
+ Chaptire 2
++ Résumé du Ch 2
++ Citation du Ch 2
= Livre 2
+ Chapitre 1
>>
# Classe CSS utilisée : xxx_list xxx_list-ul couverture couverture-ul
# Remplace ul par ol si la liste commence par "+"
# Chaque item <li> utilise la classe : xxx_li xxx_li-X
# où X est le nombre de marquurs
# La sortie de cette liste en HTML, avec le domaine css "a-lec" :
<ul class="a-lec_list a-lec_list-ul couverture couverture-ul">
<li class="a-lec_li a-lec_li-1">Livre 1</li>
<ol>
<li class="a-lec_li a-lec_li-1">Chapitre 1</li>
<li class="a-lec_li a-lec_li-1">Chaptire 2</li>
<ol>
<li class="a-lec_li a-lec_li-2">Résumé du Ch 2</li>
<li class="a-lec_li a-lec_li-2">Citation du Ch 2</li>
</ol>
</ol>
<li class="a-lec_li a-lec_li-1">Livre 2</li>
<ol>
<li class="a-lec_li a-lec_li-1">Chapitre 1</li>
</ol>
</ul>
#--------------------------------
# ! Ce qu'il ne faut pas faire :
# Changer de marqueur, en ajoutant 1
<<
= livre 1
++ Chaptire 1
>>
```
### Affiche un code source depuis un fichier
En métas (2 premiers champs obligatoires) :
```
code: python : (URI)FILENAME : alt-text
```
Dans l'article:
Chaque marqueur de block code doit se trouver sur sa propre ligne.
```
_code:python
# Classes CSS et balises HTML utilisées :
# <pre> : xxx_code-block code-block-python
# <span> (line number) : xxx_code-line
# <span> (content) : xxx_code-content
# </pre>
# <div> : xxx_code-div
# <a> : xxx_code-link
#
```
### Retour à la ligne simplifié
Vous pouvez écrire en HTML ```<br />``` mais, afin de faciliter la
lecture dans l'article original, placez au tout début de la ligne ```|```
Dans l'article :
```
(
Ceci est un long paragraphe
|
Ici, une nouvelle ligne dans ce paragraphee.
)
```

661
var/lib/stl/help/LICENSE Normal file
View File

@ -0,0 +1,661 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
GSL Statique Littérateur
Copyright (C) 2022 Libre en Communs / Commissions / Infrastructure
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

150
var/lib/stl/help/README.md Normal file
View File

@ -0,0 +1,150 @@
# STL: Statique Littérateur
STL est une évolution du projet GSL. STL permet de créer un ou plusieurs
sites web/blogs statiques, en fonction de leur nom de domaine.
Tout comme GSL, STL reprend une grande partie de l'écriture nouvelle de
vos articles, en apportant quelques évolutions. Les articles sont donc
au format .stl.
# Fonctionnement de STL ; le dossier de base
Contrairement à GSL, vos articles et les pages de votre site web sont
situés dans le même dossier de base. Pour obtenir ce dossier de base,
et configurer votre domaine, vous devez d'abord vous placer dans le
dossier de votre choix, puis lancer la commande de configuration.
```
cd MON-DOSSIER-PREFERE
stl domain new
# Vous pouvez également pré-remplir votre domaine en fonction de l'URL
stl domain new https://mon-site.xyz
```
Dans ce dossier de base (MON-DOSSIER-PREFERE), après la configuration de
votre domaine, vous trouverez de nouveaux dossiers :
- articles/
- - images/
- - files/
Les sous-dossiers images/ et files/ sont proposés afin de faciliter la
réutilisation d'images et de fichiers (PDF, ou autres) déjà présents
dans un autre article. Lors de la synchronisation, il seront copiés à la
racine wip de votre serveur. Le but : faire en sorte que le
navigateur n'ait pas à recharger un même fichier depuis une URL
différente - ce qui plomberait la rapidité d'affichage de la page et
l'intérêt d'un site statique. L'utilisation de cette fonction dans vos
articles est simple ; voir la documentation expliquant comment écrire un
article dans le dossier help.
Dans le dossier du serveur (/var/www est un exemple), vous trouverez
les dossiers suivants :
- /var/www/DOMAIN/wip/
- - template (logos, styles.css, sidebar.html, footer.html, metas.html...)
- - images
- - files
- /var/www/DOMAIN/www/ (non créé pour une installation locale)
- - template/
- - images
- - files
## Installation (serveur, ou localeà
Il est possible d'utiliser STL de 2 manières différentes. Lors de la
configuation d'un nouveau domaine, vous devrez choisir entre une
installation sur un serveur distant, et une installation uniquement en
local (sur votre PC). Vous pouvez bien sûr choisir une installation
serveur sur votre PC, mais il n'y a pas d'intérêt. Voici les différences.
### Installation sur un serveur distant
Lorsque vous installez STL, sur votre serveur distant, vous pouvez gérer
pour un même nom de domaine, votre site sur 2 adresses URL différentes.
La version WIP, permet de prévisualiser les modifications apportées à
vos pages (sans modifier www) avant de les valider sur WWW.
Concernant la décoration du site (styles.css, logos), les fichiers
devront être placés dans le dossier /wip/template/ (créé par STL lors
de l'ajout d'un domaine) depuis votre dossier de base. Lorsque votre site
prévisualisé sur WIP vous plaît, vous pouvez alors synchroniser le dossier
wip sur www grâce à la commande :
```
stl sync
```
Note : cette commande crée automatiquement le flux RSS dans wip, avant
de tous synchroniser.
### Installation sur un PC local
Lors d'une utilisation locale, la prévisualisation WIP ne sert à rien.
En effet, lorsque vous créez des pages, celles-ci sont placées dans
votre dossier de serveur local wip. Vous pouvez déjà ouvrir les pages
HTML dedans avec votre navigateur. Si vous êtes satisfait de vos pages
sur votre serveur local, vous pouvez directement transférer votre dossier
"/var/wip" local vers votre serveur www distant, par exemple, via SSH.
De ce fait, vous n'avez même pas besoin, d'instaler STL sur votre serveur
distant. Pour générer votre flux RSS, utilisez la commande :
```
stl rss
```
# Utilisation de STL
Afin de gérer vos articles, vous devez vous placer dans MON-DOSSIER-PREFERE.
L'autocomplétion est activee et personnalisée pour vous aider à trouver
(ARTICLE.stl).
## Créer votre arborescence
Dans MON-DOSSIER-PREFERE, vous trouverez le dossier "articles". Celui-ci
sert de base à votre domain.xyz sur votre serveur. C'est dans ce dossier
"articles", que vous pouvez créer vos articles et vos sous-dossiers.
Il est à noter que le nom de l'article est important, puisque STL
l'utilisera en le transformant en .html. Il est donc recommandé - mais
pas obligatoire - de nommer vos articles index.stl, pour obtenir une page
index.html. Si vous voulez créer une page 404, nommez votre article 404.stl
à la racine du dossier "articles".
## Convertir votre article en HTML
Placez vous dans MON-DOSSIER-PREFERE.
Avant de pouvoir convertir votre article, STL dispose d'un système de
vérification de la syntaxe STL. Si des erreeurs sont trouvées, un système
de logs vous aidera à corriger ces erreurs.
```
# N'oubliez pas d'utiliser l'autocomplétion
stl check (ARTICLE.stl)
```
Vous pouvez maintenant le convertir en HTMl dans le dossier wip
```
stl wip (ARTICLE.stl)
```
# Utilisation de la sidebar
C'est la seule partie du site qui est semi-statique. STL fait appel à
nginx, qui va se charger de traduire en HTML "include", le rendu du fichier
sidebar.html
Chaque article, une fois convertit avec wip peut être placé dans la
sidebar à la position désirée, entre 1 et la valeur maximum décidée, lors
de la configuration du domaine.
```
stl sidebar add 1 (ARTICLE.stl)
```
Vous pouvez également décider de placer un article ausitôt convertit dans
la sidebar
```
stl wip sidebar=2 (ARTICLE.stl)
```
## Dépendances
STL est écrit en bash, et a besoin des utilitaires
- gawk
- rsync
- nano
Oui, pour l'instant, c'est tout ;)

45
var/lib/stl/help/help Normal file
View File

@ -0,0 +1,45 @@
# STL: Statique Littérateur
# Arguments
help, -h : This help
readme : Show README.md
domain : Show domain used in current folder
new [OPT] : Set a new domain from current directory. OPT [DOMAIN]
edit : Edit current PWD DOMAIN configuration in nano
read
(ARTICLE) : Read (ARTICLE) in terminal
conf : Read current PWD DOMAIN configuration in terminal
edit
(ARTICLE) : Edit (ARTICLE) in nano
conf : Edit current PWD DOMAIN configuration in nano
check : (Multi-arguments)
(ARTICLE) : Check STL syntax
-F : Force check again
wip : (Multi-arguments)
(ARTICLE) : Convert (ARTICLE) to HTML in wip folder
-F : Force convert (if (ARTICLE) already exists nd up)
sidebar : (alone argument), (re)Create whole sidebar
sidebar=POS : POS is between 1 and max configured. After converted
put article in sidebar at postition POS
sidebar : (ACTION) (POSITION) (ARTICLE)
(ACTION) : No need (POSITION) nor (ARTICLE) for latest, oldest
latest : Create sidebar with latest articles (ARTICLE date)
oldest : Create sidebar with oldest articles (ARTICLE date)
add : Create sidebar, add/replace (ARTICLE) at (POSITION)
create : (alone argument), (re)Create whole sidebar
sync : Create RSS feed and sync folders from wip to www
log : (Multi-arguments)
(ARTICLE) : Show logs for (ARTICLE) || default: all
clean : Clean logs for (ARTICLE)
db
list : list all databases in a table with some article datas
(ARTICLE) : Rea db from (ARTICLE)

View File

@ -0,0 +1,663 @@
#!/bin/bash
# Name: Statique Littérateur
# Type: Article Checkers
# file: check__article
# Folder: /var/lib/stl/scripts/
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# Argument check
# $1: check
# $2: arguments
#======================================================================
check__OPTIONS() {
! [[ "$2" ]] \
&& noarg "Cannot be empty"
while test "$2"
do
case "$2" in
-F) check_force=true ;;
*".stl")
article__hash "$2"
;;
*)
noarg "$2"
;;
esac
shift
done
[[ "$uri_article" ]] \
&& checkers "$uri_article"
}
#======================================================================
# Get sub uri, split articl (head,post)
# Start modules to check article
# $1: article
#======================================================================
checkers() {
if__article_db "$article_db" # If DB exists
if ! [[ $check_force ]];then # Option: -F
if [[ $nocheck ]];then # Same Hash, do not check, but
log__OPTIONS "$article_log" # Show logs for it if exists
fi
fi
article_name=`basename "$uri_article"`
uri_folder=${uri_article/\/$article_name/} #No ending / for checkers
article_dir_srv=${uri_folder/$domain_dir_articles}
sub_genuri_srv="${article_dir_srv//[^\/]}"
sub_genuri_srv=`printf '%0.s../' $(seq 1 ${#sub_genuri_srv})`
suri="$sub_genuri_srv"
split_article "$1" # Split metas & content
[[ $stl_error ]] && return # Cancel if no separator
# Create TMP file for Db, with URI files
article_tmp_db=`mktemp`
# Checkers
check__metas "$article_tmp_head" # Needed metas
check__titles "$article_tmp_post"
check__paragraphs "$article_tmp_post"
check__quotes "$article_tmp_post"
check__lists "$article_tmp_post"
check__icodes "$article_tmp_post"
check__strongs "$article_tmp_post"
check__bolds "$article_tmp_post"
check__emphasis "$article_tmp_post"
check__cross "$article_tmp_post"
check__dels "$article_tmp_post"
! [[ $stl_error ]] \
&& log__add -i -C -A "Content Ok"
# If no error, write to db
db__print
# No more needed split files (created in split_article())
rm -f "$article_tmp_head"
rm -f "$article_tmp_post"
rm -f "$article_tmp_db"
}
#----------------------------------------------------------------------
# Modules that check article contents
#----------------------------------------------------------------------
#======================================================================
# Check NEEDED metas. Called from checkers()
# $1: $article_tmp_head
#======================================================================
check__metas() {
# Function to check NEEDED metas and their content
# Find line with marker, stdout without marker
# $1: marker
# $2: $article_tmp_head
# --------------------
check__needed_meta() {
while read -r "content"
do
awk -F"$1" '{print $2}' <<<"$content"
break # Only the first one will be registred
done < <(grep "$1" "$2")
}
article_Date=`check__needed_meta "^date: " "$1"`
article_Title=`check__needed_meta "^title: " "$1"`
article_About=`check__needed_meta "^about: " "$1"`
article_Author=`check__needed_meta "^author: " "$1"`
article_Tags=`check__needed_meta "^tags: " "$1"`
# Analyse needed content
case "$article_Date" in
'') log__add -e -C -Mda "No date registred. Use: YYYY-MM-DD" ;;
[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])
date_Y=`awk -F- '{print $1}' <<<"$article_Date"`
date_M=`awk -F- '{print $2}' <<<"$article_Date"`
(( $date_M > 12 || $date_M < 1 )) \
&& log__add -e -C -Mda "Mismatch Month: '$date_M'"
date_D=`awk -F- '{print $3}' <<<"$article_Date"`
(( $date_D > 31 || $date_D < 1 )) \
&& log__add -e -C -Mda "Mismatch Day: '$date_D'"
# timestamp date to db (for sidebar sort)
false_time=`date +%T`
date_epoch="$date_Y-$date_M-$date_D $false_time"
date_epoch=`date +%s -u -d "$date_epoch"`
;;
*) log__add -e -C -Mda "Mismatch date. Use: YYYY-MM-DD" ;;
esac
[[ "$article_Title" ]] || log__add -e -C -Mti "No title registred"
[[ "$article_About" ]] || log__add -e -C -Mab "No about registred"
[[ "$article_Author" ]] || log__add -e -C -Mau "No author registred"
[[ "$article_Tags" ]] || log__add -e -C -Mta "No tags registred"
[[ $stl_error ]] || log__add -i -C -M "Needed Metas Ok"
# Init stats for files
stat_images=0
stat_link_files=0
stat_codes=0
stat_bruts=0
# Analyse optional metas content. Function is in manage_articles
get__content_metas "^link: " "$1" check
get__content_metas "^file: " "$1" check
get__content_metas "^image: " "$1" check
get__content_metas "^brut: " "$1" check
get__content_metas "^code: " "$1" check
get__content_metas "^abbr: " "$1" check
! [[ $stl_error ]] \
&& log__add -i -C -M "Optional Metas Ok"
}
#======================================================================
# Check content metas LINK
# Called from get__content_metas() in manage__articles
#======================================================================
check__link() {
! [[ $meta ]] && return
# Needed meta fields
if ! [[ "$header_f1" && "$header_f2" ]];then
log__add -e -C -Mlt \
"Line $ln. Mismatch: 'NAME : URL : ALT-TEXT'"
return
fi
# Accessibility alt-text
if ! [[ "$header_f3" ]];then
log__add -w -C -Mlt \
"Line $ln. Accessibility: please, use ALT-TEXT"
fi
# Needed article content
if ! [[ `grep "_$header_f1" "$article_tmp_post"` ]];then
log__add -e -C -A \
"Line $ln. No content: '_$header_f1'"
return
fi
}
#======================================================================
# Common function to check if file exists
# for __image, __precode, __brut __link_file
# $1: generic_file (with @ in FILENAME) | article_file
# $2: Log_f3
#======================================================================
check__file_exist() {
case "$1" in
"article_file")
uri_file="$uri_folder/$header_f2"
if ! [[ -f "$uri_folder/$header_f2" ]];then
this_article="$uri_folder/$header_f2"
log__add -e -C "$2" \
"Line $ln. File not found: '$header_f2'"
fi
;;
"generic_file")
header_f2=${header_f2/@/}
case "$2" in
"-Mim") uri_file="$domain_dir_images/$header_f2" ;;
*) uri_file="$domain_dir_files/$header_f2" ;;
esac
if ! [[ -f "$uri_file" ]];then
this_article="$domain_dir_images/$header_f2"
log__add -e -C "$2" \
"Line $ln. File not found: '$header_f2'"
fi
;;
esac
}
#======================================================================
# Check content metas LINK FILE
# Called from get__content_metas() in manage__articles
#======================================================================
check__link_file() {
! [[ $meta ]] && return
# Needed meta fields
if ! [[ "$header_f1" && "$header_f2" ]];then
log__add -e -C -Mlf \
"Line $ln. Mismatch: 'NAME : FILENAME : ALT-TEXT'"
return
fi
# Accessibility alt-text
if ! [[ "$header_f3" ]];then
log__add -w -C -Mlf \
"Line $ln. Accessibility: please, use ALT-TEXT"
fi
# Needed article content
if ! [[ `grep "__$header_f1" "$article_tmp_post"` ]];then
log__add -e -C -A \
"Line $ln. No content: '__$header_f1'"
return
fi
# File exists
case "$header_f2" in
"@"*) check__file_exist "generic_file" "-Mlf" ;;
*) check__file_exist "article_file" "-Mlf" ;;
esac
[[ $stl_error ]] && return
# Count
((stat_link_files++))
# Write to tmp BD
echo "File_$stat_link_files='$uri_file'" >> "$article_tmp_db"
}
#======================================================================
# Check content metas IMAGE
# Called from get__content_metas() in manage__articles
#======================================================================
check__image() {
! [[ $meta ]] && return
# Needed meta fields
if ! [[ "$header_f1" && "$header_f2" && "$header_f3" ]];then
log__add -e -C -Mim \
"Line $ln. Mismatch: 'NBR : FILENAME : ALT-TEXT'"
return
fi
# Needed article content
if ! [[ `grep "_image:$header_f1 " "$article_tmp_post"` ]];then
log__add -e -C -A \
"Line $ln. No content: '_image:$header_f1 '"
return
fi
# File exists
case "$header_f2" in
"@"*) check__file_exist "generic_file" "-Mim" ;;
*) check__file_exist "article_file" "-Mim" ;;
esac
[[ $stl_error ]] && return
# Count
((stat_images++))
# Write to tmp BD
echo "Image_$stat_images='$uri_file'" >> "$article_tmp_db"
}
#======================================================================
# Check content metas CODE (with <pre>)
# Called from get__content_metas() in manage__articles
#======================================================================
check__precode() {
! [[ $meta ]] && return
# Needed meta fields
if ! [[ "$header_f1" && "$header_f2" && "$header_f3" ]];then
log__add -e -C -Mpc \
"Line $ln. Mismatch: 'NBR : FILENAME : ALT-TEXT'"
return
fi
# Needed article content
if ! [[ `grep "_code:$header_f1" "$article_tmp_post"` ]];then
log__add -e -C -A \
"Line $ln. No content: '_code:$header_f1'"
return
fi
# File exists
case "$header_f2" in
"@"*) check__file_exist "generic_file" "-Mpc" ;;
*) check__file_exist "article_file" "-Mpc" ;;
esac
[[ $stl_error ]] && return
# Count
((stat_codes++))
# Write to tmp BD
echo "Code_$stat_codes='$uri_file'" >> "$article_tmp_db"
}
#======================================================================
# Check content metas BRUT
# Called from get__content_metas() in manage__articles
#======================================================================
check__brut() {
! [[ $meta ]] && return
# Needed meta fields
if ! [[ "$header_f1" && "$header_f2" ]];then
log__add -e -C -Mbr \
"Line $ln. Mismatch: 'NBR : FILENAME'"
return
fi
# Needed article content
if ! [[ `grep "_brut:$header_f1" "$article_tmp_post"` ]];then
log__add -e -C -A \
"Line $ln. No content: '_brut:$header_f1'"
return
fi
# File exists
case "$header_f2" in
"@"*) check__file_exist "generic_file" "-Mbr" ;;
*) check__file_exist "article_file" "-Mbr";;
esac
[[ $stl_error ]] && return
# Count
((stat_bruts++))
# Write to tmp BD
echo "Brut_$stat_bruts='$uri_file'" >> "$article_tmp_db"
}
#======================================================================
# Check content metas ABBR
# Called from get__content_metas() in manage__articles
#======================================================================
check__abbr() {
[[ $meta ]] || return
# Needed meta fields
if ! [[ "$header_f1" && "$header_f2" ]];then
log__add -e -C -Mab \
"Line $ln. Mismatch: 'SHORT : Long : option'"
return
fi
# Meta field 1 must be in CAPS
if ! [[ $header_f1 == ${header_f1^^} ]];then
log__add -e -C -Mab \
"Line $ln. $header_f1 must be in CAPITAL"
return
fi
# Needed article content
if ! [[ `grep -E " $header_f1|$header_f1 " "$article_tmp_post"` ]];then
log__add -e -C -A \
"Line $ln. No content (abbr): '$header_f1'"
return
fi
}
#======================================================================
# Check content article : TITLES (#1-6)
# $1: $article_tmp_post
#======================================================================
check__titles() {
stat_titles=0
while IFS=: read -r "ln" "content"
do
article__line # count new ln
tc=${content:3} # Title content
if ! [[ "$tc" ]];then
log__add -e -C -A \
"Line $ln. Title is empty"
fi
tn=${content:1:1} # Title number
case "$tn" in
[1-6]) ((stat_titles++)) ;;
*)
log__add -e -C -A \
"Line $ln. Title mismatch '$tn' ; Use 1-6"
;;
esac
done < <(grep -n '^#' "$1" | grep -v '# ')
}
#======================================================================
# Check content article : PARAGRAPHS
# $1: $article_tmp_post
#======================================================================
check__paragraphs() {
stat_p_start=`grep -E "^\($|^\( " "$1" | wc -l`
stat_p_close=`grep -E "^\)$" "$1" | wc -l`
# Not paired
if ! [[ $stat_p_start == $stat_p_close ]];then
log__add -e -C -A \
"Paragraphs mismatch: '('=$stat_p_start ; ')'=$stat_p_close"
elif (( $stat_p_start == 0 ));then
stat_paragraphs=0
log__add -w -C -A \
"No paragraphs. To set one: '(' and ')' at begining lines"
else
stat_paragraphs=$stat_p_start
fi
}
#======================================================================
# Check content article : QUOTES
# $1: $article_tmp_post
#======================================================================
check__quotes() {
stat_q_nbr=`grep -E "^---$|^--- " "$1" | wc -l`
stat_q_paired=$(( stat_q_nbr % 2 ))
# Not paired
if ! [[ "$stat_q_paired" -eq 0 ]];then
log__add -e -C -A \
"Quotes mismatch: '---' not paired"
return
fi
# Stats
stat_quotes=$(( stat_q_nbr / 2 ))
}
#======================================================================
# Check content article : LISTS
# $1: $article_tmp_post
#======================================================================
check__lists() {
stat_l_start=`grep -E "^<<" "$1" | wc -l`
stat_l_close=`grep -E "^>>" "$1" | wc -l`
# Not paired
if ! [[ $stat_l_start == $stat_l_close ]];then
log__add -e -C -A \
"Lists mismatch: '('=$stat_p_start ; ')'=$stat_p_close"
return
fi
# Mismatch content after first marker list <<
if (( $stat_l_close >= 1 ));then
while read -r "ln" "content"
do
article__line # count new ln
if ! [[ `grep -E '^\=|^\+' <<<"$content"` ]];then
log__add -e -C -A \
"Line $ln. Lists mismatch: '$content' not '=' or '+'"
break
fi
done < <(awk '/^<</{f=1;next} /^>>/{f=0} f {print NR,$1}' "$1")
fi
[[ $stl_error ]] && return
# Stats
stat_lists=$stat_l_start
}
#======================================================================
# Check content article : ICODES
# $1: $article_tmp_post
#======================================================================
check__icodes() {
while IFS=: read -r 'ln' 'line'
do
article__line
stat_icode_start=`grep -o '_\`' <<<"$line" | wc -l`
stat_icode_close=`grep -o '\`_' <<<"$line" | wc -l`
if (( stat_icode_start != $stat_icode_close ));then
log__add -e -C -A \
"Line $ln. icodes mismatch: \
'\`_'=$stat_icode_start ; '_\`'=$stat_icode_close"
fi
done < <(grep -n '_`\|`_' "$1")
# Stats
[[ $stl_error ]] && return
article_icodes=`grep -o '\`_' "$1" | wc -l`
}
#======================================================================
# Check content article : STRONGS
# $1: $article_tmp_post
#======================================================================
check__strongs() {
while IFS=: read -r 'ln' 'line'
do
article__line
stat_strong_start=`grep -o '\*_' <<<"$line" | wc -l`
stat_strong_close=`grep -o '_\*' <<<"$line" | wc -l`
if (( stat_strong_start != $stat_strong_close ));then
log__add -e -C -A \
"Line $ln. strongs mismatch: \
'*_'=$stat_strong_start ; '_*'=$stat_strong_close"
fi
done < <(grep -n '\*_\|_\*' "$1")
# Stats
[[ $stl_error ]] && return
article_strongs=`grep -o '\*_' "$1" | wc -l`
}
#======================================================================
# Check content article : BOLDS
# $1: $article_tmp_post
#======================================================================
check__bolds() {
while IFS=: read -r 'ln' 'line'
do
article__line
stat_bold_start=`grep -o '+_' <<<"$line" | wc -l`
stat_bold_close=`grep -o '_+' <<<"$line" | wc -l`
if (( stat_bold_start != $stat_bold_close ));then
log__add -e -C -A \
"Line $ln. bolds mismatch: \
'+_'=$stat_bold_start ; '_+'=$stat_bold_close"
fi
done < <(grep -n '+_\|_+' "$1")
# Stats
[[ $stl_error ]] && return
article_bolds=`grep -o '+_' "$1" | wc -l`
}
#======================================================================
# Check content article : EMPHASIS
# $1: $article_tmp_post
#======================================================================
check__emphasis() {
while IFS=: read -r 'ln' 'line'
do
article__line
stat_em_start=`grep -o '\\\_' <<<"$line" | wc -l`
stat_em_close=`grep -o '_\\\' <<<"$line" | wc -l`
if (( stat_em_start != $stat_em_close ));then
log__add -e -C -A \
"Line $ln. emphasis mismatch: \
'\\_'=$stat_em_start ; '_\\'=$stat_em_close"
fi
done < <(grep -n '\\_\|_\\' "$1")
# Stats
[[ $stl_error ]] && return
article_emphasis=`grep -o '\\\_' "$1" | wc -l`
}
#======================================================================
# Check content article : CROSS
# $1: $article_tmp_post
#======================================================================
check__cross() {
while IFS=: read -r 'ln' 'line'
do
article__line
stat_cross_start=`grep -o '×_' <<<"$line" | wc -l`
stat_cross_close=`grep -o '_×' <<<"$line" | wc -l`
if (( stat_cross_start != $stat_cross_close ));then
log__add -e -C -A \
"Line $ln. cross mismatch: \
'×_'=$stat_cross_start ; '_×'=$stat_cross_close"
fi
done < <(grep -n '×_\|_×' "$1")
# Stats
[[ $stl_error ]] && return
article_cross=`grep -o '×_' "$1" | wc -l`
}
#======================================================================
# Check content article : DELS
# $1: $article_tmp_post
#======================================================================
check__dels() {
while IFS=: read -r 'ln' 'line'
do
article__line
stat_del_start=`grep -o '~_' <<<"$line" | wc -l`
stat_del_close=`grep -o '_~' <<<"$line" | wc -l`
if (( stat_del_start != $stat_del_close ));then
log__add -e -C -A \
"Line $ln. dels mismatch: \
'~_'=$stat_del_start ; '_~'=$stat_del_close"
fi
done < <(grep -n '~_\|_~' "$1")
# Stats
[[ $stl_error ]] && return
article_dels=`grep -o '~_' "$1" | wc -l`
}

View File

@ -0,0 +1,262 @@
#!/bin/bash
# Name: Statique Littérateur
# Type: Manage HTML template
# file: manage__HTML
# Folder: /var/lib/stl/scripts/
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# HTML code for <header>
# You can edit this function
# header.html is used in create_HTML_page
#======================================================================
create__HTML_header() {
cat <<EOHEADER
<header id="${domain_css}_banner">
<div id="${domain_css}_site-logo">
<a href="/">
<img src="$sub_genuri_srv/template/$domain_logo"
alt="Logo: $domain_title"
title="Logo: $domain_title"/>
</a>
</div>
<div id="${domain_css}_site-title">
<h1 id="${domain_css}_site-name">
<a href="/"
title="$stl_welcome $domain_title">
$domain_title
</a>
</h1>
<h2 id="${domain_css}_site-description">$domain_about</h2>
</div>
</header>
EOHEADER
}
#======================================================================
# HTML code for <footer>
# Do not edit this function
# footer.html is created - IF NOT EXISTS
# Uri: $domain_dir_wip_tpl/footer.html
# (i.e. /var/www/DOMAIN/wip/template/)
#======================================================================
create__HTML_footer() {
cat <<EOFOOTER > "$domain_dir_wip_tpl/footer.html"
<footer id="${domain_css}_footer">
<h1>$stl_about $domain_title</h1>
<div id="${domain_css}_footer-infos">
<p>$site_about<p>
</div>
<div id="${domain_css}_footer-about">
<ul>
<li><a href="$domain_url"><b>$domain_title</b></a>: $domain_about</li>
<li>Contact: $domain_mail</li>
<li>Copyright: $domain_cr</li>
<li>$stl_gen: <a href="https://git.a-lec.org/echolib/stl" target="_blank"><b>STL: Statique Littérateur</b></a></li>
<li>RSS: <a type="application/rss+xml" href="$domain_url/rss.xml">$domain_url/rss.xml</a></li>
</ul>
</div>
</footer>
EOFOOTER
}
#======================================================================
# HTML code for <footer>
# Do not edit this function
# metas.html is created - IF NOT EXISTS
# Uri: $domain_dir_wip_tpl/metas.html
# (i.e. /var/www/DOMAIN/wip/template/)
#======================================================================
create__HTML_metas() {
cat <<EOMETAS > "$domain_dir_wip_tpl/metas.html"
<meta charset="UTF-8" />
<meta name='viewport' content="width=device-width, initial-scale=1.0">
<meta name='robots' content="all">
<meta name='medium' content='website'>
<meta name='revisit-after' content="3 days">
<meta name='language' content="$domaine_lang">
<meta name='reply-to' content="$domain_mail">
<meta name='copyright' content="$domain_cr">
EOMETAS
}
#======================================================================
# Translate some static words according to domain_lang
#======================================================================
create__HTML_translation() {
if [[ `grep -i "fr" <<<"$domain_lang"` ]];then
stl_welcome="Page d'accueil de"
stl_written="Écrit par"
stl_about=" À propos de"
stl_gen="Propulsé par"
stl_the="le"
stl_by="par"
stl_read="Lire l'article de"
stl_rss_info="Tous les titres de"
# Convert date from INT to shit FR format (Yes, i love it...)
stl_date_y=`awk -F- '{print $1}' <<<"$article_date"`
stl_date_m=`awk -F- '{print $2}' <<<"$article_date"`
stl_date_d=`awk -F- '{print $3}' <<<"$article_date"`
stl_date="$stl_date_d/$stl_date_m/$stl_date_y"
else
stl_welcome="Welcome page of"
stl_written="Written by"
stl_bout="About"
stl_gen="Generated with"
stl_the="The"
stl_by="by"
stl_read="Read the post of"
stl_rss_info="All titles from"
stl_date="${article_date}"
fi
}
#======================================================================
# Page Template
#======================================================================
create__HTML_page() {
create__HTML_translation
! [[ -f "$domain_dir_wip_tpl/metas.html" ]] \
&& create__HTML_metas
! [[ -f "$domain_dir_wip_tpl/footer.html" ]] \
&& create__HTML_footer
# Ceeate uri articl folders
mkdir -p "$domain_dir_wip/$article_dir_srv"
rsync -a "articles/$article_dir_srv/" "$domain_dir_wip/$article_dir_srv/"
cat <<EOPAGE > "$domain_dir_wip/$article_uri_srv"
<!DOCTYPE html>
<html lang="${domain_lang: :2}">
<head>
$(cat "$domain_dir_wip_tpl/metas.html")
<meta name='generator' content="STL: Statique Littérateur">
<meta name='title' content="$article_title | $site_title">
<meta name='author' content="$article_author">
<meta name='description' content="$article_info">
<meta name='keywords' content="$domain_tags,$article_tags">
<meta name='search_date' content="$article_date">
<link rel="alternate" type="application/rss+xml" href="$domain_url/rss.xml" title="RSS: $stl_rss_info $domain_title" />
<link rel="stylesheet" media="screen" href="$sub_genuri_srv/templates/styles.css" />
<link rel="shortcut icon" type="image/png" href="$sub_genuri_srv/templates/favicon.png" />
<link rel='me' type='text/html' href="$domain_ext_url">
<title>$article_title - $domain_title</title>
</head>
<body id="${domain_css}_body $database_id">
$(create__HTML_header)
<section id="${domain_css}_page-wrapper">
<article id="${domain_css}_article ">
<div id="${domain_css}_metas">
<p id="${domain_css}_auteur">$stl_written <strong>$article_author</strong> $stl_the $stl_date</p>
</div>
$(cat "$article_tmp_post")
</article>
<aside id="${domain_css}_sidebar">
<div class="${domain_css}_wrapper" role="navigation">
<nav id="${domain_css}_latest-posts">
<h1 class="${domain_css}_latest-posts">$domain_sidebar_title</h1>
<ul class="${domain_css}_latest-posts"
aria-label="$domain_sidebar_title">
<!--# include file="$sub_genuri_srv/templates/sidebar.html" -->
</ul>
</nav>
</div>
</aside>
</section>
$(cat "$domain_dir_wip_tpl/footer.html")
</body>
</html>
EOPAGE
}
#======================================================================
# ATOM/RSS Creator
# File is at root wip server ; filename=rss.xml
# reverse sort time from DB | newest first
#======================================================================
create__RSS_feed() {
create__HTML_translation
rss_file="$domain_dir_wip/rss.xml"
cat <<EORSS > "$rss_file"
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>$domain_title - $domain_name - Flux RSS 2.0</title>
<link>$domain_url</link>
<description>$stl_rss_info $domain_title</description>
<language>$domain_lang</language>
<lastBuildDate>$(date)</lastBuildDate>
<copyright>$domain_cr</copyright>
<webMaster>$domain_mail</webMaster>
<generator>STL: Statique Littérateur</generator>
EORSS
while IFS=: read -r 'file' 'timestamp'
do
source "$file"
! [[ $article_wip_hash -gt 0 ]] \
&& continue
cat <<EOITEM >> "$rss_file"
<item>
<title>$article_title</title>
<link>$domain_url$article_uri_srv</link>
<guid>$domain_url$article_uri_srv</guid>
<pubDate>$(date -d @$article_timestamp)</pubDate>
<description>$article_about</description>
<author>$article_author</author>
</item>
EOITEM
done < <(grep -H "article_timestamp" "$domain_db_articles/"*.db \
| sort -t= -k2r)
cat <<EORSS >> "$rss_file"
</channel>
</rss>
EORSS
this_article="$rss_file"
log__add -i -M RSS "Created feed"
}
#======================================================================
# Sync WIp to WWW
# Before sync, create RSS FEED in wip
#======================================================================
sync_wip_to_www() {
domain__get
[[ $stl_install == "local" ]] \
&& echo "! $stl_install Installation. Useless sync" \
&& return
create__RSS_feed
rsync -a --exclude ".*" "$domain_dir_wip/" "$domain_dir_www/"
this_article="$domain_dir_www"
log__add -i -M WWW "Synced WIP server to WWW server"
}

View File

@ -0,0 +1,170 @@
#!/bin/bash
# Name: Statique Littérateur
# Type: Article manager
# file: manage__articles
# Folder: /var/lib/stl/scripts/
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# Argument read
# $1: read
# $2: argument
#======================================================================
read__OPTIONS() {
! [[ "$2" ]] \
&& noarg "Cannot be empty"
case "$2" in
*".stl")
article__hash "$2"
if__file "$uri_article" read
;;
conf)
domain__get
if__file "$stl_file_pwd_conf" read
;;
*)
noarg "$2"
;;
esac
}
#======================================================================
# Argument read
# $1: edit
# $2: argument
#======================================================================
edit__OPTIONS() {
! [[ "$2" ]] \
&& noarg "Cannot be empty"
case "$2" in
*".stl")
article__hash "$2"
nano --linenumbers "$uri_article"
;;
conf)
domain__get
domain__OPTIONS "nc" "edit"
;;
*)
noarg "$2"
;;
esac
}
#======================================================================
# Split article in 2 files : metas + content
# Get begining article content line
# $1: article > $uri_article
#======================================================================
split_article() {
article_tmp_head=`mktemp` # Metas
article_tmp_post=`mktemp` # Content
article_begin=`
grep -n "^-----" "$1" \
| head -n 1 \
| awk -F: '{print $1}'`
if ! [[ $article_begin ]];then
log__add -e -C -A \
"No separator before content: use '-----'"
return
fi
# Create file with metas only
awk -v end="$article_begin" \
'NR >=1 && NR < end-1 {print}' \
"$1" \
> "$article_tmp_head"
((article_begin++))
# Create file with content only
awk -v end="$article_begin" \
'NR >= end {print}' \
"$1" \
> "$article_tmp_post"
}
#======================================================================
# Get article line for article_tmp_post. Count from begin - 1
#======================================================================
article__line() {
ln=$(( ln + article_begin - 1 ))
}
#======================================================================
# Get article hash + article_db ID from uri
# $1: file *.stl from argument
#======================================================================
article__hash() {
domain__get
this_article="$1"
uri_article="$domain_dir_articles/$1"
if__file "$uri_article"
while read -r "H" "S" "U"
do
article_hash="$H"
article_size="$S"
article_id=`echo "$U" | cksum | awk '{print $1}'`
article_db="$article_id.db"
article_log="$article_id.log"
done < <(cksum "$uri_article")
}
#======================================================================
# Get values from OPTIONAL metas
# $1: marker
# $2: from split mktemp > $article_tmp_head
# $3: check | make
# $4: $article_tmp_post
#======================================================================
get__content_metas() {
unset meta
while IFS=: read -r "ln" "content"
do
meta=true
header_f0=`awk -F"$1" '{print $2}' <<<"$content"`
header_f1=`awk -F" : " '{print $1}' <<<"$header_f0"`
header_f2=`awk -F" : " '{print $2}' <<<"$header_f0"`
header_f3=`awk -F" : " '{print $3}' <<<"$header_f0"`
case "$3" in
check)
case "$1" in
"^link: ") check__link ;;
"^image: ") check__image ;;
"^code: ") check__precode ;;
"^brut: ") check__brut ;;
"^abbr: ") check__abbr ;;
"^file: ") check__link_file ;;
esac
;;
make)
case "$1" in
"^abbr: ") make__abbrs "$4" ;;
"^link: ") make__links "$4" ;;
"^file: ") make__links_file "$4" ;;
"^image: ") make__images "$4" ;;
"^code: ") make__precode "$4" ;;
"^brut: ") make__brut "$4" ;;
esac
;;
esac
done < <(grep -n "$1" "$2" )
}

View File

@ -0,0 +1,190 @@
#!/bin/bash
# Name: Statique Littérateur
# Type: Database manager
# file: manage__db
# Folder: /var/lib/stl/scripts/
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# argument: db
#======================================================================
db__OPTIONS() {
case "$2" in
*".stl")
unset article_log
article__hash "$2"
cat "$domain_db_articles/$article_db"
exit
;;
''|list)
db__list
;;
*)
noarg "$2"
;;
esac
}
#======================================================================
# - Check if db exists for this article
# - Source database
# - Compare article hash and chk one in db
# $1: article_db (ID from uri_article)
#======================================================================
if__article_db() {
db_file="$domain_db_articles/$1"
if [[ -f "$db_file" ]];then
source "$db_file"
compare__db
fi
}
# Compare article from DB
compare__db() {
if (( $article_hash == $article_chk_hash ));then
nocheck=true
else
need_check=true
fi
}
#======================================================================
# Print article datas in database
# db_file is URI/$article_db (from article_id)
# $1: $db_file
#======================================================================
db__print() {
if ! [[ -f "$db_file" ]];then
log__add -i -db $article_id \
"New, created"
else
log__add -i -db $article_id \
"Datas written"
fi
cat <<EODBPRINT > "$db_file"
# Database
database_id=$article_id
database_file='$article_id.db'
database_uri='$db_file'
# File metas
article_uri='$uri_article'
article_size=$article_size
# URI Server
article_dir_srv='$article_dir_srv'
article_page_srv='${article_name/.stl/.html}'
article_uri_srv='$article_dir_srv/$article_page_srv'
sub_genuri_srv='$suri'
# Statuses
$(
[[ $stl_error ]] \
&& echo "article_error='yes'" \
|| echo "article_error='no'"
)
article_chk_hash=$article_hash
article_wip_hash=$article_wip_hash
$(
[[ "$stl_install" == "server" ]] \
&& echo "article_www_hash=$article_www_hash"
)
sidebar_position=$sidebar_position
# Article Metas
article_date='$article_Date'
article_timestamp=$date_epoch
article_author="$article_Author"
article_title="$article_Title"
article_about="$article_About"
article_tags="$article_Tags"
# Include files
$(
cat "$article_tmp_db"
)
# Statistics
article_titles=$stat_titles
article_paragraphs=$stat_paragraphs
article_quotes=$stat_quotes
article_lists=$stat_lists
article_bolds=$article_bolds
article_strongs=$article_strongs
article_emphasis=$article_emphasis
article_icodes=$article_icodes
article_cross=$article_cross
article_dels=$article_dels
files_images=$stat_images
files_links=$stat_link_files
files_codes=$stat_codes
files_bruts=$stat_bruts
EODBPRINT
}
#======================================================================
# Print all databases in a table with article datas
#======================================================================
db__list() {
domain__get
db_tmp_list=`mktemp`
[[ "$stl_install" == "server" ]] \
&& echo "NBR|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR|WWW" \
>> "$db_tmp_list" \
|| echo "NBR|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR" \
>> "$db_tmp_list"
while read -r "db_file"
do
((db_nbr++))
source "$db_file"
[[ $article_chk_hash != $article_wip_hash ]] \
&& wip_status="${CY}$article_wip_hash${NC}" \
|| wip_status="$article_wip_hash"
[[ $article_error == "yes" ]] \
&& err_status="${CR}$article_error${NC}" \
|| err_status="$article_error"
printf '%s%s%s%b%s%s%s%b%s' \
"$db_nbr|" \
"$database_id|" \
"$article_title|" \
"$err_status|" \
"$article_date|" \
"$article_author|" \
"$article_chk_hash|" \
"$wip_status|" \
"$sidebar_position|" \
>> "$db_tmp_list"
if [[ "$stl_install" == "server" ]];then
printf '%s%s\n' \
"$article_www_hash" \
>> "$db_tmp_list"
fi
done < <(ls -1 "$domain_db_articles/"*.db 2>/dev/null)
(( `cat "$db_tmp_list" | wc -l` > 1 )) \
&& cat "$db_tmp_list" | column -t -s'|' -o ' '
rm -f "$db_rmp_list"
exit
}

View File

@ -0,0 +1,349 @@
#!/bin/bash
# Name: Statique Littérateur
# Type: Domain manager
# file: manage__domain
# Folder: /var/lib/stl/scripts/
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# --------------
# DOMAIN Section
# --------------
#======================================================================
#----------------------------------------------------------------------
# domain OPTIONS | Manage arguments from command line
# $1: main argument
# $2: change
#----------------------------------------------------------------------
domain__OPTIONS() {
domain_check=true
case "$2" in
'') ;;
new) domain_add=true; [[ "$3" ]] && domain_name="$3" ;;
edit) domain_edit=true ;;
*) noarg "$2" ;;
esac
domain__get
}
#----------------------------------------------------------------------
# Check for PWD config file and source
# Indepdant call: just source config domain file (exit, if not exists)
#----------------------------------------------------------------------
domain__get() {
if [[ -f "$stl_file_pwd_conf" ]];then
source "$stl_file_pwd_conf" # Source config PWD file
else
echo "# No domain set from this directory"
[[ $domain_add ]] && domain__set
[[ $domain_check ]] || exit # exit if domain__get call
fi
# From command line domain
if [[ $domain_check ]] && [[ $domain_name ]];then
[[ $domain_edit ]] \
&& nano "$stl_file_pwd_conf"
echo "# Domain set from this directory: $domain_name"
exit
fi
}
#----------------------------------------------------------------------
# New domain creation
# Create .stl.conf in PWD directoryy
# Register settings for domain
#----------------------------------------------------------------------
domain__set() {
if__writeable "$PWD"
# Check if anwser is not empty, else exit
# $1: answer
# ---------------------------------------
is__set() {
! [[ "$1" ]] \
&& echo "# Maybe later..." \
&& exit
}
# If DOMAIN already have protocol
# $1
# -------------------------------
is__protocol() {
[[ "${domain_name: -1}" == "/" ]] \
&& domain_name=${domain_name::-1}
# Confirm, configuration not already exists
if [[ -f "$stl_dir_db/$domain_name/$domain_name.conf" ]];then
source "$stl_dir_db/$domain_name/$domain_name.conf"
if [[ "$PWD" != "$conf_pwd" ]];then
echo "! A configuration for '$domain_name' exists in $pwd_conf"
exit
fi
fi
case "$domain_name" in
"http://"*)
domain_protocol="http://"
domain_name=${domain_name/$domain_protocol/}
;;
"https://"*)
domain_protocol="https://"
domain_name=${domain_name/$domain_protocol/}
;;
esac
if [[ "$domain_protocol" ]];then
domain_name=${domain_name/$domain_protocol/}
domain_ask+="$domain_name with protocol $domain_protocol"
else
read -rp "- Use 'https://' protocol (N for 'http://') ? " set_prot
case "$set_prot" in
Y) domain_protocol="https://" ;;
N) domain_protocol="http://" ;;
*) echo "# Maybe later...";exit ;;
esac
domain_ask+="$domain_name"
fi
}
# ----------
# Processing question to config domain
# ----------
echo -e "\n# You will be asked to confirm after resume"
# DOMAIN is set in command line ?
case "$domain_name" in
'')
read -rp "- Which domain to set ? " domain_name
is__set "$domain_name"
is__protocol
;;
*)
domain_ask="- Add your domain here: "
is__protocol
read -rp "$domain_ask (Y|*) ? " domain_confirm
case "$domain_confirm" in
Y) true ;;
*) echo "# Maybe later...";exit ;;
esac
;;
esac
# Where is the server ? /var/www ?
read -erp "- Where is your server URI ? " srv_uri
is__set "srv_uri"
[[ "${srv_uri: -1}" == "/" ]] \
&& srv_uri=${srv_uri::-1}
! [[ -d "$srv_uri" ]] \
&& echo "! Missing directory" \
&& exit
if__writeable "$srv_uri"
domain_srv="$srv_uri/$domain_name"
# Installation: server or local
read -rp "- STL server installed (Y|N for local ; use wip only) ? " install
case "$install" in
Y) stl_install="server" ;;
N) stl_install="local" ;;
*) echo "# Maybe later..." ;;
esac
# Domain TITLE
read -rp "- Domain Title ? " domain_title
is__set "$domain_title"
# Domain ABOUT
read -rp "- Domain About ? " domain_about
is__set "$domain_about"
# Domain LANG
read -rp "- Domain lang (i.e. fr) ? " domain_lang
is__set "$domain_lang"
# Domain MAIL
read -rp "- Domain mail ? " domain_mail
is__set "$domain_mail"
# Domain TAGS
read -rp "- Domain tags (comma separated) ? " domain_tags
is__set "$domain_tags"
# Domain TAGS
read -rp "- Domain copyright ? " domain_cr
is__set "$domain_cr"
# Domain SIDEBAR TITLE
read -rp "- Domain sidebar title ? " domain_sidebar_title
is__set "$domain_sidebar_title"
# Domain SIDEBAR TITLE
read -rp "- Domain sidebar items (1-24) ? " domain_sidebar_items
is__set "$domain_sidebar_items"
! [[ $domain_sidebar_items =~ ^[0-9]+$ ]] \
&& echo "! $domain_sidebar_items is not digits between 1-24" \
&& exit
! (( $domain_sidebar_items >= 1 && $domain_sidebar_items <= 24 )) \
&& echo "! $domain_sidebar_items is not between 1-24" \
&& exit
# Domain CSS PREFIX
read -rp "- Domain CSS prefix (alnum,-) ? " domain_css
is__set "$domain_css"
! [[ $domain_css =~ ^[a-zA-Z0-9_-]+$ ]] \
&& echo "! '$domain_css' is not alpha numeric. '-' is authorized" \
&& exit
case "${domain_css: -1}" in
"_"|"-") domain_css=${domain_css::-1} ;;
esac
domain_css=${domain_css,,}
# Domain LOGO
read -rp "- Domain logo filename ? " domain_logo
# External URL Profile
read -rp "- Domain external URL Profile ? " domain_ext_url
# Resume before writing conf
# ------
clear
echo -e "# Resume configuration...\n"
cat <<EODOMAINCONF
STL Inslallation : $stl_install
Domain Directory : $PWD
Domain : $domain_name
URL : $domain_protocol$domain_name
Server URI : $domain_srv
Title : $domain_title
About : $domain_about
Lang : $domain_lang
Mail : $domain_mail
Tags : $domain_tags
Copyright : $domain_cr
Sidebar Name : $domain_sidebar_title
Sidebar Items : $domain_sidebar_items
CSS prefix : $domain_css
Logo filename : $domain_logo
External URL Profile : $domain_ext_url
EODOMAINCONF
echo -e "! Use $domain_name only in $PWD"
read -rp "- Write to $PWD/.stl.conf ? " set_conf
case "$set_conf" in
Y) true ;;
*) echo "Maybe later...";exit ;;
esac
# -------------------
# Write configuration
# -------------------
mkdir -p "$stl_dir_db/$domain_name"
mkdir -p "$stl_dir_db/$domain_name/articles"
cat <<EODBCONF > "$stl_dir_db/$domain_name/$domain_name.conf"
conf_pwd="$PWD"
EODBCONF
cat <<EODOMAINCONF > "$stl_file_pwd_conf"
# Domain Configuration
domain_name="$domain_name"
domain_url="$domain_protocol$domain_name"
domain_srv="$domain_srv"
domain_title="$domain_title"
domain_about="$domain_about"
domain_lang="$domain_lang"
domain_logo="$domain_logo"
domain_mail="$domain_mail"
domain_tags="$domain_tags"
domain_cr="$domain_cr"
domain_sidebar_title="$domain_sidebar_title"
domain_sidebar_items=$domain_sidebar_items
domain_css="$domain_css"
domain_ext_url="$domain_ext_url"
# You must know what you do if you change from here...
# STL configurationn
stl_install="$stl_install"
domain_db_articles="$stl_dir_db/$domain_name/articles"
domain_conf="$PWD/$stl_file_pwd_conf"
# Domain directories for articles
domain_dir="$PWD"
domain_dir_articles="$PWD/articles"
domain_dir_images="$PWD/articles/images"
domain_dir_files="$PWD/articles/files"
# Domain directories for server
domain_dir_wip="$domain_srv/wip"
domain_dir_wip_tpl="$domain_srv/wip/template"
domain_dir_wip_images="$domain_srv/wip/images"
domain_dir_wip_files="$domain_srv/wip/files"
EODOMAINCONF
# Create a backup of the config in db
rsync -a "$PWD/$stl_file_pwd_conf" \
"$stl_dir_db/$domain_name/$stl_file_pwd_conf.bkp"
# Create folders base in PWD
mkdir -p "$PWD/articles"
mkdir -p "$PWD/articles/images"
mkdir -p "$PWD/articles/files"
# Create conf, according to installation (server, local)
case "$stl_install" in
server)
printf '%s\n%s\n%s\n%s\n' \
"domain_dir_www=\"$domain_srv/wip\"" \
"domain_dir_www_tpl=\"$domain_srv/www/template\"" \
"domain_dir_www_images=\"$domain_srv/www/images\"" \
"domain_dir_www_files=\"$domain_srv/www/files\"" \
>> "$stl_file_pwd_conf"
mkdir -p "$domain_srv/www"
mkdir -p "$domain_srv/www/template"
mkdir -p "$domain_srv/www/files"
mkdir -p "$domain_srv/www/images"
mkdir -p "$domain_srv/wip"
mkdir -p "$domain_srv/wip/template"
mkdir -p "$domain_srv/wip/files"
mkdir -p "$domain_srv/wip/images"
printf '%s%s\n\n' \
"! files template (logo, style.css...) must be put in " \
"$domain_srv/wip/template/"
;;
local)
mkdir -p "$domain_srv/www"
mkdir -p "$domain_srv/www/template"
mkdir -p "$domain_srv/www/files"
mkdir -p "$domain_srv/www/images"
printf '%s\n\n' \
"! You logo must be put in $domain_srv/www/template"
;;
esac
}

View File

@ -0,0 +1,111 @@
#!/bin/bash
# Name: Statique Littérateur
# Type: Logs Manager
# file: manage_logs
# Folder: /var/lib/stl/scripts/
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# Manage Arguments
#======================================================================
log__OPTIONS() {
! [[ "$2" ]] && article_log="stl.log"
while test "$2"
do
case "$2" in
*.log)
article_log=`basename "$2"`
;;
*".stl")
unset article_log
article__hash "$2"
;;
clean)
log_clean=true
[[ $from_stl || $from_id ]] || article_log="stl.log"
;;
*)
noarg "$2"
;;
esac
shift
done
! [[ -f "$stl_dir_log/$article_log" ]] \
&& echo "# Logs not found: $stl_dir_log/$article_log" \
&& exit
if [[ $log_clean ]];then
rm -f "$stl_dir_log/$article_log" && \
echo "# logs cleaned: $stl_dir_log/$article_log"
else
logs__print "$stl_dir_log/$article_log"
fi
exit
}
#======================================================================
# Add to log file $stl_file_log
#======================================================================
log__add() {
case "$1" in
-i) log_f1="$stl_log_i";CL=${NC} ;;
-w) log_f1="$stl_log_w";CL=${CY};stl_waring=true ;;
-e) log_f1="$stl_log_e";CL=${CR};stl_error=true ;;
*) log_f1="$1" ;;
esac
case "$2" in
-C) log_f2="Check" ;;
-M) log_f2="WIP" ;;
-S) log_f2="Sidebar" ;;
-db) log_f2="Database" ;;
*) log_f2="$2"
esac
case "$3" in
-Mti) log_f3="title:" ;;
-Mab) log_f3="about:" ;;
-Mau) log_f3="author:" ;;
-Mta) log_f3="tags:" ;;
-Mim) log_f3="image:" ;;
-Mda) log_f3="date:" ;;
-Mbr) log_f3="brut:" ;;
-Mpc) log_f3="code:" ;;
-Mlf) log_f3="file:" ;;
-Mlt) log_f3="link:" ;;
-M) log_f3="Metas" ;;
-A) log_f3="Article" ;;
*) log_f3="$3"
esac
printf '%b%s %s %-10s\t%-10s\t%-30s\t%s\t%s%b\n' \
"${CL}" \
"`date +%F' '%T`" \
"$log_f1" \
"$log_f2" \
"$log_f3" \
"$4" \
"$domain_name" \
"$this_article" \
"${NC}" \
>> "$stl_file_last_log"
}
#======================================================================
# Show logs by column
# $1: file
#======================================================================
logs__print() {
[[ -f "$1" ]] \
&& cat "$1" | column -t -s$'\t' -o' ' \
|| exit
}

View File

@ -0,0 +1,186 @@
#!/bin/bash
# Name: Statique Littérateur
# Type: Sidebar manager
# file: manage__sidebar
# Folder: /var/lib/stl/scripts/
# By echolib (XMPP: im@echolib.re)
# License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
#======================================================================
# Sidebar: Manage arguments
# Check Article, WIP and Position
#======================================================================
sidebar__OPTIONS() {
case "$2" in
create)
domain__get
sidebar__create_HTML
return
;;
add)
# Article
article__hash "$4"
# Database
db_file="$domain_db_articles/$article_id.db"
source "$db_file"
# Already in sidebar at same position
[[ "$3" == $sidebar_position ]] \
&& echo "! Article is in sidebar at same position: $3" \
&& return
# Already in sidebar, different position
[[ $sidebar_position ]] \
&& echo "! Article is in sidebar at position: $sidebar_position" \
&& return
# WIP check
! [[ $article_wip_hash -gt 0 ]] \
&& echo "! Article not yet converted in HTML (wip)" \
&& return
# Position. Must be 1 to max_items
if [[ "$3" == *[!0-9]* ]];then
[[ $sidebar ]] \
&& echo "Use position 1 to $domain_siddebar_items" \
|| noarg "$3" "Use position 1 to $domain_siddebar_items"
fi
if (( "$3" == 0 || "$3" > $domain_sidebar_items ));then
[[ $sidebar ]] \
&& echo "Use position 1 to $domain_siddebar_items" \
|| noarg "$3" "Use position 1 to $domain_siddebar_items"
fi
position="$3"
sidebar_HTML_item="$domain_dir_wip_tpl/.$3.sidebar"
;;
latest|oldest)
domain__get
;;
*)
noarg "$2" "Use: add,latest,oldest"
;;
esac
# Start process
sidebar__manage "$2" "$position" "$sidebar_HTML_item"
}
#======================================================================
# Sidebar: create /templates/sidebar.html
# $1: Process (add, replace...)
# $2: Position
# $3: file (.POS.sidebar) in wip template
#======================================================================
sidebar__manage() {
case "$1" in
latest|-l) sort_arg='-k2' ;;
oldest|-o) sort_arg='-k2r' ;;
esac
case "$1" in
latest|oldest)
sidebar_pos=0
while IFS=: read -r 'file' 'timestamp'
do
((position++))
(( $position > $domain_sidebar_items )) \
&& break
file=`basename "$file"`
db_file="$domain_db_articles/$file"
source "$db_file"
! [[ $article_wip_hash -gt 0 ]] \
&& continue
sidebar_HTML_item="$domain_dir_wip_tpl/.$position.sidebar"
sidebar__create_HTML_item "$sidebar_HTML_item"
done < <(grep -H "article_timestamp" "$domain_db_articles/"*.db \
| sort -t= $sort_arg )
;;
add)
sidebar__create_HTML_item "$3"
;;
esac
sidebar__create_HTML "$gsl_dir_domain_tpl/sidebar.html"
}
#======================================================================
# Called from sidebar__create in gsl__post_makers
# file: /var/lib/gsl/domains/DOMAIN/X-tra/sidebar/[POSITION].html
# You can edit this HTML code for your needs
# It can get all Values from Database post
# $1: file ($sidebar_HTML_item)
#======================================================================
sidebar__create_HTML_item() {
create__HTML_translation
cat <<EOSIDEBARITEM > "$1"
<li class="${domain_css}_list-post-item">
<a href="$article_uri_srv"
class="${domain_css}_list-post-link"
title="$stl_read $article_author: $article_title">
<span class="${domain_css}_list-post-title">$article_title</span>
<div class="${domain_css}_list-post-metas">
$stl_the $stl_date $stl_by $article_author
</div>
<div class="${domain_css}_list-post-info">
$article_about
</div>
</a>
</li>
EOSIDEBARITEM
# Log added
log__add -i -S -A "$article_title added to position: $position"
# Unset sidebar position in DB if an article is at position
db_file_sidebar=`
grep -H "sidebar_position=$position" \
"$domain_db_articles/"*.db \
| awk -F: '{print $1}'`
if [[ $db_file_sidebar ]];then
source "$db_file_sidebar"
sed -i "s^sidebar_position=.*^sidebar_position=^" "$db_file_sidebar"
log__add -w -S -A "$article_title removed from position: $position"
fi
# Add value to DB
sed -i "s^sidebar_position=.*^sidebar_position=$position^" "$db_file"
}
#======================================================================
# Create sidebar.html from files .1-max.sidebar
#======================================================================
sidebar__create_HTML() {
[[ -f "$domain_dir_wip_tpl/sidebar.html" ]] \
&& rm -f "$domain_dir_wip_tpl/sidebar.html"
for i in `seq 1 $domain_sidebar_items`
do
[[ -f "$domain_dir_wip_tpl/.$i.sidebar" ]] \
&& cat "$domain_dir_wip_tpl/.$i.sidebar" \
>> "$domain_dir_wip_tpl/sidebar.html"
done
this_article="$domain_dir_wip_tpl/sidebar.html"
log__add -i -S WIP "Created items from 1 to $domain_sidebar_items"
}

File diff suppressed because it is too large Load Diff

0
var/log/stl/.gitkeep Normal file
View File