Commit 3eb2e6f6 authored by Vojtěch Sobota's avatar Vojtěch Sobota

add support for processing Markdown syntax, closes #11

parent f1535125
......@@ -7,22 +7,20 @@ namespace VTCompose\Collection;
*
*
*/
class KeyValuePair {
final class KeyValuePair {
private $key;
private $value;
/**
*
*
*
*
* @param mixed
* @param mixed
* @return mixed
*/
public function __construct($key, $value) {
$this->key = $key;
$this->value = $value;
public function getKey() {
return $this->key;
}
/**
......@@ -32,8 +30,8 @@ class KeyValuePair {
*
* @return mixed
*/
public function getKey() {
return $this->key;
public function getValue() {
return $this->value;
}
/**
......@@ -41,10 +39,12 @@ class KeyValuePair {
*
*
*
* @return mixed
* @param mixed
* @param mixed
*/
public function getValue() {
return $this->value;
public function __construct($key, $value) {
$this->key = $key;
$this->value = $value;
}
}
......
<?php
namespace VTCompose\Markdown\Document;
/**
*
*
*
*/
abstract class Block extends Node {
}
?>
<?php
namespace VTCompose\Markdown\Document;
use VTCompose\Collection\IList;
/**
*
*
*
*/
class BlockList extends Block {
private $items;
private $ordered;
private $startNumber;
private $tight;
/**
*
*
*
*
* @param IList
* @param bool
* @param int
* @param bool
*/
public function __construct(IList $items = NULL, $ordered = true, $startNumber = 1, $tight = false) {
$this->items = $items;
$this->ordered = $ordered;
$this->startNumber = $startNumber;
$this->tight = $tight;
}
/**
*
*
*
*
* @param IList
*/
public function setItems(IList $items) {
$this->items = $items;
}
/**
*
*
*
*
* @return IList
*/
public function getItems() {
return $this->items;
}
/**
*
*
*
*
* @param bool
*/
public function setOrdered($ordered) {
$this->ordered = $ordered;
}
/**
*
*
*
*
* @return bool
*/
public function isOrdered() {
return $this->ordered;
}
/**
*
*
*
*
* @param int
*/
public function setStartNumber($startNumber) {
$this->startNumber = $startNumber;
}
/**
*
*
*
*
* @return int
*/
public function getStartNumber() {
return $this->startNumber;
}
/**
*
*
*
*
* @param bool
*/
public function setTight($tight) {
$this->tight = $tight;
}
/**
*
*
*
*
* @return bool
*/
public function isTight() {
return $this->tight;
}
/**
*
*
*
*
* @return int
*/
public function getNodeType() {
return NodeType::BLOCK_LIST;
}
}
?>
<?php
namespace VTCompose\Markdown\Document;
use VTCompose\Collection\IList;
/**
*
*
*
*/
class BlockQuote extends Block {
private $blocks;
/**
*
*
*
*
* @param IList
*/
public function __construct(IList $blocks = NULL) {
$this->blocks = $blocks;
}
/**
*
*
*
*
* @param IList
*/
public function setBlocks(IList $blocks) {
$this->blocks = $blocks;
}
/**
*
*
*
*
* @return IList
*/
public function getBlocks() {
return $this->blocks;
}
/**
*
*
*
*
* @return int
*/
public function getNodeType() {
return NodeType::BLOCK_QUOTE;
}
}
?>
<?php
namespace VTCompose\Markdown\Document;
/**
*
*
*
*/
class CodeBlock extends Block {
private $codeText;
private $info;
/**
*
*
*
*
* @param string
* @param string
*/
public function __construct($codeText = '', $info = NULL) {
$this->codeText = $codeText;
$this->info = $info;
}
/**
*
*
*
*
* @param string
*/
public function setCodeText($codeText) {
$this->codeText = $codeText;
}
/**
*
*
*
*
* @param string
*/
public function appendCodeText($codeText) {
$this->codeText .= $codeText;
}
/**
*
*
*
*
* @return string
*/
public function getCodeText() {
return $this->codeText;
}
/**
*
*
*
*
* @param string
*/
public function setInfo($info) {
$this->info = $info;
}
/**
*
*
*
*
* @return string
*/
public function getInfo() {
return $this->info;
}
/**
*
*
*
*
* @return int
*/
public function getNodeType() {
return NodeType::CODE_BLOCK;
}
}
?>
<?php
namespace VTCompose\Markdown\Document;
/**
*
*
*
*/
class CodeSpan extends Inline {
private $codeText;
/**
*
*
*
*
* @param string
*/
public function __construct($codeText = '') {
$this->codeText = $codeText;
}
/**
*
*
*
*
* @param string
*/
public function setCodeText($codeText) {
$this->codeText = $codeText;
}
/**
*
*
*
*
* @return string
*/
public function getCodeText() {
return $this->codeText;
}
/**
*
*
*
*
* @return int
*/
public function getNodeType() {
return NodeType::CODE_SPAN;
}
}
?>
<?php
namespace VTCompose\Markdown\Document;
use VTCompose\Collection\IList;
/**
*
*
*
*/
class Document {
private $blocks;
/**
*
*
*
*
* @param IList
*/
public function __construct(IList $blocks = NULL) {
$this->blocks = $blocks;
}
/**
*
*
*
*
* @param IList
*/
public function setBlocks(IList $blocks) {
$this->blocks = $blocks;
}
/**
*
*
*
*
* @return IList
*/
public function getBlocks() {
return $this->blocks;
}
}
?>
<?php
namespace VTCompose\Markdown\Document;
use VTCompose\Collection\IList;
/**
*
*
*
*/
class Emphasis extends Inline {
private $inlineContent;
/**
*
*
*
*
* @param IList
*/
public function __construct(IList $inlineContent = NULL) {
$this->inlineContent = $inlineContent;
}
/**
*
*
*
*
* @param IList
*/
public function setInlineContent(IList $inlineContent) {
$this->inlineContent = $inlineContent;
}
/**
*
*
*
*
* @return IList
*/
public function getInlineContent() {
return $this->inlineContent;
}
/**
*
*
*
*
* @return int
*/
public function getNodeType() {
return NodeType::EMPHASIS;
}
}
?>
<?php
namespace VTCompose\Markdown\Document;
/**
*
*
*
*/
class HardLineBreak extends Inline {
/**
*
*
*
*
* @return int
*/
public function getNodeType() {
return NodeType::HARD_LINE_BREAK;
}
}
?>
<?php
namespace VTCompose\Markdown\Document;
use VTCompose\Collection\IList;
/**
*
*
*
*/
class Heading extends Block {
private $level;
private $inlineContent;
/**
*
*
*
*
* @param int
* @param IList
*/
public function __construct($level, IList $inlineContent = NULL) {
$this->level = $level;
$this->inlineContent = $inlineContent;
}
/**
*
*
*
*
* @param int
*/
public function setLevel($level) {
$this->level = $level;
}
/**
*
*
*
*
* @return int
*/
public function getLevel() {
return $this->level;
}
/**
*
*
*
*
* @param IList
*/
public function setInlineContent(IList $inlineContent) {
$this->inlineContent = $inlineContent;
}
/**
*
*
*
*
* @return IList
*/
public function getInlineContent() {
return $this->inlineContent;
}
/**
*
*
*
*
* @return int
*/
public function getNodeType() {
return NodeType::HEADING;
}
}
?>
<?php
namespace VTCompose\Markdown\Document;