middlemac-extras 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +18 -0
- data/LICENSE.md +22 -0
- data/README.md +70 -0
- data/Rakefile +10 -0
- data/bin/middlemac-extras +80 -0
- data/documentation_project/.gitignore +25 -0
- data/documentation_project/Gemfile +17 -0
- data/documentation_project/README.md +13 -0
- data/documentation_project/config.rb +77 -0
- data/documentation_project/source/archives/about.html.md.erb +29 -0
- data/documentation_project/source/archives/index.html.md.erb +78 -0
- data/documentation_project/source/archives/past_far/about.html.md.erb +29 -0
- data/documentation_project/source/archives/past_far/index.html.md.erb +35 -0
- data/documentation_project/source/archives/past_near/about.html.md.erb +29 -0
- data/documentation_project/source/archives/past_near/index.html.md.erb +35 -0
- data/documentation_project/source/books/about.html.md.erb +29 -0
- data/documentation_project/source/books/index.html.md.erb +30 -0
- data/documentation_project/source/books/science fiction/about.html.md.erb +29 -0
- data/documentation_project/source/books/science fiction/index.html.md.erb +35 -0
- data/documentation_project/source/books/science fiction/past_science_fiction/about.html.md.erb +29 -0
- data/documentation_project/source/books/science fiction/past_science_fiction/index.html.md.erb +35 -0
- data/documentation_project/source/books/science fiction/past_science_fiction/past_far/about.html.md.erb +29 -0
- data/documentation_project/source/books/science fiction/past_science_fiction/past_far/index.html.md.erb +35 -0
- data/documentation_project/source/books/science fiction/past_science_fiction/past_near/about.html.md.erb +29 -0
- data/documentation_project/source/books/science fiction/past_science_fiction/past_near/index.html.md.erb +35 -0
- data/documentation_project/source/config_rb.html.md.erb +72 -0
- data/documentation_project/source/css_image_sizes.html.md.erb +65 -0
- data/documentation_project/source/image_tag.html.md.erb +83 -0
- data/documentation_project/source/images/middlemac-extras-small.png +0 -0
- data/documentation_project/source/images/middlemac-extras-small@2x.png +0 -0
- data/documentation_project/source/images/middlemac-extras.png +0 -0
- data/documentation_project/source/images/middlemac-extras@2x.png +0 -0
- data/documentation_project/source/images/sub_images/middlemac-extras-small.png +0 -0
- data/documentation_project/source/images/sub_images/middlemac-extras-small@2x.png +0 -0
- data/documentation_project/source/images/sub_images/middlemac-extras.png +0 -0
- data/documentation_project/source/images/sub_images/middlemac-extras@2x.png +0 -0
- data/documentation_project/source/index.html.md.erb +53 -0
- data/documentation_project/source/javascripts/all.js +1 -0
- data/documentation_project/source/layouts/layout.haml +10 -0
- data/documentation_project/source/layouts/template-logo-large.haml +22 -0
- data/documentation_project/source/layouts/template-logo-medium.haml +20 -0
- data/documentation_project/source/layouts/template-logo-small.haml +18 -0
- data/documentation_project/source/license.html.md.erb +42 -0
- data/documentation_project/source/md_images.html.md.erb +72 -0
- data/documentation_project/source/md_links.html.md.erb +73 -0
- data/documentation_project/source/stylesheets/_github.scss +61 -0
- data/documentation_project/source/stylesheets/_middlemac_minimal.scss +516 -0
- data/documentation_project/source/stylesheets/_normalize.scss +374 -0
- data/documentation_project/source/stylesheets/css_image_sizes.css.erb +1 -0
- data/documentation_project/source/stylesheets/style.css.scss +3 -0
- data/lib/middlemac-extras/extension.rb +261 -0
- data/lib/middlemac-extras/version.rb +5 -0
- data/lib/middlemac-extras.rb +6 -0
- data/middlemac-extras.gemspec +27 -0
- metadata +162 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
title: archives/about
|
3
|
+
blurb: Describes your legal rights and obligations for using these materials.
|
4
|
+
layout: template-logo-medium
|
5
|
+
order: 40
|
6
|
+
navigate: false
|
7
|
+
---
|
8
|
+
|
9
|
+
# <%= current_page.data.title %>
|
10
|
+
|
11
|
+
**Copyright (c) 2016 Jim Derry**
|
12
|
+
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
15
|
+
in the Software without restriction, including without limitation the rights
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
18
|
+
furnished to do so, subject to the following conditions:
|
19
|
+
|
20
|
+
The above copyright notice and this permission notice shall be included in
|
21
|
+
all copies or substantial portions of the Software.
|
22
|
+
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
29
|
+
THE SOFTWARE.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
title: SCIENCE FICTION INDEX
|
3
|
+
blurb: <em>middlemac-extras</em> adds several developer conveniences..
|
4
|
+
layout: template-logo-large
|
5
|
+
navigate: false
|
6
|
+
---
|
7
|
+
|
8
|
+
# <%= current_page.data.title %>
|
9
|
+
|
10
|
+
Although developed for **MiddleMac**, the `middlemac-extras` extension for
|
11
|
+
Middleman is a great way to add handy developer conveniences to your Middleman
|
12
|
+
project.
|
13
|
+
|
14
|
+
Features such as CSS-based image sizes, automatic Markdown reference-style
|
15
|
+
links, and an automatic @2x `image_size` helper will increase your productivity.
|
16
|
+
|
17
|
+
* * *
|
18
|
+
|
19
|
+
# Link to license
|
20
|
+
|
21
|
+
See the [license][license].
|
22
|
+
|
23
|
+
Go to the [index][index].
|
24
|
+
|
25
|
+
Go to the [science fiction][science_fiction_index] index.
|
26
|
+
|
27
|
+
Go to the [science fiction](books/science fiction/index.html) index.
|
28
|
+
|
29
|
+
* * *
|
30
|
+
|
31
|
+
<%= md_links %>
|
32
|
+
|
33
|
+
~~~ markdown
|
34
|
+
<%= md_links %>
|
35
|
+
~~~
|
data/documentation_project/source/books/science fiction/past_science_fiction/about.html.md.erb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
title: archives/about
|
3
|
+
blurb: Describes your legal rights and obligations for using these materials.
|
4
|
+
layout: template-logo-medium
|
5
|
+
order: 40
|
6
|
+
navigate: false
|
7
|
+
---
|
8
|
+
|
9
|
+
# <%= current_page.data.title %>
|
10
|
+
|
11
|
+
**Copyright (c) 2016 Jim Derry**
|
12
|
+
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
15
|
+
in the Software without restriction, including without limitation the rights
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
18
|
+
furnished to do so, subject to the following conditions:
|
19
|
+
|
20
|
+
The above copyright notice and this permission notice shall be included in
|
21
|
+
all copies or substantial portions of the Software.
|
22
|
+
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
29
|
+
THE SOFTWARE.
|
data/documentation_project/source/books/science fiction/past_science_fiction/index.html.md.erb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
title: SCIENCE FICTION INDEX
|
3
|
+
blurb: <em>middlemac-extras</em> adds several developer conveniences..
|
4
|
+
layout: template-logo-large
|
5
|
+
navigate: false
|
6
|
+
---
|
7
|
+
|
8
|
+
# <%= current_page.data.title %>
|
9
|
+
|
10
|
+
Although developed for **MiddleMac**, the `middlemac-extras` extension for
|
11
|
+
Middleman is a great way to add handy developer conveniences to your Middleman
|
12
|
+
project.
|
13
|
+
|
14
|
+
Features such as CSS-based image sizes, automatic Markdown reference-style
|
15
|
+
links, and an automatic @2x `image_size` helper will increase your productivity.
|
16
|
+
|
17
|
+
* * *
|
18
|
+
|
19
|
+
# Link to license
|
20
|
+
|
21
|
+
See the [license][license].
|
22
|
+
|
23
|
+
Go to the [index][index].
|
24
|
+
|
25
|
+
Go to the [science fiction][science_fiction_index] index.
|
26
|
+
|
27
|
+
Go to the [science fiction](books/science fiction/index.html) index.
|
28
|
+
|
29
|
+
* * *
|
30
|
+
|
31
|
+
<%= md_links %>
|
32
|
+
|
33
|
+
~~~ markdown
|
34
|
+
<%= md_links %>
|
35
|
+
~~~
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
title: archives/about
|
3
|
+
blurb: Describes your legal rights and obligations for using these materials.
|
4
|
+
layout: template-logo-medium
|
5
|
+
order: 40
|
6
|
+
navigate: false
|
7
|
+
---
|
8
|
+
|
9
|
+
# <%= current_page.data.title %>
|
10
|
+
|
11
|
+
**Copyright (c) 2016 Jim Derry**
|
12
|
+
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
15
|
+
in the Software without restriction, including without limitation the rights
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
18
|
+
furnished to do so, subject to the following conditions:
|
19
|
+
|
20
|
+
The above copyright notice and this permission notice shall be included in
|
21
|
+
all copies or substantial portions of the Software.
|
22
|
+
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
29
|
+
THE SOFTWARE.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
title: SCIENCE FICTION INDEX
|
3
|
+
blurb: <em>middlemac-extras</em> adds several developer conveniences..
|
4
|
+
layout: template-logo-large
|
5
|
+
navigate: false
|
6
|
+
---
|
7
|
+
|
8
|
+
# <%= current_page.data.title %>
|
9
|
+
|
10
|
+
Although developed for **MiddleMac**, the `middlemac-extras` extension for
|
11
|
+
Middleman is a great way to add handy developer conveniences to your Middleman
|
12
|
+
project.
|
13
|
+
|
14
|
+
Features such as CSS-based image sizes, automatic Markdown reference-style
|
15
|
+
links, and an automatic @2x `image_size` helper will increase your productivity.
|
16
|
+
|
17
|
+
* * *
|
18
|
+
|
19
|
+
# Link to license
|
20
|
+
|
21
|
+
See the [license][license].
|
22
|
+
|
23
|
+
Go to the [index][index].
|
24
|
+
|
25
|
+
Go to the [science fiction][science_fiction_index] index.
|
26
|
+
|
27
|
+
Go to the [science fiction](books/science fiction/index.html) index.
|
28
|
+
|
29
|
+
* * *
|
30
|
+
|
31
|
+
<%= md_links %>
|
32
|
+
|
33
|
+
~~~ markdown
|
34
|
+
<%= md_links %>
|
35
|
+
~~~
|
@@ -0,0 +1,29 @@
|
|
1
|
+
---
|
2
|
+
title: archives/about
|
3
|
+
blurb: Describes your legal rights and obligations for using these materials.
|
4
|
+
layout: template-logo-medium
|
5
|
+
order: 40
|
6
|
+
navigate: false
|
7
|
+
---
|
8
|
+
|
9
|
+
# <%= current_page.data.title %>
|
10
|
+
|
11
|
+
**Copyright (c) 2016 Jim Derry**
|
12
|
+
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
15
|
+
in the Software without restriction, including without limitation the rights
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
18
|
+
furnished to do so, subject to the following conditions:
|
19
|
+
|
20
|
+
The above copyright notice and this permission notice shall be included in
|
21
|
+
all copies or substantial portions of the Software.
|
22
|
+
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
29
|
+
THE SOFTWARE.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
---
|
2
|
+
title: SCIENCE FICTION INDEX
|
3
|
+
blurb: <em>middlemac-extras</em> adds several developer conveniences..
|
4
|
+
layout: template-logo-large
|
5
|
+
navigate: false
|
6
|
+
---
|
7
|
+
|
8
|
+
# <%= current_page.data.title %>
|
9
|
+
|
10
|
+
Although developed for **MiddleMac**, the `middlemac-extras` extension for
|
11
|
+
Middleman is a great way to add handy developer conveniences to your Middleman
|
12
|
+
project.
|
13
|
+
|
14
|
+
Features such as CSS-based image sizes, automatic Markdown reference-style
|
15
|
+
links, and an automatic @2x `image_size` helper will increase your productivity.
|
16
|
+
|
17
|
+
* * *
|
18
|
+
|
19
|
+
# Link to license
|
20
|
+
|
21
|
+
See the [license][license].
|
22
|
+
|
23
|
+
Go to the [index][index].
|
24
|
+
|
25
|
+
Go to the [science fiction][science_fiction_index] index.
|
26
|
+
|
27
|
+
Go to the [science fiction](books/science fiction/index.html) index.
|
28
|
+
|
29
|
+
* * *
|
30
|
+
|
31
|
+
<%= md_links %>
|
32
|
+
|
33
|
+
~~~ markdown
|
34
|
+
<%= md_links %>
|
35
|
+
~~~
|
@@ -0,0 +1,72 @@
|
|
1
|
+
---
|
2
|
+
title: Setting up config.rb
|
3
|
+
blurb: Review the key configuration values for making this extension work.
|
4
|
+
layout: template-logo-medium
|
5
|
+
order: 40
|
6
|
+
navigate: false
|
7
|
+
---
|
8
|
+
|
9
|
+
<%= md_links %>
|
10
|
+
<% content_for :seeAlso do %>
|
11
|
+
<ul>
|
12
|
+
<li><a href="/">Welcome to <code>middlemac-extras</code></a></li>
|
13
|
+
<li><a href="css_image_sizes.html">The <code>css_image_sizes</code> helper</a></li>
|
14
|
+
<li><a href="image_tag.html">The <code>image_tag</code> helper</a></li>
|
15
|
+
<li><a href="md_images.html">The <code>md_images</code> helper</a></li>
|
16
|
+
<li><a href="md_links.html">The <code>md_links</code> helper</a></li>
|
17
|
+
<li><a href="license.html">The MIT License</a></li>
|
18
|
+
</ul>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
# <%= current_page.data.title %>
|
22
|
+
<%= current_page.data.blurb %>
|
23
|
+
|
24
|
+
Some minimal configuration in your `config.rb` project file is required in order
|
25
|
+
for `middlemac-extras` to be useful.
|
26
|
+
|
27
|
+
## Conflicting resources
|
28
|
+
|
29
|
+
This extension uses Middleman's resource map to generate a lot of the
|
30
|
+
information that it provides. Be sure to activate other extensions that
|
31
|
+
might manipulate the resource map before activating middlemac-extras,
|
32
|
+
such as MiddlemanPageGroups (which changes the output names of some files).
|
33
|
+
|
34
|
+
Also our `image_tag` helper should inherit from other `image_tag` helpers,
|
35
|
+
so it's best to make sure they're activated first.
|
36
|
+
|
37
|
+
|
38
|
+
## Extension Setup
|
39
|
+
|
40
|
+
This extension has to be activated before it can be used. If you’re happy with
|
41
|
+
the default configuration values, activation can be as simple as:
|
42
|
+
|
43
|
+
~~~ ruby
|
44
|
+
activate: MiddlemacExtras
|
45
|
+
~~~
|
46
|
+
|
47
|
+
Otherwise the block format should be used to set the extension’s configuration
|
48
|
+
variables:
|
49
|
+
|
50
|
+
~~~ ruby
|
51
|
+
activate :MiddlemacExtras do |config|
|
52
|
+
|
53
|
+
# If set to true, then the enhanced image_tag helper will be used
|
54
|
+
# to include @2x srcset automatically, if the image asset exists.
|
55
|
+
config.retina_srcset = true
|
56
|
+
|
57
|
+
# If set to true then the `image_tag` helper will work for images even
|
58
|
+
# if you don't specify an extension, but only if a file exists on disk
|
59
|
+
# that has one of the extensions in :img_auto_extensions_order.
|
60
|
+
config.img_auto_extensions = true
|
61
|
+
|
62
|
+
# Set this to an array of extensions in the order of precedence for
|
63
|
+
# using `image_tag` without file extensions.
|
64
|
+
config.img_auto_extensions_order = %w(.svg .png .jpg .jpeg .gif .tiff .tif)
|
65
|
+
|
66
|
+
end
|
67
|
+
~~~
|
68
|
+
|
69
|
+
|
70
|
+
### Extension Options
|
71
|
+
|
72
|
+
The extension options are described in the code snippet, above.
|
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
title: The <code>css_image_sizes</code> helper
|
3
|
+
blurb: Use the <code>css_image_sizes</code> helper to specify maximum sizes
|
4
|
+
for all of your project’s images without using unsemantic width and
|
5
|
+
height attributes in your HTML code.
|
6
|
+
layout: template-logo-medium
|
7
|
+
order: 40
|
8
|
+
navigate: false
|
9
|
+
---
|
10
|
+
|
11
|
+
<%= md_links %>
|
12
|
+
<% content_for :seeAlso do %>
|
13
|
+
<ul>
|
14
|
+
<li><a href="/">Welcome to <code>middlemac-extras</code></a></li>
|
15
|
+
<li><a href="image_tag.html">The <code>image_tag</code> helper</a></li>
|
16
|
+
<li><a href="md_images.html">The <code>md_images</code> helper</a></li>
|
17
|
+
<li><a href="md_links.html">The <code>md_links</code> helper</a></li>
|
18
|
+
<li><a href="config_rb.html">Setting up <code>config.rb</code></a></li>
|
19
|
+
<li><a href="license.html">The MIT License</a></li>
|
20
|
+
</ul>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
# <%= current_page.data.title %>
|
24
|
+
<%= current_page.data.blurb %>
|
25
|
+
|
26
|
+
It works by specifying a `max-width` and `max-height` for each image used in
|
27
|
+
your Middleman project (except for SVG files, which don’t have dimensions).
|
28
|
+
|
29
|
+
## Example
|
30
|
+
|
31
|
+
When called like this:
|
32
|
+
|
33
|
+
~~~ erb
|
34
|
+
<%%= css_image_sizes %>
|
35
|
+
~~~
|
36
|
+
|
37
|
+
…the result is this:
|
38
|
+
|
39
|
+
~~~ scss
|
40
|
+
<%= css_image_sizes %>
|
41
|
+
~~~
|
42
|
+
|
43
|
+
## Use
|
44
|
+
|
45
|
+
You could use this in an HTML `<style>` element on each of your pages, or better
|
46
|
+
yet in your layouts. This has the unfortunate effect of including it in every
|
47
|
+
one of your pages, however, and so this sample project uses like this:
|
48
|
+
|
49
|
+
Contents of `stylesheets/css_image_sizes.css.erb`:
|
50
|
+
|
51
|
+
~~~ erb
|
52
|
+
<%%= css_image_sizes %>
|
53
|
+
~~~
|
54
|
+
|
55
|
+
This will create `stylesheets/css_image_sizes.css` in your build output, and
|
56
|
+
this file is included in the project layout file:
|
57
|
+
|
58
|
+
~~~ haml
|
59
|
+
= stylesheet_link_tag 'css_image_sizes'
|
60
|
+
~~~
|
61
|
+
|
62
|
+
You will be tempted to add this helper to your `style.css.scss` file, maybe
|
63
|
+
even renaming it to `style.css.scss.erb`, but this will not work due to the
|
64
|
+
order that Middleman and SASS build output.
|
65
|
+
{:.note}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
title: The <code>image_tag</code> helper
|
3
|
+
blurb: Find out how to use the enhanced <code>image_tag</code> helper so that
|
4
|
+
it can be even more helpful.
|
5
|
+
layout: template-logo-medium
|
6
|
+
order: 40
|
7
|
+
navigate: false
|
8
|
+
---
|
9
|
+
|
10
|
+
<%= md_links %>
|
11
|
+
<% content_for :seeAlso do %>
|
12
|
+
<ul>
|
13
|
+
<li><a href="/">Welcome to <code>middlemac-extras</code></a></li>
|
14
|
+
<li><a href="css_image_sizes.html">The <code>css_image_sizes</code> helper</a></li>
|
15
|
+
<li><a href="md_images.html">The <code>md_images</code> helper</a></li>
|
16
|
+
<li><a href="md_links.html">The <code>md_links</code> helper</a></li>
|
17
|
+
<li><a href="config_rb.html">Setting up <code>config.rb</code></a></li>
|
18
|
+
<li><a href="license.html">The MIT License</a></li>
|
19
|
+
</ul>
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
# <%= current_page.data.title %>
|
23
|
+
<%= current_page.data.blurb %>
|
24
|
+
|
25
|
+
The `image_tag` helper (which also handles Markdown links) has been given some
|
26
|
+
new capabilities aimed towards making you more productive.
|
27
|
+
|
28
|
+
## Automatic image extensions
|
29
|
+
|
30
|
+
When enabled this new feature allows you to omit the image extension when
|
31
|
+
specifying an image.
|
32
|
+
|
33
|
+
~~~ erb
|
34
|
+
<%= image_tag 'image' %>
|
35
|
+
~~~
|
36
|
+
|
37
|
+
~~~ markdown
|
38
|
+

|
39
|
+
~~~
|
40
|
+
|
41
|
+
When enabled, the helper will look for images in your project that have an
|
42
|
+
extension specified by `img_auto_extensions_order` in your
|
43
|
+
[`config.rb`][config_rb] file.
|
44
|
+
|
45
|
+
### Enable this behavior
|
46
|
+
|
47
|
+
You can enable or disable this behavior globally in [`config.rb`][config_rb]
|
48
|
+
file, within the `activate :MiddlemacExtras` activation block by setting the
|
49
|
+
value of `img_auto_extensions` to `true` or `false`.
|
50
|
+
|
51
|
+
You can always enable or disable this behavior selectively by passing this
|
52
|
+
same key with a `true` or `false` value in the helper’s parameters hash, too.
|
53
|
+
|
54
|
+
|
55
|
+
## Automatic `srcset` for @2x images
|
56
|
+
|
57
|
+
When enabled, the helper will look for @2x versions of your images within your
|
58
|
+
project and add a a `srcset` attribute to the image tag automatically. If you
|
59
|
+
specify your own `srcset` attribute, then this automatic behavior will never
|
60
|
+
occur.
|
61
|
+
|
62
|
+
~~~ html
|
63
|
+
<img srcset="image@2x.png" src="image.png">
|
64
|
+
~~~
|
65
|
+
|
66
|
+
### Enable this behavior
|
67
|
+
|
68
|
+
You can enable or disable this behavior globally in [`config.rb`][config_rb]
|
69
|
+
file, within the `activate :MiddlemacExtras` activation block by setting the
|
70
|
+
value of `retina_srcset` to `true` or `false`.
|
71
|
+
|
72
|
+
You can always enable or disable this behavior selectively by passing this
|
73
|
+
same key with a `true` or `false` value in the helper’s parameters hash, too.
|
74
|
+
|
75
|
+
|
76
|
+
## Enables automatic_alt_tags support for absolute paths
|
77
|
+
|
78
|
+
Middleman has an extension called `automatic_alt_tags` that specifies an
|
79
|
+
automatic value for an image’s `alt` attribute if you fail to provide one.
|
80
|
+
Unfortunately this does not work if you specify an absolute path to an image.
|
81
|
+
|
82
|
+
If your project activates `automatic_alt_tags`, then `middlemac-extras` will
|
83
|
+
apply an automatic `alt` attribute in these cases.
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,53 @@
|
|
1
|
+
---
|
2
|
+
title: Welcome to <code>middlemac-extras</code>
|
3
|
+
blurb: <em>middlemac-extras</em> adds several developer conveniences.
|
4
|
+
layout: template-logo-large
|
5
|
+
navigate: false
|
6
|
+
---
|
7
|
+
|
8
|
+
<%= md_links %>
|
9
|
+
|
10
|
+
# <%= current_page.data.title %>
|
11
|
+
|
12
|
+
Although developed for **Middlemac**, the `middlemac-extras` extension for
|
13
|
+
Middleman is a great way to add handy developer conveniences to your Middleman
|
14
|
+
project.
|
15
|
+
|
16
|
+
It serves as a truly “extra” extension that gathers utilities intended for
|
17
|
+
**MiddleMac** but are generic enough that they can be used with any Middleman
|
18
|
+
project.
|
19
|
+
|
20
|
+
This extension currently offers features such as these:
|
21
|
+
|
22
|
+
- CSS-based image sizes
|
23
|
+
- Automatic Markdown reference-style links
|
24
|
+
- Automatic Markdown reference-style images
|
25
|
+
- An enhanced `image_tag` that:
|
26
|
+
- Automatically includes a `srcset` attribute for @2x images
|
27
|
+
- Allows you to omit the extension for image files
|
28
|
+
- Fixes `automatic_alt_tags` for absolute path images
|
29
|
+
|
30
|
+
* * *
|
31
|
+
|
32
|
+
[The `css_image_sizes` helper][css_image_sizes]
|
33
|
+
: Use the `css_image_sizes` helper to specify maximum sizes for all of your
|
34
|
+
project’s images without using unsemantic `width` and `height` attributes
|
35
|
+
in your HTML code.
|
36
|
+
|
37
|
+
[The `image_tag` helper][image_tag]
|
38
|
+
: Find out how to use the enhanced `image_tag` helper so that it can be even
|
39
|
+
more helpful.
|
40
|
+
|
41
|
+
[The `md_images` helper][md_images]
|
42
|
+
: Automatic Markdown reference style links for every image in your site are
|
43
|
+
available by using this helper.
|
44
|
+
|
45
|
+
[The `md_links` helper][md_links]
|
46
|
+
: The `md_links` helper can help you by providing Markdown reference-style
|
47
|
+
links (including `title` attributes) to every page in your site.
|
48
|
+
|
49
|
+
[Setting up `config.rb`][config_rb]
|
50
|
+
: Review the key configuration values for making this extension work.
|
51
|
+
|
52
|
+
[The MIT License][license]
|
53
|
+
: Describes your legal rights and obligations for using these materials.
|
@@ -0,0 +1 @@
|
|
1
|
+
// This is where it all goes :)
|
@@ -0,0 +1,10 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title= current_page.data.title || 'middleman-targets'
|
5
|
+
%meta{:content => 'text/html; charset=utf-8', :'http-equiv' => 'Content-Type'}/
|
6
|
+
= stylesheet_link_tag 'style'
|
7
|
+
= stylesheet_link_tag 'css_image_sizes'
|
8
|
+
= javascript_include_tag 'all'
|
9
|
+
%body{:class => "#{page_classes}"}
|
10
|
+
= yield
|
@@ -0,0 +1,22 @@
|
|
1
|
+
= wrap_layout ('layout'.to_sym) do
|
2
|
+
.container-logo-large
|
3
|
+
%div
|
4
|
+
%div
|
5
|
+
= image_tag 'middlemac-extras-small.png', :alt => 'middlemac-extras logo'
|
6
|
+
%h1= "#{product_name}"
|
7
|
+
%h2= "version #{product_version}"
|
8
|
+
%a{:href => product_uri}= product_uri
|
9
|
+
|
10
|
+
- if content_for?(:seeAlso)
|
11
|
+
.related_topics
|
12
|
+
%h1 See Also
|
13
|
+
= yield_content :seeAlso
|
14
|
+
|
15
|
+
%div
|
16
|
+
.yield-content
|
17
|
+
~ yield
|
18
|
+
|
19
|
+
-#
|
20
|
+
This template is suitable for your landing page or major sections, and features
|
21
|
+
a large version of your logo, the application name, and the application URI.
|
22
|
+
It can include optional :seeAlso content below the application URI.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
= wrap_layout ('layout'.to_sym) do
|
2
|
+
.container-logo-medium
|
3
|
+
%div
|
4
|
+
.yield-content
|
5
|
+
~ yield
|
6
|
+
|
7
|
+
%div
|
8
|
+
%div
|
9
|
+
= image_tag 'middlemac-extras-small.png', :alt => 'middlemac-extras logo'
|
10
|
+
.related_topics
|
11
|
+
- if content_for?(:seeAlso)
|
12
|
+
%h1 See Also
|
13
|
+
= yield_content :seeAlso
|
14
|
+
|
15
|
+
-#
|
16
|
+
This template is suitable for general pages within a group, as it makes
|
17
|
+
navigation between the different pages in the group obvious and easy. It
|
18
|
+
features a medium version of your logo on the right, followed by navigation
|
19
|
+
to the other pages in the group. Optionally :seeAlso content can follow the
|
20
|
+
related pages.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
= wrap_layout ('layout'.to_sym) do
|
2
|
+
.container-logo-small
|
3
|
+
.yield-content
|
4
|
+
= image_tag 'middlemac-extras-small.png', :alt => 'middlemac-extras logo'
|
5
|
+
~ yield
|
6
|
+
|
7
|
+
.related_topics
|
8
|
+
- if content_for?(:seeAlso)
|
9
|
+
%hr/
|
10
|
+
%h1 See Also
|
11
|
+
= yield_content :seeAlso
|
12
|
+
|
13
|
+
-#
|
14
|
+
This template is suitable for general pages that aren’t meant to participate
|
15
|
+
within a group. It does show related pages followed by :seeAlso content at
|
16
|
+
the bottom on the page, but it’s not as obvious for simple navigation as the
|
17
|
+
template-logo-medium. It features a small version of your help logo in the
|
18
|
+
top left, followed by the title.
|