Skip to content

Commit

Permalink
Added inclusion of images that are not figures
Browse files Browse the repository at this point in the history
  • Loading branch information
magabriel committed Oct 22, 2012
1 parent 4c8323f commit 82deb31
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
6 changes: 6 additions & 0 deletions app/Resources/Themes/Base/Epub2/Templates/figure.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{% if item.caption == '*' %}
<span class="image{{ item.align ? ' '~item.align : '' }}">
{{ item.content|replace( {'alt="*"': ''} ) }}
</span>
{% else %}
<div class="figure{{ item.align ? ' '~item.align : '' }}" id="{{ item.slug }}">
{{ item.content }}

{% if item.caption != '' %}
<p class="caption"><strong>{{ item.label }}</strong> {{ item.caption }}</p>
{% endif %}
</div>
{% endif %}
6 changes: 6 additions & 0 deletions app/Resources/Themes/Base/Html/Templates/figure.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{% if item.caption == '*' %}
<span class="image{{ item.align ? ' '~item.align : '' }}">
{{ item.content|replace( {'alt="*"': ''} ) }}
</span>
{% else %}
<div class="figure{{ item.align ? ' '~item.align : '' }}" id="{{ item.slug }}">
{{ item.content }}

{% if item.caption != '' %}
<p class="caption"><strong>{{ item.label }}</strong> {{ item.caption }}</p>
{% endif %}
</div>
{% endif %}
6 changes: 6 additions & 0 deletions app/Resources/Themes/Base/HtmlChunked/Templates/figure.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{% if item.caption == '*' %}
<span class="image{{ item.align ? ' '~item.align : '' }}">
{{ item.content|replace( {'alt="*"': ''} ) }}
</span>
{% else %}
<div class="figure{{ item.align ? ' '~item.align : '' }}" id="{{ item.slug }}">
{{ item.content }}

{% if item.caption != '' %}
<p class="caption"><strong>{{ item.label }}</strong> {{ item.caption }}</p>
{% endif %}
</div>
{% endif %}
6 changes: 6 additions & 0 deletions app/Resources/Themes/Base/Pdf/Templates/figure.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{% if item.caption == '*' %}
<span class="image{{ item.align ? ' '~item.align : '' }}">
{{ item.content|replace( {'alt="*"': ''} ) }}
</span>
{% else %}
<div class="figure{{ item.align ? ' '~item.align : '' }}" id="{{ item.slug }}">
{{ item.content }}

{% if item.caption != '' %}
<p class="caption"><strong>{{ item.label }}</strong> {{ item.caption }}</p>
{% endif %}
</div>
{% endif %}
19 changes: 11 additions & 8 deletions src/Easybook/Plugins/ImagePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,18 @@ function($matches) use ($event, $elementNumber, &$listOfImages, &$counter) {
)
);

// the publishing edition wants to label figures/images
if (in_array('figure', $event->app->edition('labels'))) {
$label = $event->app->getLabel('figure', $parameters);
$parameters['item']['label'] = $label;
// '*' in title means normal image instead of figure
if ('*' != $matches['title']) {
// the publishing edition wants to label figures/images
if (in_array('figure', $event->app->edition('labels'))) {
$label = $event->app->getLabel('figure', $parameters);
$parameters['item']['label'] = $label;
}

// add image datails to list-of-images
$listOfImages[] = $parameters;
}

// add image datails to list-of-images
$listOfImages[] = $parameters;


return $event->app->render('figure.twig', $parameters);
},
$item['content']
Expand Down

0 comments on commit 82deb31

Please sign in to comment.