diff --git a/classes/AbstractGallery.php b/classes/AbstractGallery.php
index dfd8354..0b329ab 100644
--- a/classes/AbstractGallery.php
+++ b/classes/AbstractGallery.php
@@ -4,8 +4,6 @@ namespace dokuwiki\plugin\gallery\classes;
abstract class AbstractGallery
{
-
-
/** @var Image[] */
protected $images = [];
/** @var Options */
@@ -14,7 +12,7 @@ abstract class AbstractGallery
/**
* Initialize the Gallery
*
- * @param string $src The source from where to get the images
+ * @param mixed $src The source from where to get the images
* @param Options $options Gallery configuration
*/
public function __construct($src, Options $options)
diff --git a/classes/FeedGallery.php b/classes/FeedGallery.php
index 361eb73..7db0cbd 100644
--- a/classes/FeedGallery.php
+++ b/classes/FeedGallery.php
@@ -9,7 +9,10 @@ class FeedGallery extends AbstractGallery
protected $feedHost;
protected $feedPath;
- /** @inheritdoc */
+ /**
+ * @inheritdoc
+ * @param string $url
+ */
public function __construct($url, Options $options)
{
parent::__construct($url, $options);
diff --git a/classes/ListGallery.php b/classes/ListGallery.php
new file mode 100644
index 0000000..1e99c66
--- /dev/null
+++ b/classes/ListGallery.php
@@ -0,0 +1,40 @@
+hasImageExtension($img)) continue;
+
+ try {
+ $image = new Image($img);
+ } catch (\Exception $e) {
+ // not found
+ continue;
+ }
+
+ if ($title) $image->setTitle($title);
+ if ($desc) $image->setDescription($desc);
+ $this->images[] = $image;
+ }
+ }
+}
diff --git a/classes/Options.php b/classes/Options.php
index 00d0a0c..55516e7 100644
--- a/classes/Options.php
+++ b/classes/Options.php
@@ -45,7 +45,7 @@ class Options
public function __construct()
{
// load options from config
- $plugin = plugin_load('syntax', 'gallery');
+ $plugin = plugin_load('syntax', 'gallery_main');
$this->thumbnailWidth = $plugin->getConf('thumbnail_width');
$this->thumbnailHeight = $plugin->getConf('thumbnail_height');
$this->lightboxWidth = $plugin->getConf('image_width');
diff --git a/classes/XHTMLFormatter.php b/classes/XHTMLFormatter.php
index aa0fb67..491a97d 100644
--- a/classes/XHTMLFormatter.php
+++ b/classes/XHTMLFormatter.php
@@ -51,7 +51,7 @@ class XHTMLFormatter extends BasicFormatter
{
if (count($pages) <= 1) return;
- $plugin = plugin_load('syntax', 'gallery');
+ $plugin = plugin_load('syntax', 'gallery_main');
$this->renderer->doc .= '
';
$this->renderer->doc .= '
' . $plugin->getLang('pages') . ' ';
@@ -157,7 +157,7 @@ class XHTMLFormatter extends BasicFormatter
$p = [
'class' => 'gallery-caption',
];
- $html .= '
' . hsc($image->getDescription()) . '
';
+ $html .= '
' . hsc($image->getDescription()) . '
';
}
if ($this->options->showname) {
$a = [
diff --git a/syntax/list.php b/syntax/list.php
new file mode 100644
index 0000000..b832a88
--- /dev/null
+++ b/syntax/list.php
@@ -0,0 +1,36 @@
+
+ */
+class syntax_plugin_gallery_list extends syntax_plugin_gallery_main
+{
+
+ /** @inheritDoc */
+ public function connectTo($mode)
+ {
+ $this->Lexer->addSpecialPattern('
.+?', $mode, 'plugin_gallery_list');
+ }
+
+ /** @inheritDoc */
+ public function handle($match, $state, $pos, Doku_Handler $handler)
+ {
+ $match = substr($match, 8, -10); //strip markup from start and end
+ [$params, $list] = sexplode('>', $match, 2);
+
+ $options = new Options();
+ $options->parseParameters($params);
+
+ $list = explode("\n", $list);
+ $list = array_map('trim', $list);
+ $list = array_filter($list);
+
+ return [$list, $options];
+ }
+}
+
diff --git a/syntax.php b/syntax/main.php
similarity index 90%
rename from syntax.php
rename to syntax/main.php
index 02e5b3e..4a72d0c 100644
--- a/syntax.php
+++ b/syntax/main.php
@@ -3,6 +3,7 @@
use dokuwiki\File\PageResolver;
use dokuwiki\plugin\gallery\classes\BasicFormatter;
use dokuwiki\plugin\gallery\classes\FeedGallery;
+use dokuwiki\plugin\gallery\classes\ListGallery;
use dokuwiki\plugin\gallery\classes\XHTMLFormatter;
use dokuwiki\plugin\gallery\classes\NamespaceGallery;
use dokuwiki\plugin\gallery\classes\Options;
@@ -15,7 +16,7 @@ use dokuwiki\plugin\gallery\classes\Options;
* @author Joe Lapp
* @author Dave Doyle
*/
-class syntax_plugin_gallery extends DokuWiki_Syntax_Plugin
+class syntax_plugin_gallery_main extends DokuWiki_Syntax_Plugin
{
/** @inheritdoc */
@@ -39,7 +40,7 @@ class syntax_plugin_gallery extends DokuWiki_Syntax_Plugin
/** @inheritdoc */
public function connectTo($mode)
{
- $this->Lexer->addSpecialPattern('\{\{gallery>[^}]*\}\}', $mode, 'plugin_gallery');
+ $this->Lexer->addSpecialPattern('\{\{gallery>[^}]*\}\}', $mode, 'plugin_gallery_main');
}
/** @inheritdoc */
@@ -80,7 +81,9 @@ class syntax_plugin_gallery extends DokuWiki_Syntax_Plugin
{
[$src, $options] = $data;
- if (preg_match('/^https?:\/\//i', $src)) {
+ if (is_array($src)) {
+ $gallery = new ListGallery($src, $options);
+ } elseif (preg_match('/^https?:\/\//i', $src)) {
$gallery = new FeedGallery($src, $options);
} else {
$gallery = new NamespaceGallery($src, $options);