Skip to content
GitLab
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
391b6318
Commit
391b6318
authored
Feb 08, 2020
by
Denis Salem
Browse files
WIP on entries documentation, add CodeHighlightInclude
parent
6ca84aff
Changes
10
Hide whitespace changes
Inline
Side-by-side
VenC-site/entries/10__02-08-2020-18-32__Les_templates
0 → 100644
View file @
391b6318
authors: 'Denis Salem'
categories: ''
tags: ''
chapter: 4.4
title: Les templates
---VENC-BEGIN-PREVIEW---
---VENC-END-PREVIEW---
Un template est en fait une publication vierge qui a cependant été
préformatée pour contenir des choses redondante à rédiger ou
programmer manuellement. Typiquement, pour une Galerie, vous pourriez
vouloir un template qui contiendrait déjà la ou les balises Markdown pour inclure
une ou plusieurs images, les champs __categories__ et __tags__ préremplits, etc...
.:CodeHighlightInclude::Text::False::template_example:.
VenC est livrés avec des examples de templates. En voici la liste:
- .:DisableMarkup::example_code_highlight:.
- .:DisableMarkup::example_Escape:.
- .:DisableMarkup::example_Latex2MathML:.
- .:DisableMarkup::markdown_example_footnotes:.
- .:DisableMarkup::tessellation_example_display_title_in_entry:.
- .:DisableMarkup::tessellation_example_display_title_in_threads:.
_Parmis ces templates, certains servent surtout à illustrer l'usage
de certaine fonctionnalités de VenC._
VenC-site/entries/11__02-08-2020-19-17__Les_publications
0 → 100644
View file @
391b6318
authors: 'Denis Salem'
categories: ''
tags: ''
chapter: 4.3
title: Les publications
---VENC-BEGIN-PREVIEW---
---VENC-END-PREVIEW---
Une publication est un fichier dont le
propos est d'être remplit par l'utilisateur manuellement en y rédigeant
le contenu désiré. Cela peut-être un billet d'humeur, un article de fond,
une galerie d'image, etc. Pour faciliter l'édition de votre blog avec
VenC vous êtes fortement encouragé à utiliser des [templates](/Les-templates).
Le nom de fichier d'une publication est formaté de la façon suivante:
.:CodeHighlight::Text::False::
<id>__<mois>-<jour>-<année>-<heure>-<minute>__<titre>
:.
Une publication contient une premiere partie au format Yaml contenant les
métadonnées de la publication, puis une seconde au format Markdown qui
elle contiendra la publication à proprement parler. Cette seconde partie
est elle-même scindé en deux. L'une contiendra la prévisualisation de la
publication, et l'autre son véritable contenu.
Une publication vierge se présente de la façon suivante:
.:CodeHighlightInclude::Text::False::empty_entry:.
VenC-site/extra/venc_source_Text.css
0 → 100644
View file @
391b6318
.venc_source_Text
.hll
{
background-color
:
#ffffcc
}
.venc_source_Text
{
background
:
#f8f8f8
;
}
.venc_source_Text
.c
{
color
:
#408080
;
font-style
:
italic
}
/* Comment */
.venc_source_Text
.err
{
border
:
1px
solid
#FF0000
}
/* Error */
.venc_source_Text
.k
{
color
:
#008000
;
font-weight
:
bold
}
/* Keyword */
.venc_source_Text
.o
{
color
:
#666666
}
/* Operator */
.venc_source_Text
.ch
{
color
:
#408080
;
font-style
:
italic
}
/* Comment.Hashbang */
.venc_source_Text
.cm
{
color
:
#408080
;
font-style
:
italic
}
/* Comment.Multiline */
.venc_source_Text
.cp
{
color
:
#BC7A00
}
/* Comment.Preproc */
.venc_source_Text
.cpf
{
color
:
#408080
;
font-style
:
italic
}
/* Comment.PreprocFile */
.venc_source_Text
.c1
{
color
:
#408080
;
font-style
:
italic
}
/* Comment.Single */
.venc_source_Text
.cs
{
color
:
#408080
;
font-style
:
italic
}
/* Comment.Special */
.venc_source_Text
.gd
{
color
:
#A00000
}
/* Generic.Deleted */
.venc_source_Text
.ge
{
font-style
:
italic
}
/* Generic.Emph */
.venc_source_Text
.gr
{
color
:
#FF0000
}
/* Generic.Error */
.venc_source_Text
.gh
{
color
:
#000080
;
font-weight
:
bold
}
/* Generic.Heading */
.venc_source_Text
.gi
{
color
:
#00A000
}
/* Generic.Inserted */
.venc_source_Text
.go
{
color
:
#888888
}
/* Generic.Output */
.venc_source_Text
.gp
{
color
:
#000080
;
font-weight
:
bold
}
/* Generic.Prompt */
.venc_source_Text
.gs
{
font-weight
:
bold
}
/* Generic.Strong */
.venc_source_Text
.gu
{
color
:
#800080
;
font-weight
:
bold
}
/* Generic.Subheading */
.venc_source_Text
.gt
{
color
:
#0044DD
}
/* Generic.Traceback */
.venc_source_Text
.kc
{
color
:
#008000
;
font-weight
:
bold
}
/* Keyword.Constant */
.venc_source_Text
.kd
{
color
:
#008000
;
font-weight
:
bold
}
/* Keyword.Declaration */
.venc_source_Text
.kn
{
color
:
#008000
;
font-weight
:
bold
}
/* Keyword.Namespace */
.venc_source_Text
.kp
{
color
:
#008000
}
/* Keyword.Pseudo */
.venc_source_Text
.kr
{
color
:
#008000
;
font-weight
:
bold
}
/* Keyword.Reserved */
.venc_source_Text
.kt
{
color
:
#B00040
}
/* Keyword.Type */
.venc_source_Text
.m
{
color
:
#666666
}
/* Literal.Number */
.venc_source_Text
.s
{
color
:
#BA2121
}
/* Literal.String */
.venc_source_Text
.na
{
color
:
#7D9029
}
/* Name.Attribute */
.venc_source_Text
.nb
{
color
:
#008000
}
/* Name.Builtin */
.venc_source_Text
.nc
{
color
:
#0000FF
;
font-weight
:
bold
}
/* Name.Class */
.venc_source_Text
.no
{
color
:
#880000
}
/* Name.Constant */
.venc_source_Text
.nd
{
color
:
#AA22FF
}
/* Name.Decorator */
.venc_source_Text
.ni
{
color
:
#999999
;
font-weight
:
bold
}
/* Name.Entity */
.venc_source_Text
.ne
{
color
:
#D2413A
;
font-weight
:
bold
}
/* Name.Exception */
.venc_source_Text
.nf
{
color
:
#0000FF
}
/* Name.Function */
.venc_source_Text
.nl
{
color
:
#A0A000
}
/* Name.Label */
.venc_source_Text
.nn
{
color
:
#0000FF
;
font-weight
:
bold
}
/* Name.Namespace */
.venc_source_Text
.nt
{
color
:
#008000
;
font-weight
:
bold
}
/* Name.Tag */
.venc_source_Text
.nv
{
color
:
#19177C
}
/* Name.Variable */
.venc_source_Text
.ow
{
color
:
#AA22FF
;
font-weight
:
bold
}
/* Operator.Word */
.venc_source_Text
.w
{
color
:
#bbbbbb
}
/* Text.Whitespace */
.venc_source_Text
.mb
{
color
:
#666666
}
/* Literal.Number.Bin */
.venc_source_Text
.mf
{
color
:
#666666
}
/* Literal.Number.Float */
.venc_source_Text
.mh
{
color
:
#666666
}
/* Literal.Number.Hex */
.venc_source_Text
.mi
{
color
:
#666666
}
/* Literal.Number.Integer */
.venc_source_Text
.mo
{
color
:
#666666
}
/* Literal.Number.Oct */
.venc_source_Text
.sa
{
color
:
#BA2121
}
/* Literal.String.Affix */
.venc_source_Text
.sb
{
color
:
#BA2121
}
/* Literal.String.Backtick */
.venc_source_Text
.sc
{
color
:
#BA2121
}
/* Literal.String.Char */
.venc_source_Text
.dl
{
color
:
#BA2121
}
/* Literal.String.Delimiter */
.venc_source_Text
.sd
{
color
:
#BA2121
;
font-style
:
italic
}
/* Literal.String.Doc */
.venc_source_Text
.s2
{
color
:
#BA2121
}
/* Literal.String.Double */
.venc_source_Text
.se
{
color
:
#BB6622
;
font-weight
:
bold
}
/* Literal.String.Escape */
.venc_source_Text
.sh
{
color
:
#BA2121
}
/* Literal.String.Heredoc */
.venc_source_Text
.si
{
color
:
#BB6688
;
font-weight
:
bold
}
/* Literal.String.Interpol */
.venc_source_Text
.sx
{
color
:
#008000
}
/* Literal.String.Other */
.venc_source_Text
.sr
{
color
:
#BB6688
}
/* Literal.String.Regex */
.venc_source_Text
.s1
{
color
:
#BA2121
}
/* Literal.String.Single */
.venc_source_Text
.ss
{
color
:
#19177C
}
/* Literal.String.Symbol */
.venc_source_Text
.bp
{
color
:
#008000
}
/* Name.Builtin.Pseudo */
.venc_source_Text
.fm
{
color
:
#0000FF
}
/* Name.Function.Magic */
.venc_source_Text
.vc
{
color
:
#19177C
}
/* Name.Variable.Class */
.venc_source_Text
.vg
{
color
:
#19177C
}
/* Name.Variable.Global */
.venc_source_Text
.vi
{
color
:
#19177C
}
/* Name.Variable.Instance */
.venc_source_Text
.vm
{
color
:
#19177C
}
/* Name.Variable.Magic */
.venc_source_Text
.il
{
color
:
#666666
}
/* Literal.Number.Integer.Long */
\ No newline at end of file
VenC-site/includes/empty_entry
View file @
391b6318
authors: '
Denis Salem
'
categories: '
Photographies > Nature
'
tags: '
Forêt, Champignons
'
title:
Champignons trop mignons (Mais pas commestible, alors calme toi)
authors: ''
categories: ''
tags: ''
title:
---VENC-BEGIN-PREVIEW---
---VENC-END-PREVIEW---

VenC-site/includes/template_example
0 → 100644
View file @
391b6318
authors: 'Denis Salem'
categories: 'Photographies > Nature'
tags: 'Forêt, Champignons'
title: Champignons trop mignons (Mais pas commestible, alors calme toi)
---VENC-BEGIN-PREVIEW---
---VENC-END-PREVIEW---

changelog.md
View file @
391b6318
...
...
@@ -166,8 +166,8 @@
DONE | Fix and clean Tessellation theme.
DONE | Add IfInMainThread pattern.
DONE | Make entry URL nicer when filename is index.html and has subfolder.
TODO | Use built in list in yaml instead to turn str to list
.
TODO | Fix url with special char in chapter.
DONE | Fix url with special char in chapter
.
DONE | Add CodeHighlightInclude
WIP | Reorganize themes dependencies in setup.
TODO | Include threads preview in entry
TODO | Add command for reorder entries by criteria
...
...
@@ -177,6 +177,7 @@
TODO | Change nomenclature: Most of the usual patterns are changed. Fix doc.
# version 2.1.x
TODO | Use built in list in yaml instead to turn str to list.
TODO | Allow markdown2 setup.
TODO | Add --insert-chapter command.
TODO | Warn about metadata that should be list but are str.
...
...
src/venc2/patterns/code_highlight.py
View file @
391b6318
...
...
@@ -22,9 +22,10 @@ import os
import
pygments.lexers
import
pygments.formatters
from
venc2.l10n
import
messages
from
venc2.patterns.non_contextual
import
include_file
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 """
class
CodeHighlight
:
...
...
@@ -46,15 +47,22 @@ class CodeHighlight:
stream
=
open
(
os
.
getcwd
()
+
"/extra/"
+
key
,
'w'
)
stream
.
write
(
self
.
_includes
[
key
])
def
highlight
(
self
,
argv
):
def
highlight_include
(
self
,
argv
):
string
=
include_file
([
argv
[
2
]])
return
self
.
highlight
(
argv
[:
2
]
+
[
string
],
included_file
=
True
)
def
highlight
(
self
,
argv
,
included_file
=
False
):
try
:
name
=
"venc_source_"
+
argv
[
0
].
replace
(
'+'
,
'Plus'
)
lexer
=
pygments
.
lexers
.
get_lexer_by_name
(
argv
[
0
],
stripall
=
True
)
formatter
=
pygments
.
formatters
.
HtmlFormatter
(
linenos
=
(
True
if
argv
[
1
]
==
"True"
else
False
),
cssclass
=
name
)
code
=
"::"
.
join
(
argv
[
2
:])
result
=
"<div class=
\"
__VENC_PYGMENTIZE_WRAPPER__
\"
>"
+
pygments
.
highlight
(
code
.
replace
(
"\:"
,
":"
),
lexer
,
formatter
).
replace
(
".:"
,
".:"
)
+
"</div>"
if
not
included_file
:
code
=
"::"
.
join
(
argv
[
2
:])
else
:
code
=
argv
[
2
]
result
=
"<div class=
\"
__VENC_PYGMENTIZE_WRAPPER__
\"
>"
+
pygments
.
highlight
(
code
.
replace
(
"\:"
,
":"
),
lexer
,
formatter
).
replace
(
".:"
,
".:"
).
replace
(
":."
,
":."
)
+
"</div>"
css
=
formatter
.
get_style_defs
()
if
not
name
+
".css"
in
self
.
_includes
.
keys
():
...
...
src/venc2/patterns/non_contextual.py
View file @
391b6318
...
...
@@ -99,7 +99,7 @@ def set_style(argv):
return
"<span "
+
ID
+
' '
+
CLASS
+
">"
+
(
'::'
.
join
(
argv
[
2
:]))
+
"</span>"
"""
Must fix dirty try/except structure.
"""
# TODO:
Must fix dirty try/except structure.
def
include_file
(
argv
):
try
:
filename
=
argv
[
0
]
...
...
src/venc2/patterns/patterns_map.py
View file @
391b6318
...
...
@@ -72,6 +72,7 @@ class PatternsMap():
"GetEmbedContent"
:
datastore
.
wrapper_embed_content
,
"GetGenerationTimestamp"
:
datastore
.
get_generation_timestamp
,
"CodeHighlight"
:
code_highlight
.
highlight
,
"CodeHighlightInclude"
:
code_highlight
.
highlight_include
,
"Latex2MathML"
:
Latex2MathML
,
"GetVenCVersion"
:
get_venc_version
,
"IncludeFile"
:
include_file
,
...
...
src/venc2/patterns/processor.py
View file @
391b6318
...
...
@@ -155,7 +155,12 @@ class ProcessedString():
self
.
len_close_pattern_pos
=
len
(
self
.
close_pattern_pos
)
if
self
.
len_open_pattern_pos
!=
self
.
len_close_pattern_pos
:
raise
MalformedPatterns
(
self
.
len_open_pattern_pos
>
self
.
len_close_pattern_pos
,
False
,
ressource
)
notify
(
string
,
color
=
"RED"
)
if
(
self
.
len_open_pattern_pos
>
self
.
len_close_pattern_pos
):
die
(
messages
.
malformed_patterns_missing_closing_symbols
.
format
(
ressource
))
else
:
die
(
messages
.
malformed_patterns_missing_closing_symbols
.
format
(
ressource
))
self
.
string
=
string
self
.
ressource
=
ressource
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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