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
00d4d5b8
Commit
00d4d5b8
authored
Jul 08, 2019
by
Denis Salem
Browse files
add default include files in theme deps, update gentle theme accordingly
parent
ae96abed
Changes
8
Hide whitespace changes
Inline
Side-by-side
changelog.md
View file @
00d4d5b8
...
...
@@ -159,7 +159,7 @@ cd # version 1.0.0 Last minute edition :p
DONE | Fix Shabang issue for compatibility.
DONE | Semantic-web features.
DONE | Theme must have it's own yaml configuration.
DONE
| Reorganize themes dependencies in setup.
WIP
| Reorganize themes dependencies in setup.
DONE | Fix pattern processing within included file.
TODO | Fix Tessellation CSS
WIP | Add relevant templates for themes.
...
...
src/setup.py
View file @
00d4d5b8
...
...
@@ -44,6 +44,7 @@ for theme in themes:
extra_files
.
append
((
expanduser
(
'~'
)
+
"/.local/share/VenC/embed_providers/"
,
[
"share/embed_providers/oembed.json"
]))
extra_files
.
append
((
expanduser
(
'~'
)
+
"/.local/share/VenC/themes_assets"
,
[
"share/themes_assets/"
+
filename
for
filename
in
listdir
(
"share/themes_assets"
)])
)
extra_files
.
append
((
expanduser
(
'~'
)
+
"/.local/share/VenC/themes_includes"
,
[
"share/themes_includes/"
+
filename
for
filename
in
listdir
(
"share/themes_includes"
)])
)
setup
(
name
=
'VenC'
,
...
...
src/share/themes/gentle/assets/style.css
View file @
00d4d5b8
...
...
@@ -26,6 +26,10 @@ h1
math
{
display
:
block
;}
/**************/
/* VENC BOXES */
/**************/
.venc_info_box
,
.venc_warning_box
{
background-color
:
#91A8D0
;
color
:
white
;
...
...
@@ -45,6 +49,24 @@ math
background-color
:
#F7CAC9
;
}
/********/
/* NSFW */
/********/
.venc_nsfw
{
min-width
:
442px
;
min-height
:
228px
;
display
:
block
;
background-repeat
:
no-repeat
;
margin
:
auto
;
background-position
:
center
center
;}
.venc_nsfw
.venc_nsfw_content
{
display
:
none
;}
.venc_nsfw
:target
.venc_nsfw_content
{
display
:
block
;}
/***************/
/* H E A D E R */
/***************/
...
...
src/share/themes/gentle/config.yaml
View file @
00d4d5b8
...
...
@@ -3,6 +3,7 @@ info:
override
:
columns
:
1
nsfw_image
:
'
VenC
-
nsfw.png'
nsfw_image
:
'
VenC
_
nsfw.png'
dependencies
:
[
'
VenC-Infinite-Scroll-1.1.0.js'
,
'
VenC_nsfw.png'
,
'
VenC_info_icon1.png'
,
'
VenC_warning_icon1.png'
]
assets_dependencies
:
[
'
VenC-Infinite-Scroll-1.1.0.js'
,
'
VenC_nsfw.png'
,
'
VenC_info_icon1.png'
,
'
VenC_warning_icon1.png'
]
includes_dependencies
:
[
'
nsfw.html'
]
src/share/themes_assets/VenC_nsfw.png
View replaced file @
ae96abed
View file @
00d4d5b8
9.23 KB
|
W:
|
H:
9.65 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/share/themes_includes/nsfw.html
0 → 100644
View file @
00d4d5b8
<a
href=
"#venc_nsfw{venc_arg_1}"
id=
"venc_nsfw{venc_arg_1}"
class=
"venc_nsfw"
style=
"background-image: url('.:GetRelativeOrigin:..:GetBlogMetadataIfExists::nsfw_image::{value}:.');"
><div
class=
"venc_nsfw_content"
>
{venc_arg_2}
</div>
</a>
src/venc2/commands/export.py
View file @
00d4d5b8
...
...
@@ -30,6 +30,7 @@ from venc2.helpers import die
from
venc2.prompt
import
notify
from
venc2.helpers
import
rm_tree_error_handler
from
venc2.l10n
import
messages
from
venc2.patterns.non_contextual
import
theme_includes_dependencies
from
venc2.patterns.code_highlight
import
CodeHighlight
from
venc2.patterns.exceptions
import
MalformedPatterns
from
venc2.patterns.patterns_map
import
PatternsMap
...
...
@@ -41,7 +42,7 @@ start_timestamp = time.time()
datastore
=
DataStore
()
code_highlight
=
CodeHighlight
(
datastore
.
blog_configuration
[
"code_highlight_css_override"
])
theme_dependencies
=
[]
theme_
assets_
dependencies
=
[]
def
copy_recursively
(
src
,
dest
):
import
errno
...
...
@@ -83,9 +84,15 @@ def init_theme(argv):
for
param
in
config
[
"override"
].
keys
():
datastore
.
blog_configuration
[
param
]
=
config
[
"override"
][
param
]
if
"dependencies"
in
config
.
keys
()
and
type
(
config
[
"dependencies"
])
==
list
:
global
theme_dependencies
theme_dependencies
=
config
[
"dependencies"
]
if
"assets_dependencies"
in
config
.
keys
()
and
type
(
config
[
"assets_dependencies"
])
==
list
:
global
theme_assets_dependencies
theme_assets_dependencies
=
config
[
"assets_dependencies"
]
if
"includes_dependencies"
in
config
.
keys
()
and
type
(
config
[
"includes_dependencies"
])
==
list
:
global
theme_includes_dependencies
append
=
theme_includes_dependencies
.
append
for
include_file
in
config
[
"includes_dependencies"
]:
append
(
include_file
)
try
:
return
Theme
(
theme_folder
),
theme_folder
...
...
@@ -187,7 +194,7 @@ def export_blog(argv=list()):
code_highlight
.
export_style_sheets
()
copy_recursively
(
"extra/"
,
"blog/"
)
copy_recursively
(
theme_folder
+
"assets/"
,
"blog/"
)
for
depenpency
in
theme_dependencies
:
for
depenpency
in
theme_
assets_
dependencies
:
shutil
.
copyfile
(
os
.
path
.
expanduser
(
"~"
)
+
"/.local/share/VenC/themes_assets/"
+
depenpency
,
"blog/"
+
depenpency
)
notify
(
messages
.
task_done_in_n_seconds
.
format
(
round
(
time
.
time
()
-
start_timestamp
,
6
)))
...
...
src/venc2/patterns/non_contextual.py
View file @
00d4d5b8
...
...
@@ -29,6 +29,12 @@ from venc2.helpers import GenericMessage
from
venc2.prompt
import
notify
from
urllib.parse
import
urlparse
theme_includes_dependencies
=
[]
class
MissingKeyDict
(
dict
):
def
__missing__
(
self
,
key
):
return
key
.
join
(
"{}"
)
def
try_oembed
(
providers
,
url
):
try
:
key
=
[
key
for
key
in
providers
[
"oembed"
].
keys
()
if
url
.
netloc
in
key
][
0
]
...
...
@@ -89,21 +95,12 @@ def set_style(argv):
CLASS
=
"class=
\"
"
+
CLASS
+
"
\"
"
if
CLASS
!=
''
else
''
return
"<span "
+
ID
+
' '
+
CLASS
+
">"
+
(
'::'
.
join
(
argv
[
2
:]))
+
"</span>"
""" Must fix dirty try/except structure. """
def
include_file
(
argv
):
try
:
filename
=
argv
[
0
]
include_string
=
open
(
"includes/"
+
filename
,
'r'
).
read
()
if
len
(
argv
)
>
1
:
args
=
{}
index
=
1
for
arg
in
argv
[
1
:]:
args
[
"venc_arg_"
+
str
(
index
)]
=
arg
.
strip
()
index
+=
1
return
include_string
.
format
(
**
args
)
else
:
return
include_string
except
IndexError
:
raise
PatternMissingArguments
()
...
...
@@ -112,8 +109,26 @@ def include_file(argv):
raise
PatternInvalidArgument
(
"path"
,
filename
,
messages
.
wrong_permissions
.
format
(
argv
[
0
]))
except
FileNotFoundError
:
raise
PatternInvalidArgument
(
"path"
,
filename
,
messages
.
file_not_found
.
format
(
filename
))
try
:
include_string
=
open
(
os
.
path
.
expanduser
(
"~/.local/share/VenC/themes_includes/"
+
filename
),
'r'
).
read
()
except
FileNotFoundError
:
raise
PatternInvalidArgument
(
"path"
,
filename
,
messages
.
file_not_found
.
format
(
filename
))
except
PermissionError
:
raise
PatternInvalidArgument
(
"path"
,
filename
,
messages
.
wrong_permissions
.
format
(
argv
[
0
]))
if
len
(
argv
)
>
1
:
args
=
MissingKeyDict
({})
index
=
1
for
arg
in
argv
[
1
:]:
args
[
"venc_arg_"
+
str
(
index
)]
=
arg
.
strip
()
index
+=
1
return
include_string
.
format_map
(
args
)
else
:
return
include_string
def
table
(
argv
):
output
=
"<table class=
\"
__VENC_TABLE__
\"
>"
tr
=
[[]]
...
...
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