Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

direct use of WWPlot or TikZImage objects in image() #561

Merged
merged 4 commits into from
Apr 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions macros/PGbasicmacros.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2911,9 +2911,9 @@ =head2 Macros for displaying images

image($image, width => 100, height => 100, tex_size => 800, alt => 'alt text', extra_html_tags => 'style="border:solid black 1pt"');

where C<$image> can be a local file path or URL, C<width> and C<height> are
pixel counts for HTML display, while C<tex_size> is per 1000 applied to
linewidth (for example 800 leads to 0.8\linewidth)
where C<$image> can be a local file path, URL, WWPlot object, or TikZImage object,
C<width> and C<height> are pixel counts for HTML display, while C<tex_size> is
per 1000 applied to linewidth (for example 800 leads to 0.8\linewidth)

image([$image1,$image2], width => 100, height => 100, tex_size => 800, alt => ['alt text 1','alt text 2'], extra_html_tags => 'style="border:solid black 1pt"');
image([$image1,$image2], width => 100, height => 100, tex_size => 800, alt => 'common alt text', extra_html_tags => 'style="border:solid black 1pt"');
Expand All @@ -2924,7 +2924,7 @@ =head2 Macros for displaying images

# More advanced macros
sub image {
my $image_ref = shift;
my $image_ref = shift;
my @opt = @_;
unless (scalar(@opt) % 2 == 0 ) {
warn "ERROR in image macro. A list of macros must be inclosed in square brackets.";
Expand Down Expand Up @@ -2974,7 +2974,9 @@ sub image {

my @output_list = ();
while(@image_list) {
my $imageURL = alias(shift @image_list)//'';
my $image_item = shift @image_list;
$image_item = insertGraph($image_item) if (ref $image_item eq 'WWPlot' || ref $image_item eq 'TikZImage');
my $imageURL = alias($image_item)//'';
$imageURL = ($envir{use_site_prefix})? $envir{use_site_prefix}.$imageURL : $imageURL;
my $out = "";

Expand Down