Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
html2protoxml
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexis Filipozzi
html2protoxml
Commits
87dc396b
Commit
87dc396b
authored
9 years ago
by
Alexis Filipozzi
Browse files
Options
Downloads
Patches
Plain Diff
small correction in ul translation
parent
7a62cf88
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
data.py
+2
-0
2 additions, 0 deletions
data.py
html_parser.py
+10
-9
10 additions, 9 deletions
html_parser.py
main.py
+1
-2
1 addition, 2 deletions
main.py
with
13 additions
and
11 deletions
data.py
+
2
−
0
View file @
87dc396b
...
@@ -89,6 +89,8 @@ class TextContent(ParagraphContent):
...
@@ -89,6 +89,8 @@ class TextContent(ParagraphContent):
def
get_string
(
self
,
clean
=
True
):
def
get_string
(
self
,
clean
=
True
):
text
=
self
.
_text
text
=
self
.
_text
if
not
text
:
text
=
""
if
clean
:
if
clean
:
text
=
text
.
strip
()
text
=
text
.
strip
()
return
text
return
text
...
...
This diff is collapsed.
Click to expand it.
html_parser.py
+
10
−
9
View file @
87dc396b
...
@@ -88,6 +88,7 @@ class Parser:
...
@@ -88,6 +88,7 @@ class Parser:
self
.
_data
.
_body
.
append
(
Paragraph
(
indent
))
self
.
_data
.
_body
.
append
(
Paragraph
(
indent
))
else
:
else
:
self
.
parse_paragraph
(
c
)
self
.
parse_paragraph
(
c
)
if
content
.
name
==
"
li
"
:
if
self
.
_data
.
_body
[
-
1
].
_content
:
if
self
.
_data
.
_body
[
-
1
].
_content
:
last_content
=
self
.
_data
.
_body
[
-
1
].
_content
[
-
1
]
last_content
=
self
.
_data
.
_body
[
-
1
].
_content
[
-
1
]
if
isinstance
(
last_content
,
TextContent
):
if
isinstance
(
last_content
,
TextContent
):
...
...
This diff is collapsed.
Click to expand it.
main.py
+
1
−
2
View file @
87dc396b
...
@@ -32,12 +32,11 @@ def parse_and_format(dir_path, filename, dest):
...
@@ -32,12 +32,11 @@ def parse_and_format(dir_path, filename, dest):
for
sub_file
in
os
.
listdir
(
path_to_file
):
for
sub_file
in
os
.
listdir
(
path_to_file
):
parse_and_format
(
path_to_file
,
sub_file
,
path_to_dst
)
parse_and_format
(
path_to_file
,
sub_file
,
path_to_dst
)
elif
os
.
path
.
isfile
(
path_to_file
):
elif
os
.
path
.
isfile
(
path_to_file
):
parse_format_and_write_file
(
path_to_file
,
path
_to_dst
)
parse_format_and_write_file
(
path_to_file
,
os
.
path
.
join
(
dest
,
filename
.
replace
(
"
.html
"
,
"
.protoxml
"
))
)
else
:
else
:
print
"
Unhandled file type (probably symlink) with file
"
+
str
(
path_to_file
)
print
"
Unhandled file type (probably symlink) with file
"
+
str
(
path_to_file
)
def
parse_format_and_write_file
(
filename
,
dest
):
def
parse_format_and_write_file
(
filename
,
dest
):
print
"
parse file
"
has_been_parsed
=
False
has_been_parsed
=
False
parser
=
None
parser
=
None
formatter
=
None
formatter
=
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment