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
9e7de8b5
Commit
9e7de8b5
authored
Nov 13, 2018
by
Denis Salem
Browse files
done with path encoding
parent
e14b11f2
Changes
6
Hide whitespace changes
Inline
Side-by-side
changelog.md
View file @
9e7de8b5
...
...
@@ -126,11 +126,11 @@
DONE | Export empty blog.
DONE | Allow disabling exportation of specific kind of thread.
DONE | Add categories tree in entry.
DONE | Remove illegal character from path.
WIP | Add support for embed content (oEmbed, OGP)
TODO | Export entry in nicely named folder instead of permalink
TODO | Client-side search engine.
TODO | Fix unit test.
TODO | Remove illegal character from path.
TODO | Serv page.
TODO | Open with navigator manual.
TODO | Reorganize themes dependencies in setup (adding default templates, scripts, and pages to include).
...
...
src/venc2/commands/new.py
View file @
9e7de8b5
...
...
@@ -134,7 +134,8 @@ def new_blog(argv):
"columns"
:
1
,
"rss_thread_lenght"
:
5
,
"reverse_thread_order"
:
True
,
"markup_language"
:
"Markdown"
}
"markup_language"
:
"Markdown"
,
"path_encoding"
:
"utf-8"
}
for
folder_name
in
argv
:
try
:
os
.
mkdir
(
folder_name
)
...
...
src/venc2/datastore/__init__.py
View file @
9e7de8b5
...
...
@@ -51,7 +51,7 @@ class DataStore:
entry_index
=
0
for
filename
in
yield_entries_content
():
if
len
(
self
.
entries
):
self
.
entries
.
append
(
Entry
(
filename
,
previous_entry
=
self
.
entries
[
-
1
]))
self
.
entries
.
append
(
Entry
(
filename
,
previous_entry
=
self
.
entries
[
-
1
]
,
encoding
=
self
.
blog_configuration
[
"path_encoding"
]
))
self
.
entries
[
-
2
].
next_entry
=
self
.
entries
[
-
1
]
else
:
...
...
@@ -69,7 +69,7 @@ class DataStore:
''' Update entriesPerCategories '''
build_categories_tree
(
entry_index
,
self
.
entries
[
-
1
].
raw_categories
,
self
.
entries_per_categories
,
self
.
categories_leaves
,
self
.
max_category_weight
,
self
.
set_max_category_weight
)
build_categories_tree
(
entry_index
,
self
.
entries
[
-
1
].
raw_categories
,
self
.
entries_per_categories
,
self
.
categories_leaves
,
self
.
max_category_weight
,
self
.
set_max_category_weight
,
encoding
=
self
.
blog_configuration
[
"path_encoding"
]
)
entry_index
+=
1
''' Setup BlogDates Data '''
...
...
src/venc2/datastore/configuration.py
View file @
9e7de8b5
...
...
@@ -50,7 +50,8 @@ def get_blog_configuration():
"disable_main_thread"
,
"disable_archives"
,
"disable_categories"
,
"disable_single_entries"
"disable_single_entries"
,
"path_encoding"
]
everything_is_okay
=
True
...
...
src/venc2/datastore/entry.py
View file @
9e7de8b5
...
...
@@ -54,7 +54,7 @@ class EntryWrapper:
die
(
messages
.
missing_entry_content_inclusion
)
class
Entry
:
def
__init__
(
self
,
filename
,
previous_entry
=
None
):
def
__init__
(
self
,
filename
,
previous_entry
=
None
,
encoding
=
"utf-8"
):
self
.
previous_entry
=
previous_entry
self
.
next_entry
=
None
...
...
@@ -134,7 +134,7 @@ class Entry:
pass
self
.
categories_tree
=
[]
build_categories_tree
(
-
1
,
self
.
raw_categories
,
self
.
categories_tree
,
None
,
-
1
)
build_categories_tree
(
-
1
,
self
.
raw_categories
,
self
.
categories_tree
,
None
,
-
1
,
encoding
=
encoding
)
self
.
html_categories_tree
=
None
''' Iterate through entries folder '''
...
...
src/venc2/datastore/metadata.py
View file @
9e7de8b5
...
...
@@ -18,6 +18,7 @@
# along with VenC. If not, see <http://www.gnu.org/licenses/>.
import
datetime
import
urllib.parse
class
MetadataNode
:
def
__init__
(
self
,
value
,
entry_index
):
...
...
@@ -28,14 +29,14 @@ class MetadataNode:
self
.
related_to
=
[
entry_index
]
self
.
childs
=
list
()
def
build_categories_tree
(
entry_index
,
input_list
,
output_tree
,
output_leaves
,
max_weight
,
set_max_weight
=
None
):
def
build_categories_tree
(
entry_index
,
input_list
,
output_tree
,
output_leaves
,
max_weight
,
set_max_weight
=
None
,
encoding
=
"utf-8"
):
for
category
in
input_list
:
branch
=
category
.
split
(
' > '
)
if
not
len
(
branch
):
continue
leave
=
branch
[
-
1
]
path
=
"
.:GetRelativeOrigin:.
"
path
=
""
root
=
output_tree
for
node_name
in
branch
:
if
node_name
==
''
:
...
...
@@ -48,7 +49,7 @@ def build_categories_tree(entry_index, input_list, output_tree, output_leaves, m
if
output_leaves
!=
None
and
node_name
==
leave
:
output_leaves
.
append
(
root
[
-
1
])
root
[
-
1
].
path
=
path
root
[
-
1
].
path
=
".:GetRelativeOrigin:."
+
urllib
.
parse
.
quote
(
path
,
encoding
=
encoding
)
root
=
root
[
-
1
].
childs
else
:
...
...
Write
Preview
Supports
Markdown
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