Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Denis Salem
VenC
Commits
64b0894c
Commit
64b0894c
authored
Jan 02, 2019
by
Denis Salem
Browse files
wip on faq, refactor and add prompt
parent
f1116867
Changes
25
Hide whitespace changes
Inline
Side-by-side
VenC-site/entries/5__1-2-2019-7-43__F.A.Q
0 → 100644
View file @
64b0894c
authors
:
'
Denis
Salem
'
categories
:
''
tags
:
''
title
:
Foire
aux
questions
chapter
:
9
---
VENC
-
BEGIN
-
PREVIEW
---
---
VENC
-
END
-
PREVIEW
---
##
Pourquoi
VenC
n
'
est
officiellement
support
é
que
par
GNU
/
Linux
?
Et
bien
c
'
est
tr
è
s
simple
camarade
,
comme
dirait
Jean
-
Pierre
Coffe
,
_
Les
syst
è
mes
d
'
exploitations
propri
é
taires
,
c
'
est
de
la
merde
!_
##
Commande
introuvable
VenC
devrait
ê
tre
install
é
avec
[
pip
](
https
://
pypi.python.org
/
pypi
/
pip
)
,
dans
l
'
environment
python
,
c
ô
t
é
utilisateur
(
pas
dans
le
syst
è
me
donc
)
.
De
cette
fa
ç
on
le
syst
è
me
à
besoin
de
conna
î
tre
l
'
emplacement
de
VenC
,
dont
l
'
ex
é
cutable
devrait
se
trouver
dans
_~/
.local
/
bin_.
Sur
certaine
distribution
GNU
/
Linux
,
comme
[
Archlinux
](
https
://
www.archlinux.org
/
)
et
[
Gentoo
](
https
://
www.gentoo.org
/
)
,
la
variable
d
'
environnement
_
PATH_
peut
ê
tre
incompl
è
te
par
d
é
faut
,
ce
qui
produit
en
effet
une
erreur
type
_
commande
introuvable_.
Dans
ce
cas
,
vous
pouvez
ajouter
à
votre
_~/
.bashrc_
la
ligne
suivante
:
>
export
PATH
=$
PATH
:~/
.local
/
bin
Si
le
fichier
n
'
existe
pas
d
é
j
à
cependant
,
il
faudra
le
cr
é
er.
Apr
è
s
ç
a
,
tapez
dans
le
terminal
actif
>
source
~/
.bashrc
Et
voil
à
,
ç
a
devrait
ê
tre
bon
:
)
##
Erreurs
python
Normalement
VenC
g
è
re
toutes
les
erreurs
et
exceptions
de
sorte
de
ne
pas
interrompre
le
programme
ou
de
vous
aviser
du
probl
è
me
de
fa
ç
on
commode.
Si
malgr
é
tout
vous
obtenez
des
erreurs
c
'
est
probablement
que
votre
installation
n
'
est
pas
correct.
Cela
arrive
lorsque
VenC
est
install
é
avec
la
version
python
2
de
[
pip
](
https
://
pypi.python.org
/
pypi
/
pip
)
.
VenC
fonctionne
avec
python
3
,
il
faut
donc
installer
VenC
avec
pip3.
En
g
é
n
é
ral
,
la
version
de
[
pip
](
https
://
pypi.python.org
/
pypi
/
pip
)
que
vous
utilisez
par
d
é
faut
correspond
à
la
version
de
python
é
galement
utilis
é
par
d
é
faut
sur
votre
syst
è
me.
En
particulier
sur
les
syst
è
me
bas
é
s
sur
debian
,
vous
devrez
installer
pip3
>
sudo
apt
-
get
install
python3
-
pip
Apr
è
s
ç
a
,
d
é
sinstallez
VenC
avec
la
version
python
2
de
[
pip
](
https
://
pypi.python.org
/
pypi
/
pip
)
,
et
r
é
installez
VenC
avec
la
version
python
3
de
[
pip
](
https
://
pypi.python.org
/
pypi
/
pip
)
.
>
pip3
install
venc
--
user
Ç
a
devrait
le
faire
!
##
latex2mathml
semble
incomplet
ou
ne
fonctionne
pas
correctement.
C
'
est
fort
possible
en
effet
,
mais
ce
n
'
est
pas
du
ressort
de
VenC
dans
la
mesure
o
ù
cette
fonctionnalit
é
d
é
pend
d
'
une
[
tierce
librairie
](
https
://
github.com
/
Code
-
ReaQtor
/
latex2mathml
)
d
é
velopp
é
e
ind
é
pendament
de
VenC.
Cette
librairie
est
jeune
et
encore
en
d
é
veloppement.
Son
d
é
veloppeur
é
tant
tr
è
s
r
é
actif
,
si
quelque
chose
ne
fonctionne
pas
correctement
,
signalez
le
probl
è
me
sur
[
la
page
github
du
projet
](
https
://
github.com
/
Code
-
ReaQtor
/
latex2mathml
)
,
cela
devrait
ê
tre
alors
r
é
solu
relativement
rapidement
!
##
Je
n
'
arrive
pas
à
cr
é
er
de
sous
cat
é
gories
dans
ma
publication
!
Il
se
peut
qu
'
il
s
'
agisse
d
'
une
erreur
de
syntaxe.
Le
s
é
parateur
de
sous
cat
é
gorie
est
" > "
,
et
non
pas
">"
.
par
exemple
vous
devriez
avoir
quelque
chose
comme
>
categories
:
'
Acteurs
>
Jean
Rochefort
'
au
lieu
de
>
categories
:
'
Acteurs
>
Jean
Rochefort
'
##
Les
sous
r
é
pertoires
que
j
'
ai
d
é
finis
ne
fonctionne
pas.
V
é
rifiez
qu
'
aucuns
de
vos
sous
r
é
pertoires
d
é
finis
manuellement
dans
*
blog_configuration.yaml
*
ne
commencent
par
'/'.
Par
exemple
:
.:
CodeHighlight
::
Yaml
::
False
::
path
:
category_directory_name
:
'/
{
category
}
'
#
Incorrect
dates_directory_name
:
'%
m
-%
Y
'
#
Correct
dates_sub_folders
:
'/'
#
Incorrect
categories_sub_folders
:
''
#
Correct
entries_sub_folders
:
'
{
entry_title
}
'
#
Correct
:.
VenC-site/theme/chunks/entry.html
View file @
64b0894c
<div
id=
"entry-content"
>
<div
class=
"entry"
id=
"entry.:GetEntryID:."
data-venc-keywords=
".:ForEntryTags::{value}::,:."
data-venc-authors=
".:ForEntryAuthors::{value}::,:."
>
<h
2
><a
href=
".:GetEntryURL:."
>
.:GetEntryTitle:.
</a></h
2
>
<h
1
><a
href=
".:GetEntryURL:."
>
.:GetEntryTitle:.
</a></h
1
>
.:GetEntryContent:.
</div>
</div>
...
...
changelog.md
View file @
64b0894c
...
...
@@ -151,14 +151,14 @@
DONE | Infinite scroll use html anchor instead of harcoded indexing.
DONE | Prevent Infinite scroll to block when ressource isn't available.
DONE | Rewrite pattern processor unit tests.
DONE | fix FAQ latex2mathml is incomplete.
DONE | fix FAQ categories separator is ' > ', not '>'
DONE | fix FAQ subfolders must not start with '/'
WIP | fix FAQ https://stackoverflow.com/questions/14547631/python-locale-error-unsupported-locale-setting.
TODO | Open with navigator manual.
TODO | Client-side search engine.
TODO | Reorganize themes dependencies in setup (adding default templates, scripts, and pages to include).
TODO | Add relevant templates for themes.
TODO | fix FAQ https://stackoverflow.com/questions/14547631/python-locale-error-unsupported-locale-setting.
WIP | fix FAQ latex2mathml is incomplete.
WIP | fix FAQ categories separator is ' > ', not '>'
WIP | fix FAQ subfolders must not start with '/'
WIP | Change nomenclature: Most of the usual patterns are changed. Fix doc.
# version 2.x.x
...
...
src/venc2/commands/export.py
View file @
64b0894c
...
...
@@ -25,7 +25,7 @@ import subprocess
from
venc2.datastore
import
DataStore
from
venc2.datastore.theme
import
themes_descriptor
from
venc2.datastore.theme
import
Theme
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
notify
from
venc2.helpers
import
rm_tree_error_handler
from
venc2.helpers
import
keep_appart_from_markup
from
venc2.l10n
import
messages
...
...
src/venc2/commands/install.py
View file @
64b0894c
...
...
@@ -22,8 +22,8 @@ import os
import
shutil
from
venc2.datastore.configuration
import
get_blog_configuration
from
venc2.
helpers
import
notify
from
venc2.
helpers
import
die
from
venc2.
prompt
import
notify
from
venc2.
prompt
import
die
from
venc2.l10n
import
messages
def
install_theme
(
argv
):
...
...
src/venc2/commands/new.py
View file @
64b0894c
...
...
@@ -25,13 +25,11 @@ import subprocess
from
venc2.datastore.configuration
import
get_blog_configuration
from
venc2.datastore.entry
import
yield_entries_content
from
venc2.
helpers
import
notify
from
venc2.
helpers
import
die
from
venc2.
prompt
import
notify
from
venc2.
prompt
import
die
from
venc2.l10n
import
messages
import
venc2.datastore.entry
as
Entry
import
venc2.patterns
as
Pattern
import
venc2.helpers
as
Helpers
# Hold methods associated to patterns
class
MinimalEntry
:
...
...
src/venc2/commands/print.py
View file @
64b0894c
...
...
@@ -18,9 +18,10 @@
# along with VenC. If not, see <http://www.gnu.org/licenses/>.
from
venc2.datastore.theme
import
themes_descriptor
from
venc2.
helpers
import
msg_format
from
venc2.
prompt
import
msg_format
from
venc2.l10n
import
messages
;
from
venc2
import
venc_version
def
print_version
(
argv
):
print
(
"VenC"
,
venc_version
)
...
...
src/venc2/commands/remote.py
View file @
64b0894c
...
...
@@ -23,8 +23,8 @@ import socket
import
getpass
from
venc2.datastore.configuration
import
get_blog_configuration
from
venc2.
helpers
import
die
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
die
from
venc2.
prompt
import
notify
from
venc2.l10n
import
messages
def
remote_copy
(
argv
=
list
()):
...
...
src/venc2/commands/serv.py
View file @
64b0894c
...
...
@@ -3,8 +3,8 @@ import http.server
import
urllib.parse
from
venc2.datastore.configuration
import
get_blog_configuration
from
venc2.
helpers
import
die
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
die
from
venc2.
prompt
import
notify
from
venc2.l10n
import
messages
blog_configuration
=
get_blog_configuration
()
...
...
src/venc2/datastore/__init__.py
View file @
64b0894c
...
...
@@ -29,7 +29,7 @@ from venc2.datastore.entry import Entry
from
venc2.datastore.metadata
import
build_categories_tree
from
venc2.datastore.metadata
import
MetadataNode
from
venc2.datastore.metadata
import
Chapter
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
notify
from
venc2.l10n
import
messages
from
venc2.patterns.non_contextual
import
get_embed_content
from
venc2.patterns.exceptions
import
MalformedPatterns
...
...
src/venc2/datastore/configuration.py
View file @
64b0894c
...
...
@@ -20,8 +20,8 @@
import
os
import
yaml
from
venc2.
helpers
import
die
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
die
from
venc2.
prompt
import
notify
from
venc2.l10n
import
messages
def
get_blog_configuration
():
...
...
src/venc2/datastore/entry.py
View file @
64b0894c
...
...
@@ -24,8 +24,8 @@ import urllib.parse
import
yaml
from
venc2.
helpers
import
die
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
die
from
venc2.
prompt
import
notify
from
venc2.l10n
import
messages
from
venc2.datastore.metadata
import
build_categories_tree
...
...
src/venc2/datastore/metadata.py
View file @
64b0894c
...
...
@@ -20,7 +20,7 @@
import
datetime
import
urllib.parse
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
notify
class
Chapter
:
def
__init__
(
self
,
index
,
title
,
path
):
...
...
src/venc2/datastore/theme.py
View file @
64b0894c
...
...
@@ -18,7 +18,7 @@
# along with VenC. If not, see <http://www.gnu.org/licenses/>.
from
venc2.datastore.entry
import
EntryWrapper
from
venc2.
helpers
import
die
from
venc2.
prompt
import
die
from
venc2.l10n
import
messages
from
venc2.patterns.processor
import
ProcessedString
...
...
src/venc2/helpers.py
View file @
64b0894c
...
...
@@ -25,6 +25,8 @@ import pygments
import
shutil
from
venc2.l10n
import
messages
from
venc2.prompt
import
die
from
venc2.prompt
import
notify
class
GenericMessage
(
Exception
):
...
...
@@ -33,13 +35,6 @@ class GenericMessage(Exception):
keep_appart_from_markup
=
[
"CodeHighlight"
,
"Latex2MathML"
,
"IncludeFile"
,
"audio"
,
"video"
,
"EmbedContent"
]
msg_format
=
{
"END"
:
'
\033
[0m'
,
"GREEN"
:
'
\033
[92m'
,
"RED"
:
'
\033
[91m'
,
"YELLOW"
:
'
\033
[33m'
}
# hold error messages
errors
=
list
()
...
...
@@ -53,29 +48,6 @@ def handle_malformed_patterns(e):
die
(
messages
.
malformed_patterns_missing_closing_symbols
.
format
(
e
.
ressource
))
die
(
messages
.
malformed_patterns_missing_opening_symbols
.
format
(
e
.
ressource
))
# Some data printed out may exceed few lines so
# it's nicer to highlight specific part of the output
def
highlight_value
(
text
,
value
,
color
=
"RED"
):
return
text
.
replace
(
value
,
msg_format
[
color
]
+
value
+
msg_format
[
"END"
]
)
# Terminate nicely with notification
def
die
(
msg
,
color
=
"RED"
,
extra
=
""
):
notify
(
msg
,
color
)
if
extra
!=
""
:
print
(
extra
)
exit
()
# Being verborse is nice, with colours it's better
def
notify
(
msg
,
color
=
"GREEN"
):
print
(
get_formatted_message
(
msg
,
color
))
# Take care of setting up colours in printed out message
def
get_formatted_message
(
msg
,
color
=
"GREEN"
,
prompt
=
"VenC: "
):
return
msg_format
[
color
]
+
"
\033
[1m"
+
prompt
+
"
\033
[0m"
+
msg_format
[
color
]
+
msg
+
msg_format
[
"END"
]
def
orderable_str_to_int
(
string
):
try
:
return
int
(
string
)
...
...
src/venc2/l10n/__init__.py
View file @
64b0894c
...
...
@@ -18,12 +18,14 @@
# along with VenC. If not, see <http://www.gnu.org/licenses/>.
import
locale
from
venc2.prompt
import
notify
try
:
current_locale
=
locale
.
getlocale
()[
0
].
split
(
'_'
)[
0
]
locale_err
=
False
except
:
except
locale
.
Error
as
e
:
notify
(
e
.
args
,
color
=
"YELLOW"
)
current_locale
=
'en'
locale_err
=
True
...
...
src/venc2/patterns/code_highlight.py
View file @
64b0894c
...
...
@@ -21,8 +21,8 @@ import os
import
pygments.lexers
import
pygments.formatters
from
venc2.
helpers
import
die
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
die
from
venc2.
prompt
import
notify
from
venc2.l10n
import
messages
""" Need to handle missing args in case of unknown number of args """
...
...
src/venc2/patterns/non_contextual.py
View file @
64b0894c
...
...
@@ -26,7 +26,7 @@ from venc2.l10n import messages
from
venc2.patterns.exceptions
import
PatternInvalidArgument
from
venc2.patterns.exceptions
import
PatternMissingArguments
from
venc2.helpers
import
GenericMessage
from
venc2.
helpers
import
notify
from
venc2.
prompt
import
notify
from
urllib.parse
import
urlparse
def
try_oembed
(
providers
,
url
):
...
...
src/venc2/patterns/processor.py
View file @
64b0894c
...
...
@@ -24,10 +24,10 @@ from copy import deepcopy
from
docutils.core
import
publish_parts
from
docutils.utils
import
SystemMessage
from
venc2.
helpers
import
get_formatted_message
from
venc2.
helpers
import
highlight_value
from
venc2.
helpers
import
notify
from
venc2.
helpers
import
die
from
venc2.
prompt
import
get_formatted_message
from
venc2.
prompt
import
highlight_value
from
venc2.
prompt
import
notify
from
venc2.
prompt
import
die
from
venc2.helpers
import
remove_by_value
from
venc2.l10n
import
messages
from
venc2.patterns.exceptions
import
MalformedPatterns
...
...
src/venc2/prompt.py
0 → 100644
View file @
64b0894c
#! /usr/bin/python3
# Copyright 2016, 2018 Denis Salem
#
# This file is part of VenC.
#
# VenC is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# VenC 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with VenC. If not, see <http://www.gnu.org/licenses/>.
msg_format
=
{
"END"
:
'
\033
[0m'
,
"GREEN"
:
'
\033
[92m'
,
"RED"
:
'
\033
[91m'
,
"YELLOW"
:
'
\033
[33m'
}
# Some data printed out may exceed few lines so
# it's nicer to highlight specific part of the output
def
highlight_value
(
text
,
value
,
color
=
"RED"
):
return
text
.
replace
(
value
,
msg_format
[
color
]
+
value
+
msg_format
[
"END"
]
)
# Terminate nicely with notification
def
die
(
msg
,
color
=
"RED"
,
extra
=
""
):
notify
(
msg
,
color
)
if
extra
!=
""
:
print
(
extra
)
exit
()
# Being verborse is nice, with colours it's better
def
notify
(
msg
,
color
=
"GREEN"
):
print
(
get_formatted_message
(
msg
,
color
))
# Take care of setting up colours in printed out message
def
get_formatted_message
(
msg
,
color
=
"GREEN"
,
prompt
=
"VenC: "
):
return
msg_format
[
color
]
+
"
\033
[1m"
+
prompt
+
"
\033
[0m"
+
msg_format
[
color
]
+
msg
+
msg_format
[
"END"
]
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment