Closed J5lx closed 10 months ago
This is a really good idea!
On 4 August 2015 at 19:22, J5lx notifications@github.com wrote:
Just an idea I came up with while working on #34 https://github.com/markwatkinson/luminous/pull/34. Now that Luminous is (well, will be) relying on Composers autoloader, wouldn’t it make sense to allow for specifying the formatter via the class name? Here’s why it would be useful (IMHO):
- Suppose you’re working on a project J5lx\AwesomeProject which relies on Luminous for syntax highlighting.
- For this project you created a custom PDF formatter J5lx\AwesomeProject\PdfFormatter (btw, I’m not actually working on a PDF formatter, even though this might be an interesting project)
- You want to use the luminous CLI to test your formatter. You do this by running vendor/bin/luminous -f J5lx\AwesomeProject\PdfFormatter -i test.php -o test.pdf
- In case the vendor/bin/luminous looks a bit strange to you: This is a symlink to the Luminous CLI that is created by composer in projects that require Luminous (since J5lx/luminous@674c03f https://github.com/J5lx/luminous/commit/674c03f77fc11ce54bc3e7c2803e582a549f7048 )
- By combining this with evince’s autoreload feature you can now efficiently test your PDF formatter!
Of course this would also be nice for scanners, however some extra work would be required to make it work for those as well, since there needs to be a way to specify name and description of the language.
What do you think about this?
— Reply to this email directly or view it on GitHub https://github.com/markwatkinson/luminous/issues/35.
Regarding support for specifying scanners: How about adding an option -s name[,name...]:[scanner]:description
? I think this syntax would cover pretty much every use case:
scanner
value would be equivalent to null
description
could contain colons, while the usage of colons is (probably) unlikely in name
and forbidden in scanner
(since namespace and class names can’t contain colons)E.g. -s 'php,phtml:Luminous\\Scanners\\PhpScanner:PHP: Hypertext Preprocessor'
would yield name => ["php", "phtml"], scanner => "Luminous\Scanners\PhpScanner" and description => "PHP: Hypertext Preprocessor".
Sounds good to me.
Just an idea I came up with while working on #34. Now that Luminous is (well, will be) relying on Composers autoloader, wouldn’t it make sense to allow for specifying the formatter via the class name? Here’s why it would be useful (IMHO):
J5lx\AwesomeProject
which relies on Luminous for syntax highlighting.J5lx\AwesomeProject\PdfFormatter
(btw, I’m not actually working on a PDF formatter, even though this might be an interesting project)vendor/bin/luminous -f J5lx\\AwesomeProject\\PdfFormatter -i test.php -o test.pdf
vendor/bin/luminous
looks a bit strange to you: This is a symlink to the Luminous CLI that is created by composer in projects that require Luminous (since J5lx/luminous@674c03f77fc11ce54bc3e7c2803e582a549f7048)Of course this would also be nice for scanners, however some extra work would be required to make it work for those as well, since there needs to be a way to specify name and description of the language.
What do you think about this?