diff --git a/.gitignore b/.gitignore index 497d582..ce68d6d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ stats.json +vendor/ diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3e0c4b4 --- /dev/null +++ b/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "michelf/php-markdown": "^1.8", + "mnapoli/front-yaml": "^1.6" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..5157a83 --- /dev/null +++ b/composer.lock @@ -0,0 +1,261 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "d6a1ecb21bac8642fb0b75ee1e70eced", + "packages": [ + { + "name": "erusev/parsedown", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "6678d59be48c4be64eaca6ce70bea48a09488cc2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/6678d59be48c4be64eaca6ce70bea48a09488cc2", + "reference": "6678d59be48c4be64eaca6ce70bea48a09488cc2", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "time": "2018-02-28T11:41:37+00:00" + }, + { + "name": "michelf/php-markdown", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/michelf/php-markdown.git", + "reference": "01ab082b355bf188d907b9929cd99b2923053495" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/01ab082b355bf188d907b9929cd99b2923053495", + "reference": "01ab082b355bf188d907b9929cd99b2923053495", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Michelf\\": "Michelf/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Michel Fortin", + "email": "michel.fortin@michelf.ca", + "homepage": "https://michelf.ca/", + "role": "Developer" + }, + { + "name": "John Gruber", + "homepage": "https://daringfireball.net/" + } + ], + "description": "PHP Markdown", + "homepage": "https://michelf.ca/projects/php-markdown/", + "keywords": [ + "markdown" + ], + "time": "2018-01-15T00:49:33+00:00" + }, + { + "name": "mnapoli/front-yaml", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/mnapoli/FrontYAML.git", + "reference": "24070ace8b741247bb3161cbb38ecc541268b296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mnapoli/FrontYAML/zipball/24070ace8b741247bb3161cbb38ecc541268b296", + "reference": "24070ace8b741247bb3161cbb38ecc541268b296", + "shasum": "" + }, + "require": { + "erusev/parsedown": "~1.0", + "php": ">=5.4.0", + "symfony/yaml": "~2.1|^3.0|^4.0" + }, + "require-dev": { + "league/commonmark": "~0.7", + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Mni\\FrontYAML\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "time": "2017-10-29T19:29:55+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/yaml", + "version": "v4.1.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "b832cc289608b6d305f62149df91529a2ab3c314" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/b832cc289608b6d305f62149df91529a2ab3c314", + "reference": "b832cc289608b6d305f62149df91529a2ab3c314", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-08-18T16:52:46+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/wiki/README.md b/wiki/README.md new file mode 100644 index 0000000..9a12f66 --- /dev/null +++ b/wiki/README.md @@ -0,0 +1,37 @@ +# tilde.chat wiki + +hi there, welcome to our wiki! + +to contribute to the wiki: + +* [fork the repo](https://git.tildeverse.org/repo/fork/53) + +* clone the repo to your local machine (or your public_html folder on the tilde.team box for live testing) +```sh +git clone git@tilde.chat:tildeverse/tilde.chat +``` + +* create a new branch for your page +```sh +git checkout -b my-new-page +``` + +* if you want to add a new page, copy `template.md` into your new page! +```sh +cp template.md my-new-page.md +``` + +* edit as needed! + +* commit your changes and [create a pull request](https://git.tildeverse.org/tildeverse/tilde.chat/pulls) :) +```sh +git add --all +git commit -m "added my-new-page" +git push origin my-new-page # this should match the branch name you created earlier +``` + +* create a pull request on the [site](https://git.tildeverse.org/tildeverse/tilde.chat) repo + +thanks!~ + +ps. if you have any questions, ask on irc! (preferably in #meta) diff --git a/wiki/index.php b/wiki/index.php new file mode 100644 index 0000000..d370758 --- /dev/null +++ b/wiki/index.php @@ -0,0 +1,87 @@ + + :target:before { + content:\"\"; + display:block; + height:90px; /* fixed header height*/ + margin:-90px 0 0; /* negative fixed header height */ + } + + + +"; + +class MDParser implements Mni\FrontYAML\Markdown\MarkdownParser { + public function __construct() { + $this->mdparser = new Michelf\MarkdownExtra(); + $this->mdparser->header_id_func = function ($header) { + return preg_replace('/[^a-z0-9]/', '-', strtolower($header)); + }; + } + + public function parse($markdown) { + return $this->mdparser->transform($markdown); + } +} + +$parser = new Mni\FrontYAML\Parser(null, new MDParser()); + + +if (!isset($_GET["page"]) || !file_exists("pages/{$_GET['page']}.md")) { + + $title = "tilde.chat~wiki"; + $additional_head .= " + + + + "; + include __DIR__.'/../header.php'; + // render wiki index ?> + +

tilde.chat wiki

+ +

welcome to the tilde.chat wiki!

+ +

if you want to contribute, check out the + source and open a PR! +

+ +
+

pages:

+ + parse(file_get_contents($page))->getYAML(); + if (!$yaml["published"]) continue; ?> + ">
+ parse(file_get_contents("pages/{$_GET["page"]}.md")); + $yml = $pg->getYAML(); + $title = $yml['title'] . " | tilde.chat~wiki"; + $description = $yml['description'] ?? "tilde.chat wiki article {$yml['title']}"; + $additional_head .= " + + + + "; + include __DIR__.'/../header.php'; + // show a single page ?> + + < ~wiki + +
+ getContent())?> +
+ .md"> + source + + +