wwwision / markwhen
可以将事件源内容仓库的状态渲染为 markwhen.com 语法
Requires
Requires (Dev)
- roave/security-advisories: dev-latest
README
可以将事件源内容仓库的状态渲染为 markwhen 语法
警告 此包主要作为如何编写简单的 事件源内容仓库 投影的演示。它可能在其当前形式下不太有用,但请随意复制并调整以满足您的需求!
使用方法
安装
通过 composer 安装
composer require wwwision/markwhen
注意 在撰写本文时,一些必需的包尚未在 packagist 上提供。您可以从 GitHub 下载到您的分发文件夹中: https://github.com/neos/neos-development-collection/tree/9.0/Neos.ContentRepository.Core https://github.com/neos/neos-development-collection/tree/9.0/Neos.ContentRepositoryRegistry https://github.com/neos/neos-development-collection/tree/9.0/Neos.ContentGraph.DoctrineDbalAdapter https://github.com/neos/neos-development-collection/tree/9.0/Neos.ContentGraph.PostgreSQLAdapter 并通过
composer require wwwision/markwhen neos/contentrepositoryregistry:@dev neos/contentgraph-doctrinedbaladapter:@dev neos/contentgraph-postgresqladapter:@dev
安装所有内容
之后,您可以回放投影以建立其初始状态
./flow cr:replay markwhen
一旦状态被持久化,您可以调用
./flow markwhen:render
将其转换为 markwhen 语法。这将直接输出到控制台输出,但您可以使用以下方法将其存储到文件中
./flow markwhen:render > out.mw
借助 Markwhen CLI 工具,您可以将它转换为时间线或日历
mw out.mv -d timeline.html mw out.mv -d calendar.html
或将渲染命令的输出直接管道到 mw
./flow markwhen:render | mw /dev/stdin -d timeline.html
此包中的文件
- MarkwhenCommandController.php:提供
markwhen:*
命令的 Flow CLI 控制器 - MarkwhenProjection.php:实际的内容仓库投影
- MarkwhenProjectionFactory.php:配置了内容仓库注册表的简单投影工厂
- MarkwhenProjectionState.php:PHP 类,它持有投影的状态,可以将其转换为(并从)JSON
- Settings.yaml:此包的配置,将投影注册到“默认”内容仓库
不同的内容仓库
此包将MarkwhenProjection
注册到默认
内容存储库。要将其注册到不同的实例,您可以相应地调整设置
Neos: ContentRepositoryRegistry: contentRepositories: 'acme': projections: 'Wwwision.Markwhen:Markwhen': factoryObjectName: Wwwision\Markwhen\MarkwhenProjectionFactory
或者,您可以与内容存储库的预设一起注册它,这样它就可以在多个CR中无需额外配置即可使用(见docs.neos.io)
Neos: ContentRepositoryRegistry: presets: 'somePreset': projections: 'Wwwision.Markwhen:Markwhen': factoryObjectName: Wwwision\Markwhen\MarkwhenProjectionFactory
别忘了指定命令的内容存储库ID
./flow cr:replay markwhen --content-repository acme ./flow markwhen:render --content-repository acme