Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tomd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Чумбаев Максим
tomd
Commits
1ecb6f89
Commit
1ecb6f89
authored
Jul 07, 2017
by
Andrew Xia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add em italics support, div newline fix
parent
ee22723d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
+5
-2
tomd.py
tomd.py
+5
-2
No files found.
tomd.py
View file @
1ecb6f89
...
...
@@ -24,6 +24,7 @@ MARKDOWN = {
'inline_p_with_out_class'
:
(
''
,
''
),
'b'
:
(
'**'
,
'**'
),
'i'
:
(
'*'
,
'*'
),
'em'
:
(
'*'
,
'*'
),
'del'
:
(
'~~'
,
'~~'
),
'hr'
:
(
'
\n
---'
,
'
\n\n
'
),
'thead'
:
(
'
\n
'
,
'|------
\n
'
),
...
...
@@ -106,6 +107,7 @@ class Element:
def
parse_inline
(
self
):
self
.
content
=
self
.
content
.
replace
(
'
\r
'
,
''
)
#windows \r character
self
.
content
=
self
.
content
.
replace
(
'
\xc2\xa0
'
,
' '
)
#no break space
self
.
content
=
self
.
content
.
replace
(
'"'
,
'
\"
'
)
#html quote mark
for
m
in
re
.
finditer
(
"<img(.*?)en_todo.*?>"
,
self
.
content
):
...
...
@@ -169,8 +171,9 @@ class Element:
wrapper
=
MARKDOWN
.
get
(
tag
)
self
.
content
=
re
.
sub
(
pattern
,
'{}
\
g<1>{}'
.
format
(
wrapper
[
0
],
wrapper
[
1
]),
self
.
content
)
# if self.tag == "e_p" and self.content[-2:] != '\n': #div, add new line if not there
# self.content += '\n'
if
self
.
tag
==
"e_p"
and
self
.
content
[
-
1
:]
!=
'
\n
'
and
len
(
self
.
content
)
>
2
:
# focusing on div, add new line if not there (and if content is long enough)
self
.
content
+=
'
\n
'
def
construct_table
(
self
):
# this function, after self.content has gained | for table entries,
...
...
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