mint 0.7.4 → 0.8.1

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.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +23 -14
  3. data/LICENSE +22 -0
  4. data/README.md +68 -79
  5. data/bin/mint +47 -10
  6. data/bin/mint-epub +1 -4
  7. data/config/templates/base/style.css +187 -0
  8. data/config/templates/default/layout.erb +10 -0
  9. data/config/templates/default/style.css +237 -0
  10. data/config/templates/garden/layout.erb +38 -0
  11. data/config/templates/garden/style.css +303 -0
  12. data/config/templates/nord/layout.erb +11 -0
  13. data/config/templates/nord/style.css +339 -0
  14. data/config/templates/nord-dark/layout.erb +11 -0
  15. data/config/templates/nord-dark/style.css +339 -0
  16. data/config/templates/zen/layout.erb +11 -0
  17. data/config/templates/zen/style.css +114 -0
  18. data/lib/mint/command_line.rb +253 -111
  19. data/lib/mint/css.rb +11 -4
  20. data/lib/mint/css_parser.rb +76 -0
  21. data/lib/mint/css_template.rb +37 -0
  22. data/lib/mint/document.rb +203 -43
  23. data/lib/mint/helpers.rb +50 -10
  24. data/lib/mint/layout.rb +2 -3
  25. data/lib/mint/markdown_template.rb +47 -0
  26. data/lib/mint/mint.rb +181 -114
  27. data/lib/mint/plugin.rb +3 -3
  28. data/lib/mint/plugins/epub.rb +1 -2
  29. data/lib/mint/resource.rb +19 -9
  30. data/lib/mint/style.rb +10 -14
  31. data/lib/mint/version.rb +1 -1
  32. data/lib/mint.rb +1 -0
  33. data/man/mint.1 +135 -0
  34. data/spec/cli/README.md +99 -0
  35. data/spec/cli/argument_parsing_spec.rb +237 -0
  36. data/spec/cli/bin_integration_spec.rb +348 -0
  37. data/spec/cli/configuration_management_spec.rb +363 -0
  38. data/spec/cli/full_workflow_integration_spec.rb +527 -0
  39. data/spec/cli/publish_workflow_spec.rb +368 -0
  40. data/spec/cli/template_management_spec.rb +300 -0
  41. data/spec/css_parser_spec.rb +149 -0
  42. data/spec/css_spec.rb +1 -1
  43. data/spec/document_spec.rb +102 -69
  44. data/spec/helpers_spec.rb +42 -42
  45. data/spec/mint_spec.rb +104 -80
  46. data/spec/plugin_spec.rb +141 -143
  47. data/spec/run_cli_tests.rb +95 -0
  48. data/spec/spec_helper.rb +8 -1
  49. data/spec/style_spec.rb +18 -16
  50. data/spec/support/cli_helpers.rb +169 -0
  51. data/spec/support/fixtures/content-2.md +16 -0
  52. data/spec/support/matchers.rb +1 -1
  53. metadata +116 -224
  54. data/config/syntax.yaml +0 -71
  55. data/config/templates/base/style.sass +0 -144
  56. data/config/templates/default/css/style.css +0 -158
  57. data/config/templates/default/layout.haml +0 -8
  58. data/config/templates/default/style.sass +0 -36
  59. data/config/templates/protocol/layout.haml +0 -7
  60. data/config/templates/protocol/style.sass +0 -20
  61. data/config/templates/zen/css/style.css +0 -145
  62. data/config/templates/zen/layout.haml +0 -7
  63. data/config/templates/zen/style.sass +0 -24
  64. data/features/config.feature +0 -21
  65. data/features/plugins/epub.feature +0 -23
  66. data/features/publish.feature +0 -73
  67. data/features/support/env.rb +0 -15
  68. data/features/templates.feature +0 -79
  69. data/spec/command_line_spec.rb +0 -87
  70. data/spec/plugins/epub_spec.rb +0 -242
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 49d66d53b189d1897ab9938358279f7dc0c4ede1d44926eba5f1b9b6f7d8344b
4
+ data.tar.gz: '08b1882ec1972dbedd02c87e0e6a4cf1f61ca0a631c7f56bca20b4dfeb1ea36b'
5
+ SHA512:
6
+ metadata.gz: 3acb8ce3fc1856014e0efe3aa94d3720faeb8f677e2f9e3a46c541ecc8bd62f65a187558421ac10acc0599f813a8d161bed142bf44c75b51e6bc8f140351cc7f
7
+ data.tar.gz: 3851e818c5bad026bfde0302c8fe3184dfe4d79e93ca87479e85590015bb3fd082926fe88f7397144b8fbbb4163ae9e602bbb510bf23da009d20943b334896c2
data/Gemfile CHANGED
@@ -1,18 +1,27 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
 
3
- gem "tilt"
4
- gem "rdiscount"
5
- gem "haml"
6
- gem "sass"
7
- gem "less"
8
- gem "activesupport"
3
+ # General
4
+ gem "rubyzip", "~> 3.0", ">= 3.0.1"
5
+ gem "hashie", "~> 5.0"
6
+ gem "nokogiri", "1.15.5"
9
7
 
10
- gem "rubyzip"
11
- gem "hashie"
12
- gem "nokogiri"
8
+ # Templates
9
+ gem "tilt", "~> 2.6", ">= 2.6.1"
10
+ gem "redcarpet", "~> 3.6", ">= 3.6.1"
11
+ gem "erubis", "~> 2.7"
12
+ gem "haml", "~> 6.3"
13
+ gem "sass-embedded", '~> 1.90'
13
14
 
14
- gem "rspec"
15
- gem "cucumber"
16
- gem "aruba"
15
+ # Helpers
16
+ gem "activesupport", "~> 8.0", ">= 8.0.2.1"
17
17
 
18
- gem "debugger"
18
+ group :development do
19
+ gem "pry"
20
+ end
21
+
22
+ # Testing dependencies
23
+ group :test do
24
+ gem "rspec", "~> 3.13", ">= 3.13.1"
25
+ gem "rspec-its", "~> 1.3"
26
+ gem "colorize", "~> 1.1"
27
+ end
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 David Jacobs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included
14
+ in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
+ DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,111 +1,100 @@
1
- What is Mint?
2
- -------------
1
+ # Mint
3
2
 
4
- Mint transforms your plain text documents into beautiful documents. It makes that process as simple (but customizable) as possible.
3
+ Transform your plain text documents into beautiful HTML documents with customizable styling and templates.
5
4
 
6
- Why would you want to keep all of your documents as plain text?
5
+ ## Installation
7
6
 
8
- - To focus on words and structure when you write
9
- - To be able to apply one style to an entire set of documents with one command
10
- - To keep your documents under version control
11
- - To make your documents available for scripting--for example, text analysis
7
+ ```bash
8
+ gem install mint
9
+ ```
12
10
 
13
- What does Mint create from these source files? Beautiful, styled HTML ready to print, e-mail, and present.
11
+ ## Quick Start
14
12
 
15
- In a few words: *Mint processes words so you don't have to.*
13
+ Transform a Markdown document into styled HTML:
16
14
 
17
- The mint command
18
- ----------------
15
+ ```bash
16
+ mint publish Document.md
17
+ ```
19
18
 
20
- If you have a plain text document formatted in Markdown or Textile or almost any other templating language, you're ready to go.
19
+ This creates `Document.html` in your current directory with beautiful default styling.
21
20
 
22
- The easiest Mint command doesn't require configuration. It transforms a document into HTML and links it to the default stylesheet, which I've designed for you.
21
+ ## Usage
23
22
 
24
- Simply type:
23
+ ### Basic Commands
25
24
 
26
- mint publish Minimalism.md
25
+ ```bash
26
+ # Publish a single document
27
+ mint publish Document.md
27
28
 
28
- And voilà, Minimalism.html will show up next to Minimalism.md.
29
+ # Publish with a template
30
+ mint publish Document.md --template nord
29
31
 
30
- Opening Minimalism.html with your favorite web browser--[Firefox is best for typography][Firefox typography], but Webkit-based browsers (Chrome, Safari) work, too--will show what looks like a word-processed document, complete with big bold headers, italic emphasis, automatically indented and numbered lists, and bullets. If you're in a modern browser, you'll even see ligatures and proper kerning. The page will be on a white canvas that looks like a page, even though you are in a browser.
32
+ # Publish to a specific directory
33
+ mint publish Document.md --destination public
31
34
 
32
- Sending that page to a printer is as easy as clicking "Print" from your browser. What comes out of your printer will have a 12 pt base font, normal margins, and a not-too-cramped baseline. (Ah the wonder of print stylesheets.)
35
+ # Publish multiple files
36
+ mint publish *.md --destination final-drafts
33
37
 
34
- You can throw as many files as you'd like in. Any commandline argument *not* preceded by an option (e.g., `--template`) or in the `mint` command vocabulary (more on that in a minute) will be interpreted as a file name:
38
+ # Publish a digital garden, with linked navigation
39
+ mint publish content/**/*.md --template garden --destination public
40
+ ```
35
41
 
36
- mint publish Minimalism.md Proposal.md Protocol.md
42
+ ### Common Options
37
43
 
38
- This command can be tweaked with options and arguments to be more flexible:
44
+ | Flag | Description |
45
+ |------|-------------|
46
+ | `-t, --template TEMPLATE` | Use a built-in template (combines layout + style) |
47
+ | `-l, --layout LAYOUT` | Specify only the layout |
48
+ | `-s, --style STYLE` | Specify only the style |
49
+ | `-d, --destination DIR` | Output directory |
50
+ | `-o, --output-file FORMAT` | Custom output filename format |
51
+ | `--style-mode MODE` | How styles are included (inline, external, original) |
52
+ | `--style-destination PATH` | Create external stylesheet and link it (sets mode to external) |
53
+ | `-r, --recursive` | Find all Markdown files in any directories specified |
39
54
 
40
- mint publish Minimalism.md --template resume # specifies a style template
41
- mint publish Minimalism.md --destination final --style-destination=styles
55
+ ### Style modes
42
56
 
43
- For a listing of mint options, take [a look at the API][API].
57
+ Mint offers three ways to include styles in your HTML output:
44
58
 
45
- A basic Mint document
46
- ---------------------
59
+ - **`inline`** (default) – CSS is embedded directly in the HTML document as `<style>` tags
60
+ - **`external`** – CSS is compiled and saved as separate files, linked with `<link>` tags
61
+ - **`original`** – Links directly to original CSS template files without processing (for live editing)
47
62
 
48
- Mint is loaded with smart defaults, so if you don't want to configure something--say, the basic HTML skeleton of your document or the output directory--you don't have to. You'll probably be surprised at how easy it is to use out of the box, and how configurable it is.
63
+ The `original` mode is particularly useful for template development, as it allows you to edit CSS files and see changes immediately without republishing. Only `.css` files are supported in this mode, and `@import` statements in CSS files will be included as additional `<link>` tags.
49
64
 
50
- document = Document.new "Minimalism.md"
51
- document.publish!
65
+ ### Built-in templates
52
66
 
53
- If you want to customize your document, though--and that's why I built this library--Mint makes that easy.
67
+ - `default` Clean, minimal styling
68
+ - `nord` – Clean, uses Nord color scheme
69
+ - `nord-dark` – Dark version of Nord
70
+ - `garden` – For digital gardens; includes navigation
54
71
 
55
- To understand Mint's flexibility, you'll want to [take a look at the API][API].
72
+ ## Documentation
56
73
 
57
- [Firefox typography]: http://opentype.info/blog/2008/06/14/kerning-and-opentype-features-in-firefox-3/ "Firefox 3 supports kerning and automatic ligatures"
74
+ - **Complete usage guide:** [TUTORIAL.md](doc/TUTORIAL.md)
75
+ - **Man page:** `man mint` (after installation)
76
+ - **API documentation:** [RubyDoc](http://www.rubydoc.info/github/davejacobs/mint)
58
77
 
59
- Templates
60
- ---------
78
+ ## Why Mint?
61
79
 
62
- Templates can be written in any format accepted by the Tilt template interface library. (See [the Tilt TEMPLATES file][Tilt templates] for more information.)
80
+ - **Focus on writing** Keep documents as plain text
81
+ - **Version control friendly** – Text files work great with Git
82
+ - **Scriptable** – Automate document processing
83
+ - **Beautiful output** – Professional-looking HTML ready for print or web
84
+ - **Highly customizable** – Create your own templates and styles
63
85
 
64
- In a template layouts, Ruby calls are sparse but necessary.
86
+ ## Templates and customization
65
87
 
66
- If you're designing a layout, you need to indicate where Mint should place your content. For that simple reason, raw HTML files cannot be layouts. Instead, if you want to use HTML templates, you should use the ERB format. These files are essentially HTML with the possibility for Ruby calls. You can even use the .html extension for your files. Just code the dynamic portion using ERB syntax.
88
+ Mint supports layouts written in HAML or ERB and stylesheets can be written in CSS, SCSS, or SASS.
67
89
 
68
- Inside your template, use the `content` method to place your source's content.
90
+ ## Contributing
69
91
 
70
- You will want to point to your document's stylesheet (via a relative URL) from within your layout, usually in the `<head/>` element. Use the `stylesheet` method.
92
+ 1. Fork the repository
93
+ 2. Create a feature branch
94
+ 3. Make your changes
95
+ 4. Run the tests: `rspec`
96
+ 5. Submit a pull request
71
97
 
72
- So if you're writing your layout using Haml, the template might look like this:
73
-
74
- !!!
75
- %html
76
- %head
77
- %link(rel="stylesheet" href=stylesheet)
78
-
79
- %body
80
- #container= content
81
-
82
- You can build stylesheets using [CSS][], [SASS/SCSS][] or [Less][]. They will always be compiled for you.
83
-
84
- Mint comes preloaded with several styles and layouts.
85
-
86
- 1. Default
87
- 2. Zen
88
- 3. Resume\*
89
- 4. Protocol
90
- 5. Protocol Flow\* - requires Javascript and jQuery
91
-
92
- > Note: Starred entries are not yet implemented. If you have a killer
93
- > template you think should be included, send it my way. I'll check
94
- > it out and see if it should be part of the standard template library.
95
- > (Of course, you'll get all the credit.)
96
-
97
- I've included a base stylesheet that is useful for setting sensible typographic defaults.
98
-
99
- Plugins: A work in progress
100
- ---------------------------
101
-
102
- I've designed the beginnings of a plugin system. With this system, you can implement a callback or two and have full control over document creation and sharing. I'll get documentation going soon. For now, look to lib/mint/plugins/epub.rb and bin/mint-epub for an example of how to build one. It's not complete and I'm open to API suggestions.
103
-
104
- This is going to be useful for things like creating actual office documents or e-books or even bound novels. I'm actually thinking that half the power of this library is its plugin system.
105
-
106
- [API]: http://github.com/davejacobs/mint/tree/master/doc/API.md
107
- [Tilt templates]: http://github.com/rtomayko/tilt/blob/master/TEMPLATES.md "A listing of all templates supported by Tilt."
108
- [CSS]: http://en.wikipedia.org/wiki/Cascading_Style_Sheets
109
- [SASS/SCSS]: http://sass-lang.com/
110
- [Less]: http://lesscss.org/
98
+ ## License
111
99
 
100
+ MIT License. See [LICENSE](LICENSE) for details.
data/bin/mint CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- # A script for harnessing Mint at the commandline
3
- # Usage: mint [command] [options] [files]
2
+
3
+ # Add /lib to path to override any local installations of Mint
4
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
4
5
 
5
6
  require "mint"
6
7
  require "shellwords"
@@ -8,7 +9,8 @@ require "shellwords"
8
9
  argv, commandline_options, help =
9
10
  Mint::CommandLine.parse(ARGV).values_at(:argv, :options, :help)
10
11
 
11
- case argv.shift.downcase.to_sym
12
+ original_command = argv.first
13
+ case (argv.shift || "help").downcase.to_sym
12
14
  when :publish
13
15
  # Aruba chokes here, so we use this hack to convince Mint we're
14
16
  # not in a pipeline
@@ -21,18 +23,46 @@ when :publish
21
23
  end
22
24
  end
23
25
  Mint::CommandLine.publish!(files, commandline_options)
26
+ when :preview
27
+ # Preview mode uses live CSS links instead of inline styles
28
+ Mint.rendering_mode = :preview
29
+ files =
30
+ if $stdin.tty? || ENV["MINT_NO_PIPE"]
31
+ argv
32
+ else
33
+ $stdin.each_line.reduce [] do |list, line|
34
+ list.concat(Shellwords.split(line))
35
+ end
36
+ end
37
+ Mint::CommandLine.publish!(files, commandline_options)
24
38
  when :help
25
39
  Mint::CommandLine.help(help)
26
40
  when :install
27
- Mint::CommandLine.install(argv.shift, commandline_options)
41
+ file = argv.shift
42
+ name = argv.shift
43
+ scope = commandline_options[:scope] || :local
44
+ Mint::CommandLine.install(file, name, scope)
28
45
  when :uninstall
29
- Mint::CommandLine.uninstall(argv.shift, commandline_options)
46
+ name = argv.shift
47
+ scope = commandline_options[:scope] || :local
48
+ Mint::CommandLine.uninstall(name, scope)
30
49
  when :templates
31
- Mint::CommandLine.templates(argv.shift, commandline_options)
32
- when :edit
33
- Mint::CommandLine.edit(argv.shift, commandline_options)
50
+ filter = argv.shift
51
+ scope = commandline_options[:scope] || :local
52
+ Mint::CommandLine.templates(filter, scope)
53
+ when :"edit-layout"
54
+ name = argv.shift
55
+ scope = commandline_options[:scope] || :local
56
+ Mint::CommandLine.edit(name, :layout, scope)
57
+ when :"edit-style"
58
+ name = argv.shift
59
+ scope = commandline_options[:scope] || :local
60
+ Mint::CommandLine.edit(name, :style, scope)
34
61
  when :set
35
- Mint::CommandLine.set(argv.shift, argv.shift, commandline_options)
62
+ key = argv.shift
63
+ value = argv.shift
64
+ scope = commandline_options[:scope] || :local
65
+ Mint::CommandLine.set(key, value, scope)
36
66
  when :config
37
67
  Mint::CommandLine.config
38
68
  else
@@ -43,8 +73,15 @@ else
43
73
  # document list.
44
74
 
45
75
  begin
46
- system 'mint-#{argv.first} #{argv[1..-1].join " "}'
76
+ if File.executable? "mint-#{original_command}"
77
+ system "mint-#{original_command} #{argv[1..-1].join ' '}"
78
+ else
79
+ $stderr.puts "Error: Unknown command '#{original_command}'"
80
+ Mint::CommandLine.help(help)
81
+ exit 1
82
+ end
47
83
  rescue
48
84
  Mint::CommandLine.help(help)
85
+ exit 1
49
86
  end
50
87
  end
data/bin/mint-epub CHANGED
@@ -3,13 +3,10 @@
3
3
  # A script for publishing Mint in the ePub format
4
4
  # Usage: mint epub [command] [options] [files]
5
5
 
6
+ $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
6
7
  require "mint"
7
8
  require "mint/plugins/epub"
8
9
 
9
- # NOTE: This is not how I want this plugin to be called.
10
- # However, I do want a first iteration of the plugin
11
- # system on master, so we'll go with this for now.
12
-
13
10
  def usage
14
11
  abort "mint epub publish file"
15
12
  end
@@ -0,0 +1,187 @@
1
+ @import '../reset.css';
2
+
3
+ body {
4
+ font-family: var(--body-font-family), Georgia, serif;
5
+ }
6
+
7
+ h1, h2 {
8
+ line-height: 1.3;
9
+ }
10
+
11
+ h2, h3, h4, h5, h6 {
12
+ line-height: var(--screen-line-height);
13
+ }
14
+
15
+ h1, h2, h3, h4, h5, h6 {
16
+ font-family: var(--header-font-family);
17
+ font-weight: normal;
18
+ }
19
+
20
+ h1 {
21
+ font-size: calc(var(--screen-font-size) * 1.5);
22
+ margin-top: var(--screen-unit);
23
+ margin-bottom: var(--screen-unit);
24
+ }
25
+
26
+ h2 {
27
+ font-size: calc(var(--screen-font-size) * 1.2);
28
+ margin-top: calc(var(--screen-unit) * 3 / 2);
29
+ margin-bottom: calc(var(--screen-unit) * 1 / 2);
30
+ }
31
+
32
+ h3 {
33
+ font-size: calc(var(--screen-font-size) * 1.1);
34
+ margin-top: calc(var(--screen-unit) * 7 / 4);
35
+ margin-bottom: calc(var(--screen-unit) * 1 / 4);
36
+ }
37
+
38
+ h4 {
39
+ font-size: calc(var(--screen-font-size) * 1.05);
40
+ margin-top: calc(var(--screen-unit) * 7 / 8);
41
+ margin-bottom: calc(var(--screen-unit) * 1 / 8);
42
+ }
43
+
44
+ h5, h6 {
45
+ font-size: var(--screen-font-size);
46
+ margin-top: calc(var(--screen-unit) * 7 / 8);
47
+ margin-bottom: calc(var(--screen-unit) * 1 / 8);
48
+ }
49
+
50
+ ul {
51
+ list-style-type: square;
52
+ }
53
+
54
+ ul ul {
55
+ list-style-type: circle;
56
+ }
57
+
58
+ ul, ol {
59
+ margin: calc(var(--screen-unit) / 4) 0 0 calc(var(--screen-unit) / 2);
60
+ padding-left: calc(var(--screen-unit) * 1.2);
61
+ }
62
+
63
+ ul li p, ol li p {
64
+ text-indent: 0 !important;
65
+ }
66
+
67
+ ul li + li, ol li + li {
68
+ margin-top: calc(var(--screen-unit) / 4);
69
+ }
70
+
71
+ p {
72
+ margin: calc(var(--screen-unit) / 2) 0;
73
+ }
74
+
75
+ ul + p, ol + p, blockquote + p, pre + p {
76
+ text-indent: 0;
77
+ }
78
+
79
+ a:link, a:visited, a:active {
80
+ color: var(--link-color);
81
+ text-decoration: none;
82
+ }
83
+
84
+ a:hover {
85
+ text-decoration: underline;
86
+ }
87
+
88
+ code {
89
+ font-family: Monaco, Menlo, Mensch, Consolas, Monotype, mono;
90
+ font-style: normal;
91
+ }
92
+
93
+ pre {
94
+ display: block;
95
+ margin-left: var(--screen-unit);
96
+ margin-right: calc(var(--screen-unit) * 2);
97
+ padding: calc(var(--screen-unit) / 3) var(--screen-unit);
98
+ padding-left: calc(var(--screen-unit) * 3 / 4);
99
+ white-space: pre;
100
+ }
101
+
102
+ blockquote {
103
+ display: block;
104
+ margin-left: var(--screen-unit);
105
+ margin-right: calc(var(--screen-unit) * 2);
106
+ padding: calc(var(--screen-unit) / 3) var(--screen-unit);
107
+ padding-left: calc(var(--screen-unit) * 3 / 4);
108
+ }
109
+
110
+ pre p, blockquote p {
111
+ margin: 0;
112
+ line-height: 1.35;
113
+ }
114
+
115
+ img {
116
+ display: block;
117
+ }
118
+
119
+ @media screen {
120
+ body {
121
+ font-size: var(--screen-font-size);
122
+ line-height: var(--screen-line-height);
123
+ background-color: #666;
124
+ color: var(--text-color);
125
+ }
126
+
127
+ #container {
128
+ display: block;
129
+ border: solid 1px #999;
130
+ width: 780px;
131
+ padding: 40px 60px;
132
+ margin: calc(var(--screen-unit) / 2) auto;
133
+ background-color: #fff;
134
+ box-sizing: border-box;
135
+ -moz-box-sizing: border-box;
136
+ -webkit-box-sizing: border-box;
137
+ }
138
+
139
+ code {
140
+ font-size: calc(var(--screen-font-size) * 7 / 8);
141
+ }
142
+
143
+ pre {
144
+ white-space: pre-wrap;
145
+ white-space: -moz-pre-wrap;
146
+ white-space: -o-pre-wrap;
147
+ word-wrap: break-word;
148
+ }
149
+
150
+ pre code {
151
+ font-size: calc(var(--screen-font-size) * 3 / 4);
152
+ }
153
+ }
154
+
155
+ @media print {
156
+ @page {
157
+ margin-left: 1in;
158
+ margin-right: 1in;
159
+ margin-top: 1in;
160
+ margin-bottom: 1in;
161
+ }
162
+
163
+ body {
164
+ font-size: var(--print-font-size);
165
+ line-height: var(--print-line-height);
166
+ width: auto;
167
+ margin: 0;
168
+ padding: 0;
169
+ }
170
+
171
+ code {
172
+ font-size: calc(var(--print-font-size) * 7 / 8);
173
+ }
174
+
175
+ pre code {
176
+ font-size: calc(var(--print-font-size) * 3 / 4);
177
+ }
178
+
179
+ h1, h2, h3, h4, h5, h6, li, blockquote {
180
+ page-break-inside: avoid;
181
+ }
182
+
183
+ p {
184
+ widows: 3;
185
+ orphans: 3;
186
+ }
187
+ }
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= stylesheet_tag %>
5
+ <style type="text/css"><%= inline_styles %></style>
6
+ </head>
7
+ <body>
8
+ <div id="container"><%= content %></div>
9
+ </body>
10
+ </html>