xref: /dokuwiki/inc/Parsing/ParserMode/GfmFile.php (revision b1c59bed2e3645a1f5f11438cdbe7d1596f4a3a4)
1*b1c59bedSAndreas Gohr<?php
2*b1c59bedSAndreas Gohr
3*b1c59bedSAndreas Gohrnamespace dokuwiki\Parsing\ParserMode;
4*b1c59bedSAndreas Gohr
5*b1c59bedSAndreas Gohr/**
6*b1c59bedSAndreas Gohr * GFM fenced code block with tilde fences: ~~~...~~~
7*b1c59bedSAndreas Gohr *
8*b1c59bedSAndreas Gohr * Tildes map to DokuWiki's `<file>` flavor — same rendering pipeline as
9*b1c59bedSAndreas Gohr * `code` but carries "this is a downloadable file" semantics. Markdown
10*b1c59bedSAndreas Gohr * authors pick the flavor by choosing the fence character.
11*b1c59bedSAndreas Gohr *
12*b1c59bedSAndreas Gohr * Unlike backtick fences, tilde info strings may contain any non-newline
13*b1c59bedSAndreas Gohr * character (spec example 116).
14*b1c59bedSAndreas Gohr */
15*b1c59bedSAndreas Gohrclass GfmFile extends GfmCode
16*b1c59bedSAndreas Gohr{
17*b1c59bedSAndreas Gohr    /** @inheritdoc */
18*b1c59bedSAndreas Gohr    protected $type = 'file';
19*b1c59bedSAndreas Gohr
20*b1c59bedSAndreas Gohr    /** @inheritdoc */
21*b1c59bedSAndreas Gohr    protected $fenceChar = '~';
22*b1c59bedSAndreas Gohr
23*b1c59bedSAndreas Gohr    /** @inheritdoc */
24*b1c59bedSAndreas Gohr    protected $infoClass = '[^\n]*';
25*b1c59bedSAndreas Gohr
26*b1c59bedSAndreas Gohr    /** @inheritdoc */
27*b1c59bedSAndreas Gohr    public function getSort()
28*b1c59bedSAndreas Gohr    {
29*b1c59bedSAndreas Gohr        return 210;
30*b1c59bedSAndreas Gohr    }
31*b1c59bedSAndreas Gohr
32*b1c59bedSAndreas Gohr    /** @inheritdoc */
33*b1c59bedSAndreas Gohr    protected function getModeName(): string
34*b1c59bedSAndreas Gohr    {
35*b1c59bedSAndreas Gohr        return 'gfm_file';
36*b1c59bedSAndreas Gohr    }
37*b1c59bedSAndreas Gohr}
38