2011-07-11 21:34:53 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2012-01-06 18:08:59 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-07-11 21:34:53 +02:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2011-09-14 17:02:31 +02:00
|
|
|
/**
|
|
|
|
* @group phriction
|
|
|
|
*/
|
2012-03-14 00:21:04 +01:00
|
|
|
final class PhrictionContent extends PhrictionDAO {
|
2011-07-11 21:34:53 +02:00
|
|
|
|
|
|
|
protected $id;
|
|
|
|
protected $documentID;
|
|
|
|
protected $version;
|
|
|
|
protected $authorPHID;
|
|
|
|
|
|
|
|
protected $title;
|
|
|
|
protected $slug;
|
|
|
|
protected $content;
|
2011-07-22 00:32:54 +02:00
|
|
|
protected $description;
|
2011-07-11 21:34:53 +02:00
|
|
|
|
2011-12-17 18:19:08 +01:00
|
|
|
protected $changeType;
|
|
|
|
protected $changeRef;
|
|
|
|
|
2012-01-06 18:08:59 +01:00
|
|
|
public function renderContent() {
|
|
|
|
$engine = PhabricatorMarkupEngine::newPhrictionMarkupEngine();
|
|
|
|
$markup = $engine->markupText($this->getContent());
|
|
|
|
|
|
|
|
$toc = PhutilRemarkupEngineRemarkupHeaderBlockRule::renderTableOfContents(
|
|
|
|
$engine);
|
|
|
|
if ($toc) {
|
|
|
|
$toc =
|
|
|
|
'<div class="phabricator-remarkup-toc">'.
|
|
|
|
'<div class="phabricator-remarkup-toc-header">'.
|
|
|
|
'Table of Contents'.
|
|
|
|
'</div>'.
|
|
|
|
$toc.
|
|
|
|
'</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
return
|
|
|
|
'<div class="phabricator-remarkup">'.
|
|
|
|
$toc.
|
|
|
|
$markup.
|
|
|
|
'</div>';
|
|
|
|
}
|
|
|
|
|
2011-07-11 21:34:53 +02:00
|
|
|
}
|