rework of tape & string framework
This commit is contained in:
parent
6defb268fb
commit
5827f9cf95
@ -1,3 +1,5 @@
|
|||||||
root=true
|
root=true
|
||||||
[*]
|
[*]
|
||||||
line_ending
|
end_of_line=lf
|
||||||
|
trim_trailing_whitespace=true
|
||||||
|
insert_final_newline=true
|
@ -7,7 +7,7 @@ for i in ${files[@]}; do
|
|||||||
if test -d $i; then
|
if test -d $i; then
|
||||||
mkdir -p ../$i
|
mkdir -p ../$i
|
||||||
elif test -f $i; then
|
elif test -f $i; then
|
||||||
_tape/render.pl $i
|
tape $i | m4 -DTITLE=`${prog[title]} $i` .
|
||||||
else
|
else
|
||||||
echo "Skipping $i, unknown file type"
|
echo "Skipping $i, unknown file type"
|
||||||
fi
|
fi
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
#!/usr/bin/env perl
|
|
||||||
use strict; use warnings;
|
|
||||||
use File::Slurp; use File::Basename;
|
|
||||||
push(@INC,dirname(__FILE__));
|
|
||||||
use tape;
|
|
||||||
my $fi = $ARGV[1];
|
|
||||||
if(substr($fi,0,1)=='_') {
|
|
||||||
print STDERR "Skipping file: $fi, ignored.";
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
my @fc = split(/\./, $fi);
|
|
||||||
my $fo = $fc[0].'.html';
|
|
||||||
if(!exists($fc{$fc[1]}) {
|
|
||||||
print STDERR "Skipping file: $fi, no way to process extension.";
|
|
||||||
exit 1;
|
|
||||||
}
|
|
||||||
my $out=tape::render{$fc[1]}(read_file($fi);
|
|
||||||
open $of, ">_tmp";
|
|
||||||
if(exists($tape::titles{$fi})) {
|
|
||||||
print $of `m4 -DTITLE=$tape::titles{$fi} main.html.m4<<.
|
|
||||||
$out
|
|
||||||
.`;
|
|
||||||
}
|
|
||||||
close $of;
|
|
@ -1,40 +0,0 @@
|
|||||||
package tape;
|
|
||||||
use strict; use warnings;
|
|
||||||
use Text::Textile;
|
|
||||||
use Text::Markdown;
|
|
||||||
use Org::Parser; use Org::To::HTML;
|
|
||||||
use CSS::Sass;
|
|
||||||
use Exporter qw(Export);
|
|
||||||
use constant {
|
|
||||||
true => 1,
|
|
||||||
false => 0
|
|
||||||
}
|
|
||||||
our @EXPORT = qw(render titles);
|
|
||||||
sub scss {
|
|
||||||
my $sassc = CSS::Sass->new;
|
|
||||||
return $sassc->compile($_[0])[0];
|
|
||||||
}
|
|
||||||
my %render = (
|
|
||||||
'txti' => sub {
|
|
||||||
my $p = Text::Textile->new;
|
|
||||||
$p->css(false);
|
|
||||||
return $p->process($_[0]);
|
|
||||||
},
|
|
||||||
'md' => sub {
|
|
||||||
my $p = Text::Markdown->new;
|
|
||||||
return $p->markdown($_[0]);
|
|
||||||
},
|
|
||||||
'org' => sub {
|
|
||||||
my $p = Org::Parser->new;
|
|
||||||
my $o = Org::To::HTML->new;
|
|
||||||
return $o->export_document($p->parse($_[0]));
|
|
||||||
},
|
|
||||||
'sass' => sub {
|
|
||||||
return scss(sass2scss($_[0]));
|
|
||||||
},
|
|
||||||
'scss' => &scss
|
|
||||||
);
|
|
||||||
my %titles = (
|
|
||||||
"not_found.txti" => "404 - Page Not Found",
|
|
||||||
"index.txti" => "Atlas48's Archives"
|
|
||||||
);
|
|
9
src/_tape/titlelookup.rs
Normal file
9
src/_tape/titlelookup.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
use std::env::args;
|
||||||
|
fn main() {
|
||||||
|
let l:String = args().next().unwrap();
|
||||||
|
match l.as_str() {
|
||||||
|
"not_found.txti" => println!("404 - Page Not Found"),
|
||||||
|
"index.txti" => println!("Atlas48's Archives"),
|
||||||
|
_ => println!("Atlas48's Archives"),
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user