Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Lars Frost
proto3
Commits
0b7f25bb
Commit
0b7f25bb
authored
Jan 18, 2018
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Enable rendering and pushing dokuwiki source
parent
de70e460
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
config.py.example
+1
-0
1 addition, 0 deletions
config.py.example
shared.py
+5
-0
5 additions, 0 deletions
shared.py
tasks.py
+41
-9
41 additions, 9 deletions
tasks.py
templates/protocol.dokuwiki
+15
-0
15 additions, 0 deletions
templates/protocol.dokuwiki
with
62 additions
and
9 deletions
config.py.example
+
1
−
0
View file @
0b7f25bb
...
...
@@ -42,6 +42,7 @@ Get involved with Etherpad at http://etherpad.org
# wiki (optional)
WIKI_ACTIVE = True
WIKI_TYPE = "MEDIAWIKI"
WIKI_API_URL = "https://wiki.example.com/wiki/api.php"
WIKI_ANONYMOUS = False
WIKI_USER = "user"
...
...
This diff is collapsed.
Click to expand it.
shared.py
+
5
−
0
View file @
0b7f25bb
...
...
@@ -3,6 +3,7 @@ from flask import session, redirect, url_for, request
import
re
from
functools
import
wraps
from
enum
import
Enum
import
config
...
...
@@ -128,3 +129,7 @@ DATE_KEY = "Datum"
START_TIME_KEY
=
"
Beginn
"
END_TIME_KEY
=
"
Ende
"
KNOWN_KEYS
=
[
DATE_KEY
,
START_TIME_KEY
,
END_TIME_KEY
]
class
WikiType
(
Enum
):
MEDIAWIKI
=
0
DOKUWIKI
=
1
This diff is collapsed.
Click to expand it.
tasks.py
+
41
−
9
View file @
0b7f25bb
...
...
@@ -7,11 +7,12 @@ import tempfile
from
datetime
import
datetime
import
traceback
from
copy
import
copy
import
xmlrpc.client
from
models.database
import
Document
,
Protocol
,
Error
,
Todo
,
Decision
,
TOP
,
DefaultTOP
,
MeetingReminder
,
TodoMail
,
DecisionDocument
,
TodoState
,
OldTodo
,
DecisionCategory
from
models.errors
import
DateNotMatchingException
from
server
import
celery
,
app
from
shared
import
db
,
escape_tex
,
unhyphen
,
date_filter
,
datetime_filter
,
date_filter_long
,
date_filter_short
,
time_filter
,
class_filter
,
KNOWN_KEYS
from
shared
import
db
,
escape_tex
,
unhyphen
,
date_filter
,
datetime_filter
,
date_filter_long
,
date_filter_short
,
time_filter
,
class_filter
,
KNOWN_KEYS
,
WikiType
from
utils
import
mail_manager
,
encode_kwargs
,
decode_kwargs
,
add_line_numbers
,
set_etherpad_text
,
get_etherpad_text
,
footnote_hash
,
parse_datetime_from_string
from
protoparser
import
parse
,
ParserException
,
Element
,
Content
,
Text
,
Tag
,
Remark
,
Fork
,
RenderType
from
wiki
import
WikiClient
,
WikiException
...
...
@@ -464,16 +465,29 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
compile
(
latex_source
,
protocol
,
show_private
=
show_private
,
maxdepth
=
maxdepth
)
if
protocol
.
protocoltype
.
use_wiki
:
wiki_type
=
WikiType
[
getattr
(
config
,
"
WIKI_TYPE
"
,
"
MEDIAWIKI
"
)]
wiki_template
=
{
WikiType
.
MEDIAWIKI
:
"
protocol.wiki
"
,
WikiType
.
DOKUWIKI
:
"
protocol.dokuwiki
"
,
}
wiki_render_type
=
{
WikiType
.
MEDIAWIKI
:
RenderType
.
wikitext
,
WikiType
.
DOKUWIKI
:
RenderType
.
dokuwiki
,
}
show_private
=
not
protocol
.
protocoltype
.
wiki_only_public
wiki_source
=
wikienv
.
get_template
(
"
protocol.wiki
"
).
render
(
render_type
=
R
ender
T
ype
.
wiki
text
,
wiki_source
=
wikienv
.
get_template
(
wiki_template
[
wiki_type
]
).
render
(
render_type
=
wiki_r
ender
_t
ype
[
wiki
_type
]
,
show_private
=
show_private
,
**
render_kwargs
[
show_private
]
).
replace
(
"
\n\n\n
"
,
"
\n\n
"
)
if
wiki_type
==
WikiType
.
MEDIAWIKI
:
wiki_infobox_source
=
wikienv
.
get_template
(
"
infobox.wiki
"
).
render
(
protocoltype
=
protocol
.
protocoltype
)
push_to_wiki
(
protocol
,
wiki_source
,
wiki_infobox_source
,
"
Automatisch generiert vom Protokollsystem 3.0
"
)
elif
wiki_type
==
WikiType
.
DOKUWIKI
:
push_to_dokuwiki
(
protocol
,
wiki_source
,
"
Automatisch generiert vom Protokollsystem 3.0
"
)
protocol
.
done
=
True
db
.
session
.
commit
()
...
...
@@ -488,13 +502,29 @@ def push_to_wiki_async(protocol_id, content, infobox_content, summary):
wiki_client
.
edit_page
(
title
=
protocol
.
protocoltype
.
get_wiki_infobox_title
(),
content
=
infobox_content
,
summary
=
"
Automatisch generiert vom Protokollsystem 3.
"
)
summary
=
summary
)
wiki_client
.
edit_page
(
title
=
protocol
.
get_wiki_title
(),
content
=
content
,
summary
=
"
Automatisch generiert vom Protokollsystem 3.
"
)
summary
=
summary
)
except
WikiException
as
exc
:
error
=
protocol
.
create_error
(
"
Pushing to Wiki
"
,
"
Pushing to Wiki failed.
"
,
str
(
exc
))
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
def
push_to_dokuwiki
(
protocol
,
content
,
summary
):
push_to_dokuwiki_async
.
delay
(
protocol
.
id
,
content
,
summary
)
@celery_task
def
push_to_dokuwiki_async
(
protocol_id
,
content
,
summary
):
protocol
=
Protocol
.
query
.
filter_by
(
id
=
protocol_id
).
first
()
with
xmlrpc
.
client
.
ServerProxy
(
config
.
WIKI_API_URL
)
as
proxy
:
if
not
proxy
.
wiki
.
putPage
(
protocol
.
get_wiki_title
(),
content
,
{
"
sum
"
:
"
Automatisch generiert vom Protokollsystem 3.
"
}):
error
=
protocol
.
create_error
(
"
Pushing to Wiki
"
,
"
Pushing to Wiki failed.
"
""
)
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
def
compile
(
content
,
protocol
,
show_private
,
maxdepth
):
compile_async
.
delay
(
content
,
protocol
.
id
,
show_private
=
show_private
,
maxdepth
=
maxdepth
)
...
...
@@ -594,6 +624,8 @@ def print_file_async(filename, protocol_id):
protocol
=
Protocol
.
query
.
filter_by
(
id
=
protocol_id
).
first
()
if
protocol
.
protocoltype
.
printer
is
None
:
error
=
protocol
.
create_error
(
"
Printing
"
,
"
No printer configured.
"
,
"
You don
'
t have any printer configured for the protocoltype {}. Please do so before printing a protocol.
"
.
format
(
protocol
.
protocoltype
.
name
))
db
.
session
.
add
(
error
)
db
.
session
.
commit
()
try
:
command
=
[
"
/usr/bin/lpr
"
,
...
...
This diff is collapsed.
Click to expand it.
templates/protocol.dokuwiki
0 → 100644
+
15
−
0
View file @
0b7f25bb
== Beschlüsse ==
<env> if protocol.decisions|length > 0 </env>
<env> for decision in protocol.decisions </env>
* <var>decision.content</var>
<env> endfor </env>
<env> else </env>
* keine Beschlüsse
<env> endif </env>
<env> for top in tree.children </env>
<env> if top|class == "Fork" </env>
<var>top.render(render_type=render_type, level=0, show_private=show_private, protocol=protocol)</var>
<env> endif </env>
<env> endfor </env>
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