events.pm: output depends on format
This commit is contained in:
@@ -382,28 +382,9 @@ sub modify_results ($$$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#build content
|
#build content
|
||||||
if ( ( defined $params->{template} )
|
if ( ( defined $params->{template} ) && ( $params->{template} =~ /\.html/ ) ) {
|
||||||
&& ( $params->{template} =~ /\.html/ ) )
|
$result->{html_content} = events::format($result, 'content') if defined $result->{content};
|
||||||
{
|
$result->{html_topic} = events::format($result, 'topic') if defined $result->{topic};
|
||||||
if ( defined $result->{content} ) {
|
|
||||||
if (($result->{content_format}//'') eq 'markdown'){
|
|
||||||
$result->{content} = markup::markdown_to_html( $result->{content} );
|
|
||||||
}else{
|
|
||||||
$result->{content} = markup::fix_line_ends( $result->{content} );
|
|
||||||
$result->{content} = markup::creole_to_html( $result->{content} );
|
|
||||||
}
|
|
||||||
$result->{html_content} = $result->{content};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( defined $result->{topic} ) {
|
|
||||||
if (($result->{content_format}//'') eq 'markdown'){
|
|
||||||
$result->{topic} = markup::markdown_to_html( $result->{topic} );
|
|
||||||
}else{
|
|
||||||
$result->{topic} = markup::fix_line_ends( $result->{topic} );
|
|
||||||
$result->{topic} = markup::creole_to_html( $result->{topic} );
|
|
||||||
}
|
|
||||||
$result->{html_topic} = $result->{topic};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#detect if images are in content or topic field
|
#detect if images are in content or topic field
|
||||||
@@ -435,6 +416,17 @@ sub modify_results ($$$$) {
|
|||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub format {
|
||||||
|
my ($event, $field) = @_;
|
||||||
|
if (($event->{content_format}//'') eq 'markdown'){
|
||||||
|
$event->{$field} = markup::markdown_to_html( $event->{$field} );
|
||||||
|
} else {
|
||||||
|
$event->{$field} = markup::fix_line_ends( $event->{$field} );
|
||||||
|
$event->{$field} = markup::creole_to_html( $event->{$field} );
|
||||||
|
}
|
||||||
|
return $event->{$field};
|
||||||
|
}
|
||||||
|
|
||||||
sub add_recurrence_dates {
|
sub add_recurrence_dates {
|
||||||
my ($config, $results) = @_;
|
my ($config, $results) = @_;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user