Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
scripts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Benjamin Graillot
scripts
Commits
b8163ce2
Commit
b8163ce2
authored
Mar 16, 2018
by
Benjamin Graillot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ajour de la macro EtherPad
parent
313d2cab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
wiki/macro/EtherPad.py
wiki/macro/EtherPad.py
+62
-0
No files found.
wiki/macro/EtherPad.py
0 → 100644
View file @
b8163ce2
# -*- coding: iso-8859-1 -*-
"""
MoinMoin - EtherPad Macro
Benjamin « esum » « coq » Graillot
pour le Cr@ns
Syntaxe :
<<EtherPad(name)>>
<<EtherPad(name, show_controls=true, ...)>>
Arguments:
* name: nom du pad.
Arguments optionnels:
* show_controls: afficher les contrôles du pad.
* show_chat: afficher le clavardage.
* show_line_numbers: afficher les numéros de ligne.
* use_monospace_font: utiliser la police à chasse fixe.
* height: hauteur du pad en pixer.
* frameborder: afficher le cadre autour du pad.
"""
def
execute
(
macro
,
text
):
text
=
text
.
split
(
','
)
name
=
text
[
0
]
.
strip
()
args
=
[
name
]
kwargs
=
{}
for
arg
in
text
[
1
:]:
kw
=
None
if
'='
in
arg
:
arg
=
arg
.
split
(
'='
)
kw
=
arg
[
0
]
.
strip
()
arg
=
arg
[
1
]
arg
=
arg
.
strip
()
if
arg
.
lower
()
in
{
'true'
,
'false'
}:
arg
=
bool
(
arg
)
elif
arg
.
isnumeric
():
arg
=
int
(
arg
)
if
kw
is
None
:
args
.
append
(
arg
)
else
:
kwargs
[
kw
]
=
arg
return
macro
.
formatter
.
rawHTML
(
html
(
*
args
,
**
kwargs
))
def
html
(
name
,
show_controls
=
None
,
show_chat
=
None
,
show_line_numbers
=
None
,
use_monospace_font
=
True
,
height
=
400
,
frameborder
=
True
):
readonly
=
name
.
startswith
(
'r.'
)
if
not
isinstance
(
show_controls
,
bool
):
show_controls
=
not
readonly
if
not
isinstance
(
show_chat
,
bool
):
show_chat
=
not
readonly
if
not
isinstance
(
show_line_numbers
,
bool
):
show_line_numbers
=
not
readonly
html
=
u'''<iframe name="{}" src="https://pad.crans.org/p/{}?showControls={}&showChat={}&showLineNumbers={}&useMonospaceFont={}" width="100
%
" height="{}" frameborder="{}"></iframe>'''
.
format
(
'embed_readonly'
if
readonly
else
'embed_readwrite'
,
name
,
repr
(
show_controls
)
.
lower
(),
repr
(
show_chat
)
.
lower
(),
repr
(
show_line_numbers
)
.
lower
(),
repr
(
use_monospace_font
)
.
lower
(),
height
,
int
(
frameborder
))
return
html
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