Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Community
Semantic Structured Discussions
Commits
ec8fa976
Commit
ec8fa976
authored
Apr 04, 2022
by
Marijn van Wezel
❤
Browse files
Parse the reply content before storing it
parent
f37b9ec7
Pipeline
#2760
passed with stage
in 9 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
extension.json
View file @
ec8fa976
{
"name"
:
"Semantic Structured Discussions"
,
"type"
:
"semantic"
,
"version"
:
"1.
1
.0"
,
"version"
:
"1.
2
.0"
,
"author"
:
[
"Marijn van Wezel ([https://wikibase-solutions.com Wikibase Solutions])"
],
...
...
src/SemanticMediaWiki/Annotators/ReplyAnnotators/ContentAnnotator.php
View file @
ec8fa976
...
...
@@ -20,6 +20,9 @@
namespace
SemanticStructuredDiscussions\SemanticMediaWiki\Annotators\ReplyAnnotators
;
use
MediaWiki\MediaWikiServices
;
use
Parser
;
use
SemanticStructuredDiscussions\StructuredDiscussions\SDReply
;
use
SMW\DIProperty
;
use
SMW\SemanticData
;
use
SMWDIBlob
;
...
...
@@ -28,13 +31,32 @@ use SMWDIBlob;
* This annotation contains information about the content of a reply.
*/
class
ContentAnnotator
extends
ReplyAnnotator
{
/**
* @var Parser The current MediaWiki parser
*/
private
Parser
$parser
;
/**
* ContentAnnotator constructor.
*
* @param SDReply $reply
*/
public
function
__construct
(
SDReply
$reply
)
{
parent
::
__construct
(
$reply
);
$this
->
parser
=
MediaWikiServices
::
getInstance
()
->
getParser
();
}
/**
* @inheritDoc
*/
public
function
addAnnotation
(
SemanticData
$semanticData
):
void
{
$wikitext
=
$this
->
reply
->
getContent
();
$content
=
strip_tags
(
$this
->
parser
->
recursiveTagParseFully
(
$wikitext
)
);
$semanticData
->
addPropertyObjectValue
(
new
DIProperty
(
self
::
getId
()
),
new
SMWDIBlob
(
$
this
->
reply
->
getC
ontent
()
)
new
SMWDIBlob
(
$
c
ontent
)
);
}
...
...
Write
Preview
Supports
Markdown
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