Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
protokollsystem
proto3
Commits
a56530e0
Commit
a56530e0
authored
8 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Do not accept broken Tag-like structures
e.g. [todo:who:what] e.g. [todo;who] /close
#95
parent
2d22bca3
No related branches found
No related tags found
No related merge requests found
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
models/database.py
+1
-1
1 addition, 1 deletion
models/database.py
parser.py
+6
-2
6 additions, 2 deletions
parser.py
server.py
+1
-1
1 addition, 1 deletion
server.py
shared.py
+2
-2
2 additions, 2 deletions
shared.py
tasks.py
+13
-2
13 additions, 2 deletions
tasks.py
with
23 additions
and
8 deletions
models/database.py
+
1
−
1
View file @
a56530e0
...
@@ -170,7 +170,7 @@ class Protocol(DatabaseModel):
...
@@ -170,7 +170,7 @@ class Protocol(DatabaseModel):
def
create_localtops
(
self
):
def
create_localtops
(
self
):
local_tops
=
[]
local_tops
=
[]
for
default_top
in
self
.
protocoltype
.
default_tops
:
for
default_top
in
self
.
protocoltype
.
default_tops
:
local_tops
.
append
(
LocalTOP
(
defaulttop_id
=
defaul_top
.
id
,
local_tops
.
append
(
LocalTOP
(
defaulttop_id
=
defaul
t
_top
.
id
,
protocol_id
=
self
.
id
,
description
=
""
))
protocol_id
=
self
.
id
,
description
=
""
))
return
local_tops
return
local_tops
...
...
This diff is collapsed.
Click to expand it.
parser.py
+
6
−
2
View file @
a56530e0
...
@@ -251,7 +251,11 @@ class Tag:
...
@@ -251,7 +251,11 @@ class Tag:
# v1: matches [text without semicolons]
# v1: matches [text without semicolons]
#PATTERN = r"\[(?<content>(?:[^;\]]*;)*(?:[^;\]]*))\]"
#PATTERN = r"\[(?<content>(?:[^;\]]*;)*(?:[^;\]]*))\]"
# v2: needs at least two parts separated by a semicolon
# v2: needs at least two parts separated by a semicolon
PATTERN
=
r
"
\[(?<content>(?:[^;\]]*;)+(?:[^;\]]*))\]
"
#PATTERN = r"\[(?<content>(?:[^;\]]*;)+(?:[^;\]]*))\]"
# v3: also match [] without semicolons inbetween, as there is not other use for that
PATTERN
=
r
"
\[(?<content>[^\]]*)\]
"
KNOWN_TAGS
=
[
"
todo
"
,
"
url
"
,
"
beschluss
"
]
class
Empty
(
Element
):
class
Empty
(
Element
):
...
@@ -514,7 +518,7 @@ def main(test_file_name=None):
...
@@ -514,7 +518,7 @@ def main(test_file_name=None):
source
=
f
.
read
()
source
=
f
.
read
()
try
:
try
:
tree
=
parse
(
source
)
tree
=
parse
(
source
)
tree
.
dump
()
print
(
tree
.
dump
()
)
except
ParserException
as
e
:
except
ParserException
as
e
:
print
(
e
)
print
(
e
)
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
server.py
+
1
−
1
View file @
a56530e0
...
@@ -477,7 +477,7 @@ def new_protocol():
...
@@ -477,7 +477,7 @@ def new_protocol():
form
.
populate_obj
(
protocol
)
form
.
populate_obj
(
protocol
)
db
.
session
.
add
(
protocol
)
db
.
session
.
add
(
protocol
)
db
.
session
.
commit
()
db
.
session
.
commit
()
for
local_top
in
protocol
.
create_localtops
:
for
local_top
in
protocol
.
create_localtops
()
:
db
.
session
.
add
(
local_top
)
db
.
session
.
add
(
local_top
)
db
.
session
.
commit
()
db
.
session
.
commit
()
tasks
.
push_tops_to_calendar
(
protocol
)
tasks
.
push_tops_to_calendar
(
protocol
)
...
...
This diff is collapsed.
Click to expand it.
shared.py
+
2
−
2
View file @
a56530e0
...
@@ -18,8 +18,8 @@ latex_chars = [
...
@@ -18,8 +18,8 @@ latex_chars = [
(
'
_
'
,
'
\\
_
'
),
(
'
_
'
,
'
\\
_
'
),
(
'
{
'
,
'
\\
{
'
),
(
'
{
'
,
'
\\
{
'
),
(
'
}
'
,
'
\\
}
'
),
(
'
}
'
,
'
\\
}
'
),
#
('[', '\\['),
(
'
[
'
,
'
\\
[
'
),
#
(']', '\\]'),
(
'
]
'
,
'
\\
]
'
),
#('"', '"\''),
#('"', '"\''),
(
'
~
'
,
r
'
$\sim{}$
'
),
(
'
~
'
,
r
'
$\sim{}$
'
),
(
'
^
'
,
r
'
\textasciicircum{}
'
),
(
'
^
'
,
r
'
\textasciicircum{}
'
),
...
...
This diff is collapsed.
Click to expand it.
tasks.py
+
13
−
2
View file @
a56530e0
...
@@ -148,6 +148,17 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
...
@@ -148,6 +148,17 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
db
.
session
.
add
(
error
)
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
db
.
session
.
commit
()
return
return
# tags
tags
=
tree
.
get_tags
()
for
tag
in
tags
:
if
tag
.
name
not
in
Tag
.
KNOWN_TAGS
:
error
=
protocol
.
create_error
(
"
Parsing
"
,
"
Invalid tag
"
,
"
The tag in line {} has the kind
'
{}
'
, which is
"
"
not defined. This is probably an error mit a missing
"
"
semicolon.
"
.
format
(
tag
.
linenumber
,
tag
.
name
))
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
return
# todos
# todos
old_todo_number_map
=
{}
old_todo_number_map
=
{}
for
todo
in
protocol
.
todos
:
for
todo
in
protocol
.
todos
:
...
@@ -158,14 +169,14 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
...
@@ -158,14 +169,14 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
for
todo
in
old_todos
:
for
todo
in
old_todos
:
protocol
.
todos
.
remove
(
todo
)
protocol
.
todos
.
remove
(
todo
)
db
.
session
.
commit
()
db
.
session
.
commit
()
tags
=
tree
.
get_tags
()
todo_tags
=
[
tag
for
tag
in
tags
if
tag
.
name
==
"
todo
"
]
todo_tags
=
[
tag
for
tag
in
tags
if
tag
.
name
==
"
todo
"
]
for
todo_tag
in
todo_tags
:
for
todo_tag
in
todo_tags
:
if
len
(
todo_tag
.
values
)
<
2
:
if
len
(
todo_tag
.
values
)
<
2
:
error
=
protocol
.
create_error
(
"
Parsing
"
,
"
Invalid todo-tag
"
,
error
=
protocol
.
create_error
(
"
Parsing
"
,
"
Invalid todo-tag
"
,
"
The todo tag in line {} needs at least
"
"
The todo tag in line {} needs at least
"
"
information on who and what,
"
"
information on who and what,
"
"
but has less than that.
"
.
format
(
todo_tag
.
linenumber
))
"
but has less than that. This is probably
"
"
a missing semicolon.
"
.
format
(
todo_tag
.
linenumber
))
db
.
session
.
add
(
error
)
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
db
.
session
.
commit
()
return
return
...
...
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