1be906b56SAndreas Gohr<?php 2be906b56SAndreas Gohr 3be906b56SAndreas Gohrnamespace dokuwiki\Parsing\Handler; 4be906b56SAndreas Gohr 5*bf6e4f0dSAndreas Gohr/** 6*bf6e4f0dSAndreas Gohr * CallWriter rewriter for DokuWiki lists. 7*bf6e4f0dSAndreas Gohr * 8*bf6e4f0dSAndreas Gohr * DokuWiki's list syntax requires 2 spaces of indent per nesting level and 9*bf6e4f0dSAndreas Gohr * uses `*` for unordered, `-` for ordered. Ordered lists do not carry a 10*bf6e4f0dSAndreas Gohr * start number. The state machine lives in {@see AbstractListsRewriter}; 11*bf6e4f0dSAndreas Gohr * this class supplies only the marker parser. 12*bf6e4f0dSAndreas Gohr */ 13*bf6e4f0dSAndreas Gohrclass Lists extends AbstractListsRewriter 14be906b56SAndreas Gohr{ 15be906b56SAndreas Gohr /** @inheritdoc */ 16*bf6e4f0dSAndreas Gohr protected function interpretSyntax(string $match): array 17be906b56SAndreas Gohr { 18*bf6e4f0dSAndreas Gohr $type = str_ends_with($match, '*') ? 'u' : 'o'; 19*bf6e4f0dSAndreas Gohr $depth = substr_count(str_replace("\t", ' ', $match), ' ') + 1; 20*bf6e4f0dSAndreas Gohr return ['depth' => $depth, 'type' => $type]; 21be906b56SAndreas Gohr } 22be906b56SAndreas Gohr} 23