...
 
Commits (2)
File mode changed from 100755 to 100644
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>mira</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
TODO 100755 → 100644
File mode changed from 100755 to 100644
requires 'Mira', '00.07.56';
This diff is collapsed.
......@@ -270,7 +270,6 @@ sub execute {
use File::Spec::Functions;
use Template;
foreach my $of (keys %$address_base)
{
my $output_root = $address_base->{$of}->{template_root};
......@@ -287,11 +286,6 @@ sub execute {
}) || die "$Template::ERROR\n";
my $vars = $address_base->{$of}->{vars};
sub farsinum {
my $string = shift;
$string =~ tr/1234567890/۱۲۳۴۵۶۷۸۹۰/;
return $string;
}
$output_index->process(
$address_base->{$of}->{template_file},
......@@ -304,7 +298,7 @@ sub execute {
$diff = Time::HiRes::tv_interval($start_time);
print "The program ran for ", $diff, " seconds\n";
print "\nThe program ran for ", $diff, " seconds\n";
}
......
......@@ -45,27 +45,11 @@ sub preparator {
# use Mira::Control::Parser::img;
use Mira::Control::Content::Date;
#parallel::fork use Parallel::ForkManager;
foreach my $floor (@$floors)
{
#parallel::fork my $pm = Parallel::ForkManager->new( 4000 );
#parallel::fork $pm->set_waitpid_blocking_sleep(0);
#parallel::fork $pm->run_on_finish( sub {
#parallel::fork my ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data_ref) = @_;
#parallel::fork my $utid = $data_ref->{utid};
#parallel::fork my $values = $data_ref->{values};
#parallel::fork if (not exists $data->{$utid})
#parallel::fork {
#parallel::fork $data->add($utid, $values);
#parallel::fork $floors_data->add($floor, $utid);
#parallel::fork }
#parallel::fork });
#parallel::fork
foreach my $file (@{$files->{$floor}})
{
# $pm->start and next;
my $parser = Mira::Control::Parser::Entry->parse(entry => $file, floor => $floor);
next unless $parser;
......@@ -94,9 +78,7 @@ sub preparator {
.">". $data->{$utid}->{SPEC}->{file_address}
."\n";
}
#parallel::fork $pm->finish(0, { utid => $utid, values => $values });
}
#parallel::fork $pm->wait_all_children;
}
......
......@@ -9,37 +9,38 @@ use 5.012;
use Carp;
sub markup {
my $class = shift;
my $body = shift;
my $class = shift;
my $body = shift;
my $markup_lang = shift || 'md';
if ($markup_lang and $markup_lang =~ /^(markdown|md|bbcode|textile)$/i)
if ( $markup_lang and $markup_lang =~ /^(markdown|md|bbcode|textile)$/i )
{
use Markup::Unified;
$markup_lang = 'markdown' if $markup_lang =~ /^md$/i;
$markup_lang = lc($markup_lang);
my $markup = Markup::Unified->new();
$markup->format($body, $markup_lang);
$markup->format( $body, $markup_lang );
$markup->formatted;
$body = $markup->{fvalue};
$body =~ s/(.*)\n$/$1/; #remove new line which make by text::markdown at end
$body =~
s/(.*)\n$/$1/; #remove new line which make by text::markdown at end
}
if ($markup_lang and $markup_lang =~ /^(miraMarkdown|mmd|markmod)$/i)
if ( $markup_lang and $markup_lang =~ /^(miraMarkdown|mmd|markmod)$/i )
{
use Text::Markmoredown 'markmod';
$body = markmod($body);
}
if ($markup_lang and $markup_lang =~ /^(text|txt)$/i)
if ( $markup_lang and $markup_lang =~ /^(text|txt)$/i )
{
$body =~ s/\n/\n<br>/g;
$body =~ s/\n/\n<br>/g;
}
##### Less and More section #####
my $fbody = $body;
$body = {};
if ($fbody =~ /(?<less>.*)<!--\s*more\s*-->(?<more>.*)/s)
if ( $fbody =~ /(?<less>.*)<!--\s*more\s*-->(?<more>.*)/s )
{
$body->{less} = $+{less};
$fbody =~ s:<!--\s*more\s*-->:<a name="more"></a>:;
......@@ -57,5 +58,4 @@ sub markup {
return $body;
}
1;
......@@ -10,89 +10,90 @@ use base qw(Text::MultiMarkdown);
our @EXPORT_OK = qw(mira_markdown);
sub mira_markdown {
my ( $self, $text, $options ) = @_;
# Detect functional mode, and create an instance for this run
unless (ref $self)
{
if ( $self ne __PACKAGE__ )
{
my $ob = __PACKAGE__->new();
# $self is text, $text is options
return $ob->mira_markdown($self, $text);
} else
{
croak('Calling ' . $self . '->markdown (as a class method) is not supported.');
my ( $self, $text, $options ) = @_;
# Detect functional mode, and create an instance for this run
unless ( ref $self ) {
if ( $self ne __PACKAGE__ ) {
my $ob = __PACKAGE__->new();
# $self is text, $text is options
return $ob->mira_markdown( $self, $text );
}
else {
croak( 'Calling '
. $self
. '->markdown (as a class method) is not supported.' );
}
}
}
$options ||= {};
$options ||= {};
%$self = (%{ $self->{params} }, %$options, params => $self->{params});
%$self = ( %{ $self->{params} }, %$options, params => $self->{params} );
$self->SUPER::_CleanUpRunData($options);
$self->SUPER::_CleanUpRunData($options);
$text = $self->_mira_markdown($text);
$text = $self->_mira_markdown($text);
return $self->SUPER::_Markdown($text);
return $self->SUPER::_Markdown($text);
}
sub _mira_markdown {
my ($self, $text) = @_;
my ( $self, $text ) = @_;
$text =~ s{\r\n}{\n}g; # DOS to Unix
$text =~ s{\r}{\n}g; # Mac to Unix
$text =~ s{\r\n}{\n}g; # DOS to Unix
$text =~ s{\r}{\n}g; # Mac to Unix
$text = $self->_code_block($text);
$text = $self->_code_block($text);
return $text;
return $text;
}
sub _code_block {
my ($self, $text) = @_;
my $less_than_tab = $self->{tab_width} - 1;
my ( $self, $text ) = @_;
my $less_than_tab = $self->{tab_width} - 1;
while ($text =~ m{
while (
$text =~ m{
^((?<spaces>[ \t]*)```) # ^([ ]{0,$less_than_tab}```)
[ \t]*(?<class>.*)?$
(?<code>[\w\W]*?)
(?:^\1) # (?:^\1|\Z)
\s*\n
}omx)
{
my $class = $+{class} if $+{class};
my $spaces = $+{spaces} if $+{spaces};
if ($class)
{
$class = "language-$class" if $class !~ m{^:};
$class =~ s{^:}{};
}
my $code = $+{code} if $+{code};
if ($code)
{
$code =~ s{^\n|\n$}{}g;
$code = $self->_EncodeCode($code);
$code = $self->_Detab($code);
$code =~ s/\A\n+//; # trim leading newlines
$code =~ s/\n+\z//; # trim trailing newlines
$code =~ s/^$spaces// if $spaces;
}
my $pre = $spaces ? $spaces : '';
$pre .= "<pre><code";
$pre .= " class=\"$class\"" if $class;
$pre .= ">";
$pre .= $code if $code;
$pre .= "\n</code></pre>\n";
$text =~ s{
}omx
)
{
my $class = $+{class} if $+{class};
my $spaces = $+{spaces} if $+{spaces};
if ($class) {
$class = "language-$class" if $class !~ m{^:};
$class =~ s{^:}{};
}
my $code = $+{code} if $+{code};
if ($code) {
$code =~ s{^\n|\n$}{}g;
$code = $self->_EncodeCode($code);
$code = $self->_Detab($code);
$code =~ s/\A\n+//; # trim leading newlines
$code =~ s/\n+\z//; # trim trailing newlines
$code =~ s/^$spaces// if $spaces;
}
my $pre = $spaces ? $spaces : '';
$pre .= "<pre><code";
$pre .= " class=\"$class\"" if $class;
$pre .= ">";
$pre .= $code if $code;
$pre .= "\n</code></pre>\n";
$text =~ s{
^(([ \t]*)```) # ^([ ]{0,$less_than_tab}```)
[ \t]*(?<class>.*)?$
(?<code>[\w\W]*?)
(?:^\1|\Z)
\s*\n
}{$pre}omx;
}
}
return $text;
return $text;
}