middlemac-extras 1.0.6 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitattributes +4 -0
- data/.gitignore +8 -1
- data/.yardopts +7 -0
- data/CHANGELOG.md +55 -9
- data/Rakefile +206 -7
- data/documentation_project/Gemfile +3 -3
- data/documentation_project/config.rb +2 -6
- data/documentation_project/source/api_reference.html.md.erb +38 -0
- data/documentation_project/source/cli.html.md.erb +4 -3
- data/documentation_project/source/config_rb.html.md.erb +1 -2
- data/documentation_project/source/css_image_sizes.html.md.erb +2 -3
- data/documentation_project/source/image_tag.html.md.erb +1 -2
- data/documentation_project/source/index.html.md.erb +8 -7
- data/documentation_project/source/license.html.md.erb +1 -2
- data/documentation_project/source/md_images.html.md.erb +1 -2
- data/documentation_project/source/md_links.html.md.erb +1 -2
- data/documentation_project/source/partials/_yard_config.erb +200 -0
- data/documentation_project/source/partials/_yard_helpers.erb +192 -0
- data/documentation_project/source/partials/_yard_helpers_extended.erb +135 -0
- data/documentation_project/source/stylesheets/_middlemac_minimal.scss +281 -0
- data/features/helpers.feature +39 -0
- data/features/support/env.rb +20 -0
- data/fixtures/middlemac_extras_app/config.rb +7 -0
- data/fixtures/middlemac_extras_app/source/images/middlemac-extras-small.png +0 -0
- data/fixtures/middlemac_extras_app/source/images/middlemac-extras-small@2x.png +0 -0
- data/fixtures/middlemac_extras_app/source/images/middlemac-extras-smaller.png +0 -0
- data/fixtures/middlemac_extras_app/source/index.html.md.erb +31 -0
- data/lib/middlemac-extras/extension.rb +187 -61
- data/lib/middlemac-extras/version.rb +1 -1
- data/middlemac-extras.gemspec +44 -17
- data/yard/readme.md +6 -0
- data/yard/template-grouped/default/module/html/method_details_list.erb +11 -0
- data/yard/template-partials/default/method_details/setup.rb +4 -0
- data/yard/template-partials/default/module/html/attribute_details.erb +9 -0
- data/yard/template-partials/default/module/html/method_details_list.erb +10 -0
- data/yard/template-partials/default/module/setup.rb +6 -0
- data/yard/template-partials/default/onefile/html/layout.erb +1 -0
- data/yard/template-partials/default/onefile/html/setup.rb +4 -0
- data/yard/yard_extensions.rb +109 -0
- metadata +118 -23
@@ -0,0 +1,135 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
|
6
|
+
<div class="method_details_list">
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
<div class="method_details first">
|
11
|
+
<h3 class="signature first" id="image_tag-instance_method">
|
12
|
+
|
13
|
+
#<strong>image_tag</strong>(path, params = {}) ⇒ <tt>String</tt>
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
</h3><div class="docstring">
|
20
|
+
<div class="discussion">
|
21
|
+
<p>With the proper options enabled this helper extends
|
22
|
+
the built-in functionality of <strong>Middleman</strong>’s helpers
|
23
|
+
in a couple of ways. With <code>:retina_srcset</code> enabled,
|
24
|
+
automatic <code>srcset</code> attributes will be applied to
|
25
|
+
<code><img></code> tags if an @2x version of the specified image
|
26
|
+
is found. With <code>:img_auto_extensions</code> it’s possible to
|
27
|
+
specify image names without the file name extension.</p>
|
28
|
+
|
29
|
+
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<div class="tags">
|
33
|
+
<p class="tag_title">Parameters:</p>
|
34
|
+
<ul class="param">
|
35
|
+
|
36
|
+
<li>
|
37
|
+
|
38
|
+
<span class='name'>path</span>
|
39
|
+
|
40
|
+
|
41
|
+
<span class='type'>(<tt>String</tt>)</span>
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
—
|
46
|
+
<div class='inline'><p>Specify path to the image file.</p>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
</li>
|
50
|
+
|
51
|
+
<li>
|
52
|
+
|
53
|
+
<span class='name'>params</span>
|
54
|
+
|
55
|
+
|
56
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
57
|
+
|
58
|
+
|
59
|
+
<em class="default">(defaults to: <tt>{}</tt>)</em>
|
60
|
+
|
61
|
+
|
62
|
+
—
|
63
|
+
<div class='inline'><p>Optional parameters to pass to
|
64
|
+
the helper. <strong>Middleman</strong> (and other extensions)
|
65
|
+
provide other parameters in addition to these.</p>
|
66
|
+
</div>
|
67
|
+
|
68
|
+
</li>
|
69
|
+
|
70
|
+
</ul>
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<p class="tag_title">Options Hash (<tt>params</tt>):</p>
|
78
|
+
<ul class="option">
|
79
|
+
|
80
|
+
<li>
|
81
|
+
<span class="name">:img_auto_extensions</span>
|
82
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
83
|
+
<span class="default">
|
84
|
+
|
85
|
+
</span>
|
86
|
+
|
87
|
+
— <div class='inline'><p>Allows
|
88
|
+
control of the automatic image extensions option
|
89
|
+
on a per-use basis.</p>
|
90
|
+
</div>
|
91
|
+
|
92
|
+
</li>
|
93
|
+
|
94
|
+
<li>
|
95
|
+
<span class="name">:retina_srcset</span>
|
96
|
+
<span class="type">(<tt>Boolean</tt>)</span>
|
97
|
+
<span class="default">
|
98
|
+
|
99
|
+
</span>
|
100
|
+
|
101
|
+
— <div class='inline'><p>Allows control
|
102
|
+
of the automatic @2x images feature on a per-use
|
103
|
+
basis.</p>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
</li>
|
107
|
+
|
108
|
+
</ul>
|
109
|
+
|
110
|
+
|
111
|
+
<p class="tag_title">Returns:</p>
|
112
|
+
<ul class="return">
|
113
|
+
|
114
|
+
<li>
|
115
|
+
|
116
|
+
|
117
|
+
<span class='type'>(<tt>String</tt>)</span>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
—
|
122
|
+
<div class='inline'><p>Returns an HTML <code><img></code> tag.</p>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
</li>
|
126
|
+
|
127
|
+
</ul>
|
128
|
+
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
|
@@ -514,3 +514,284 @@ div.image_article:after
|
|
514
514
|
display: table;
|
515
515
|
clear: both;
|
516
516
|
}
|
517
|
+
|
518
|
+
//*************************************
|
519
|
+
// For partials extracted from YARD
|
520
|
+
//*************************************
|
521
|
+
|
522
|
+
$yard_color_symbol: rgba(0,136,204,1);
|
523
|
+
$yard_font_mono: Menlo, Consolas, Monaco, Courier, monospace;
|
524
|
+
|
525
|
+
div.attr_details,
|
526
|
+
div.method_details_list
|
527
|
+
{
|
528
|
+
.inline
|
529
|
+
{
|
530
|
+
display: inline;
|
531
|
+
|
532
|
+
p:first-child
|
533
|
+
{
|
534
|
+
display: inline;
|
535
|
+
}
|
536
|
+
}
|
537
|
+
|
538
|
+
.method_details
|
539
|
+
{
|
540
|
+
border-top: 1px dotted #aaa;
|
541
|
+
margin-top: 15px;
|
542
|
+
padding-top: 0;
|
543
|
+
|
544
|
+
&.first
|
545
|
+
{
|
546
|
+
border: 0;
|
547
|
+
}
|
548
|
+
}
|
549
|
+
|
550
|
+
p.signature,
|
551
|
+
h3.signature
|
552
|
+
{
|
553
|
+
font-size: 0.9em;
|
554
|
+
font-weight: normal;
|
555
|
+
font-family: $yard_font_mono;
|
556
|
+
padding: 6px 10px;
|
557
|
+
margin-top: 18px;
|
558
|
+
background: #f2f3ff;
|
559
|
+
border: 1px solid #d8d8e5;
|
560
|
+
-moz-border-radius: 3px;
|
561
|
+
-webkit-border-radius: 3px;
|
562
|
+
color: $yard_color_symbol;
|
563
|
+
|
564
|
+
strong
|
565
|
+
{
|
566
|
+
color: inherit;;
|
567
|
+
}
|
568
|
+
|
569
|
+
tt
|
570
|
+
{
|
571
|
+
font-family: inherit;
|
572
|
+
}
|
573
|
+
|
574
|
+
.overload
|
575
|
+
{
|
576
|
+
display: block;
|
577
|
+
}
|
578
|
+
|
579
|
+
.extras
|
580
|
+
{
|
581
|
+
font-weight: normal;
|
582
|
+
font-family: sans-serif;
|
583
|
+
color: #444;
|
584
|
+
font-size: 1em;
|
585
|
+
}
|
586
|
+
|
587
|
+
.not_defined_here,
|
588
|
+
.aliases
|
589
|
+
{
|
590
|
+
display: block;
|
591
|
+
font-weight: normal;
|
592
|
+
font-size: 0.9em;
|
593
|
+
font-family: $yard_font_mono;
|
594
|
+
margin-top: 0px;
|
595
|
+
color: #555;
|
596
|
+
|
597
|
+
.names
|
598
|
+
{
|
599
|
+
font-family: $yard_font_mono;
|
600
|
+
font-weight: bold;
|
601
|
+
color: #000;
|
602
|
+
font-size: 1.2em;
|
603
|
+
}
|
604
|
+
}
|
605
|
+
}
|
606
|
+
|
607
|
+
div.docstring
|
608
|
+
{
|
609
|
+
div.discussion
|
610
|
+
{
|
611
|
+
|
612
|
+
}
|
613
|
+
}
|
614
|
+
|
615
|
+
div.tags
|
616
|
+
{
|
617
|
+
margin-bottom: 12px;
|
618
|
+
|
619
|
+
.tag_title
|
620
|
+
{
|
621
|
+
font-size: 1em;
|
622
|
+
margin-bottom: 0;
|
623
|
+
font-weight: bold; }
|
624
|
+
|
625
|
+
ul
|
626
|
+
{
|
627
|
+
margin-top: 5px;
|
628
|
+
padding-left: 30px;
|
629
|
+
list-style: square;
|
630
|
+
|
631
|
+
li {
|
632
|
+
margin-bottom: 3px;
|
633
|
+
}
|
634
|
+
|
635
|
+
.name
|
636
|
+
{
|
637
|
+
font-family: $yard_font_mono;
|
638
|
+
font-weight: bold;
|
639
|
+
}
|
640
|
+
|
641
|
+
.note
|
642
|
+
{
|
643
|
+
padding: 3px 6px;
|
644
|
+
}
|
645
|
+
|
646
|
+
}
|
647
|
+
|
648
|
+
.examples
|
649
|
+
{
|
650
|
+
.tag_title
|
651
|
+
{
|
652
|
+
margin-bottom: 10px;
|
653
|
+
font-weight: bold;
|
654
|
+
}
|
655
|
+
|
656
|
+
.inline p
|
657
|
+
{
|
658
|
+
padding: 0;
|
659
|
+
margin: 0;
|
660
|
+
margin-left: 15px;
|
661
|
+
font-weight: bold;
|
662
|
+
font-size: 0.9em;
|
663
|
+
}
|
664
|
+
}
|
665
|
+
|
666
|
+
.overload
|
667
|
+
{
|
668
|
+
.overload_item
|
669
|
+
{
|
670
|
+
list-style: none;
|
671
|
+
margin-bottom: 25px;
|
672
|
+
|
673
|
+
.signature
|
674
|
+
{
|
675
|
+
padding: 2px 8px;
|
676
|
+
background: #e5e8ff;
|
677
|
+
border: 1px solid #d8d8e5;
|
678
|
+
-moz-border-radius: 3px;
|
679
|
+
-webkit-border-radius: 3px;
|
680
|
+
}
|
681
|
+
}
|
682
|
+
|
683
|
+
.signature
|
684
|
+
{ margin-left: -15px;
|
685
|
+
font-family: monospace;
|
686
|
+
display: block;
|
687
|
+
font-size: 1.1em;
|
688
|
+
}
|
689
|
+
|
690
|
+
.docstring
|
691
|
+
{
|
692
|
+
margin-top: 15px;
|
693
|
+
}
|
694
|
+
|
695
|
+
}
|
696
|
+
|
697
|
+
/* syntax highlighting */
|
698
|
+
//.source_code { display: none; padding: 3px 8px; border-left: 8px solid #ddd; margin-top: 5px; }
|
699
|
+
//#filecontents pre.code, .docstring pre.code, .source_code pre { font-family: monospace; }
|
700
|
+
//#filecontents pre.code, .docstring pre.code { display: block; }
|
701
|
+
//.source_code .lines { padding-right: 12px; color: #555; text-align: right; }
|
702
|
+
|
703
|
+
#filecontents pre.code,
|
704
|
+
.docstring pre.code,
|
705
|
+
pre.example
|
706
|
+
{
|
707
|
+
padding: 5px 12px; margin-top: 4px; border: 1px solid #eef; background: #f5f5ff;
|
708
|
+
}
|
709
|
+
|
710
|
+
pre.code
|
711
|
+
{
|
712
|
+
color: #000;
|
713
|
+
|
714
|
+
info.file { color: #555; }
|
715
|
+
|
716
|
+
.val { color: #036A07; }
|
717
|
+
|
718
|
+
.tstring_content,
|
719
|
+
.heredoc_beg,
|
720
|
+
.heredoc_end,
|
721
|
+
.qwords_beg,
|
722
|
+
.qwords_end,
|
723
|
+
.tstring,
|
724
|
+
.dstring
|
725
|
+
{
|
726
|
+
color: #036A07;
|
727
|
+
}
|
728
|
+
|
729
|
+
.fid,
|
730
|
+
.rubyid_new,
|
731
|
+
.rubyid_to_s,
|
732
|
+
.rubyid_to_sym,
|
733
|
+
.rubyid_to_f,
|
734
|
+
.dot + pre.code .id,
|
735
|
+
.rubyid_to_i pre.code .rubyid_each
|
736
|
+
{
|
737
|
+
color: #0085FF;
|
738
|
+
}
|
739
|
+
|
740
|
+
.comment
|
741
|
+
{
|
742
|
+
color: #0066FF;
|
743
|
+
}
|
744
|
+
|
745
|
+
.const,
|
746
|
+
.constant
|
747
|
+
{
|
748
|
+
color: #585CF6;
|
749
|
+
}
|
750
|
+
|
751
|
+
.label,
|
752
|
+
.symbol
|
753
|
+
{
|
754
|
+
color: #C5060B;
|
755
|
+
}
|
756
|
+
|
757
|
+
.kw,
|
758
|
+
.rubyid_require,
|
759
|
+
.rubyid_extend,
|
760
|
+
.rubyid_include
|
761
|
+
{
|
762
|
+
color: #0000FF;
|
763
|
+
}
|
764
|
+
|
765
|
+
.ivar
|
766
|
+
{
|
767
|
+
color: #318495;
|
768
|
+
}
|
769
|
+
|
770
|
+
.gvar,
|
771
|
+
.rubyid_backref,
|
772
|
+
.rubyid_nth_ref
|
773
|
+
{
|
774
|
+
color: #6D79DE;
|
775
|
+
}
|
776
|
+
|
777
|
+
.regexp,
|
778
|
+
.dregexp
|
779
|
+
{
|
780
|
+
color: #036A07;
|
781
|
+
}
|
782
|
+
|
783
|
+
a
|
784
|
+
{
|
785
|
+
border-bottom: 1px dotted #bbf;
|
786
|
+
}
|
787
|
+
|
788
|
+
}
|
789
|
+
}
|
790
|
+
|
791
|
+
table.source_code
|
792
|
+
{
|
793
|
+
display: none;
|
794
|
+
}
|
795
|
+
|
796
|
+
|
797
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: Provide helpers and resource items to make multiple targets easy to manage.
|
2
|
+
|
3
|
+
As a software developer
|
4
|
+
I want to use helpers and resource items
|
5
|
+
In order to enable automatic navigation of items.
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given a built app at "middlemac_extras_app"
|
9
|
+
|
10
|
+
Scenario:
|
11
|
+
The css_image_sizes helper should return CSS for every image in the project
|
12
|
+
and @2x images should have proper widths and heights, too.
|
13
|
+
When I cd to "build"
|
14
|
+
And the file "index.html" should contain "img[src$='/images/middlemac-extras-small.png'] { max-width: 128px; max-height: 128px; }"
|
15
|
+
And the file "index.html" should contain "img[src$='/images/middlemac-extras-small@2x.png'] { max-width: 128px; max-height: 128px; }"
|
16
|
+
And the file "index.html" should contain "img[src$='/images/middlemac-extras-smaller.png'] { max-width: 64px; max-height: 64px; }"
|
17
|
+
|
18
|
+
|
19
|
+
Scenario:
|
20
|
+
The md_images helper should return Markdown references for every image in
|
21
|
+
the project.
|
22
|
+
When I cd to "build"
|
23
|
+
And the file "index.html" should contain '[middlemac-extras-small]: /images/middlemac-extras-small.png'
|
24
|
+
And the file "index.html" should contain '[middlemac-extras-small@2x]: /images/middlemac-extras-small@2x.png'
|
25
|
+
And the file "index.html" should contain '[middlemac-extras-smaller]: /images/middlemac-extras-smaller.png'
|
26
|
+
|
27
|
+
|
28
|
+
Scenario:
|
29
|
+
The md_links helper should return Markdown references for every HTML file
|
30
|
+
in the project, and should include a title generated from the front matter.
|
31
|
+
When I cd to "build"
|
32
|
+
And the file "index.html" should contain '[index]: / "Fixture for middlemac-extras"'
|
33
|
+
|
34
|
+
Scenario:
|
35
|
+
The extended image tag should include srcset automatically if @2x images are
|
36
|
+
present, and not include a srcset if not.
|
37
|
+
When I cd to "build"
|
38
|
+
And the file "index.html" should contain 'img src="/images/middlemac-extras-small.png" srcset="/images/middlemac-extras-small@2x.png 2x" alt=""'
|
39
|
+
And the file "index.html" should contain 'img src="/images/middlemac-extras-smaller.png" alt=""'
|