Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gitlabsnippet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dokuwiki
gitlabsnippet
Commits
7a4cde1c
Commit
7a4cde1c
authored
Jan 05, 2020
by
Wataru Noguchi
✍🏻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement GitLab snippet embed.
parent
77af0d48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
syntax/gitlabsnippetsyntax.php
syntax/gitlabsnippetsyntax.php
+21
-5
No files found.
syntax/gitlabsnippetsyntax.php
View file @
7a4cde1c
...
...
@@ -18,7 +18,7 @@ class syntax_plugin_gitlabsnippet_gitlabsnippetsyntax extends DokuWiki_Syntax_Pl
*/
public
function
getType
()
{
return
'
FIXME: container|baseonly|formatting|substition|protected|disabled|paragraphs
'
;
return
'
substition
'
;
}
/**
...
...
@@ -26,7 +26,8 @@ class syntax_plugin_gitlabsnippet_gitlabsnippetsyntax extends DokuWiki_Syntax_Pl
*/
public
function
getPType
()
{
return
'FIXME: normal|block|stack'
;
return
'block'
;
//return 'FIXME: normal|block|stack';
}
/**
...
...
@@ -34,9 +35,11 @@ class syntax_plugin_gitlabsnippet_gitlabsnippetsyntax extends DokuWiki_Syntax_Pl
*/
public
function
getSort
()
{
return
FIXME
;
return
32
;
}
//public function getAllowedTypes() { return array('formatting', 'substition', 'disabled'); }
/**
* Connect lookup pattern to lexer.
*
...
...
@@ -44,7 +47,7 @@ class syntax_plugin_gitlabsnippet_gitlabsnippetsyntax extends DokuWiki_Syntax_Pl
*/
public
function
connectTo
(
$mode
)
{
$this
->
Lexer
->
addSpecialPattern
(
'
<FIXME>
'
,
$mode
,
'plugin_gitlabsnippet_gitlabsnippetsyntax'
);
$this
->
Lexer
->
addSpecialPattern
(
'
\[gitlab-snippet [^\]]+\]
'
,
$mode
,
'plugin_gitlabsnippet_gitlabsnippetsyntax'
);
// $this->Lexer->addEntryPattern('<FIXME>', $mode, 'plugin_gitlabsnippet_gitlabsnippetsyntax');
}
...
...
@@ -65,7 +68,16 @@ class syntax_plugin_gitlabsnippet_gitlabsnippetsyntax extends DokuWiki_Syntax_Pl
*/
public
function
handle
(
$match
,
$state
,
$pos
,
Doku_Handler
$handler
)
{
$data
=
array
();
$snippetData
=
explode
(
" "
,
$match
);
$snippetData
=
$snippetData
[
1
];
$snippetData
=
substr
(
$snippetData
,
0
,
-
1
);
if
(
strpos
(
$snippetData
,
'.js'
)
===
false
)
{
$snippetData
.
=
'.js'
;
}
$data
=
array
(
$snippetData
);
return
$data
;
}
...
...
@@ -85,6 +97,10 @@ class syntax_plugin_gitlabsnippet_gitlabsnippetsyntax extends DokuWiki_Syntax_Pl
return
false
;
}
$snippetData
=
$data
[
0
];
$renderer
->
doc
.
=
'<script src="'
.
$snippetData
.
'"></script>'
;
return
true
;
}
}
...
...
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