forked from broquaint/Gitalist
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial stab at a working ContentMangler.
The idea is that the Resolver will figure out which Transformer will do the mangling. There can only be one Transformer presently, mostly so I don't get lost in a sea of complications. Much follow up work is needed and ideally another mangler e.g POD.
- Loading branch information
Dan Brook
committed
Aug 1, 2010
1 parent
d23c396
commit 52990a5
Showing
4 changed files
with
38 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
lib/Gitalist/ContentMangler/Transformer/SyntaxHighlight.pm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use MooseX::Declare; | ||
|
||
class Gitalist::ContentMangler::Transformer::SyntaxHighlight { | ||
method transform($c, $config) { | ||
$c->stash( | ||
syntax_css => $c->uri_for("/static/css/syntax/$config->{css}.css"), | ||
mangled => 1, | ||
); | ||
for (grep $_, $c->stash->{blobs} ? @{$c->stash->{blobs}} : $c->stash->{blob}) { | ||
$_ = $c->view('SyntaxHighlight')->render($c, $_, $config); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
[%- IF language == 'Diff' %]<link rel="stylesheet" type="text/css" href="[% c.uri_for('/static/css/syntax/Diff.css') %]"/>[% END -%] | ||
[%- IF language == 'Perl' %]<link rel="stylesheet" type="text/css" href="[% c.uri_for('/static/css/syntax/Perl.css') %]"/>[% END -%] | ||
[% IF syntax_css %]<link rel="stylesheet" type="text/css" href="[% syntax_css %]"/>[% END %] |