howdoc 0.1.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.
@@ -0,0 +1,110 @@
1
+ :root {
2
+ --howdoc-bg: #ffffff;
3
+ --howdoc-fg: #1c1e21;
4
+ --howdoc-muted: #5c6470;
5
+ --howdoc-rule: #e3e6ea;
6
+ --howdoc-accent: #1a5fb4;
7
+ --howdoc-shadow: rgba(16, 24, 40, 0.12);
8
+ }
9
+
10
+ @media (prefers-color-scheme: dark) {
11
+ :root {
12
+ --howdoc-bg: #16181c;
13
+ --howdoc-fg: #e6e8eb;
14
+ --howdoc-muted: #9aa3b0;
15
+ --howdoc-rule: #2b3038;
16
+ --howdoc-accent: #8ab4f8;
17
+ --howdoc-shadow: rgba(0, 0, 0, 0.5);
18
+ }
19
+ }
20
+
21
+ body.howdoc {
22
+ margin: 0;
23
+ background: var(--howdoc-bg);
24
+ color: var(--howdoc-fg);
25
+ font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
26
+ }
27
+
28
+ .howdoc-document,
29
+ .howdoc-index {
30
+ max-width: 52rem;
31
+ margin: 0 auto;
32
+ padding: 3rem 1.25rem 6rem;
33
+ }
34
+
35
+ .howdoc h1 {
36
+ margin: 0 0 1rem;
37
+ font-size: 1.9rem;
38
+ line-height: 1.25;
39
+ }
40
+
41
+ .howdoc-intro {
42
+ color: var(--howdoc-muted);
43
+ }
44
+
45
+ .howdoc-lede {
46
+ margin: 1.5rem 0 0.5rem;
47
+ color: var(--howdoc-muted);
48
+ }
49
+
50
+ .howdoc-steps {
51
+ margin: 0;
52
+ padding-left: 1.5rem;
53
+ }
54
+
55
+ .howdoc-step {
56
+ margin: 0 0 2.5rem;
57
+ padding-left: 0.25rem;
58
+ }
59
+
60
+ .howdoc-step.howdoc-arrival {
61
+ border-left: 3px solid var(--howdoc-accent);
62
+ margin-left: -1rem;
63
+ padding-left: 1rem;
64
+ }
65
+
66
+ .howdoc-shot {
67
+ display: block;
68
+ max-width: 100%;
69
+ height: auto;
70
+ margin: 0.9rem 0 0;
71
+ border: 1px solid var(--howdoc-rule);
72
+ border-radius: 6px;
73
+ box-shadow: 0 2px 10px var(--howdoc-shadow);
74
+ }
75
+
76
+ .howdoc-toc {
77
+ list-style: none;
78
+ margin: 1.5rem 0 0;
79
+ padding: 0;
80
+ }
81
+
82
+ .howdoc-toc-group {
83
+ margin: 1.75rem 0 0.5rem;
84
+ color: var(--howdoc-muted);
85
+ font-size: 0.8rem;
86
+ font-weight: 600;
87
+ letter-spacing: 0.08em;
88
+ text-transform: uppercase;
89
+ }
90
+
91
+ .howdoc-toc-entry {
92
+ border-bottom: 1px solid var(--howdoc-rule);
93
+ }
94
+
95
+ .howdoc-toc-entry a {
96
+ display: block;
97
+ padding: 0.65rem 0;
98
+ color: var(--howdoc-accent);
99
+ text-decoration: none;
100
+ }
101
+
102
+ .howdoc-toc-entry a:hover {
103
+ text-decoration: underline;
104
+ }
105
+
106
+ @media print {
107
+ .howdoc-shot {
108
+ box-shadow: none;
109
+ }
110
+ }
@@ -0,0 +1,16 @@
1
+ !!!
2
+ %html{ lang: @document.locale }
3
+ %head
4
+ %meta{ charset: 'utf-8' }
5
+ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
6
+ %title= @document.heading
7
+ %link{ rel: 'stylesheet', href: '../assets/howdoc.css' }
8
+ %body.howdoc
9
+ %main.howdoc-document
10
+ %h1= @document.heading
11
+ - unless @document.intro.to_s.strip.empty?
12
+ .howdoc-intro!= @document.intro
13
+ %p.howdoc-lede= I18n.t('howdoc.document.follow_steps', locale: @document.locale)
14
+ %ol.howdoc-steps
15
+ - @document.steps.reject(&:empty?).each do |step|
16
+ != render('document/html/step.haml', step: step)
@@ -0,0 +1,7 @@
1
+ -# The sentence carries its own markup, so it is written out unescaped. Every
2
+ -# value interpolated into it was escaped when the step was narrated.
3
+ %li.howdoc-step{ class: ('howdoc-arrival' if @step.arrival) }
4
+ - if @step.html
5
+ .howdoc-text!= @step.html
6
+ - if @step.screenshot
7
+ %img.howdoc-shot{ src: "images/#{@step.screenshot}", alt: "#{@document.title} — #{@step.number}", loading: 'lazy' }
@@ -0,0 +1,22 @@
1
+ !!!
2
+ %html{ lang: @locale }
3
+ %head
4
+ %meta{ charset: 'utf-8' }
5
+ %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' }
6
+ %title= I18n.t('howdoc.index.title', locale: @locale)
7
+ %link{ rel: 'stylesheet', href: '../assets/howdoc.css' }
8
+ %body.howdoc
9
+ %main.howdoc-index
10
+ %h1= I18n.t('howdoc.index.title', locale: @locale)
11
+ - if @records.empty?
12
+ %p= I18n.t('howdoc.index.empty', locale: @locale)
13
+ - else
14
+ %ul.howdoc-toc
15
+ - previous_group = nil
16
+ - @records.each do |record|
17
+ - group = @config.group_label.call(record)
18
+ - if group && group != previous_group
19
+ %li.howdoc-toc-group= group
20
+ - previous_group = group
21
+ %li.howdoc-toc-entry
22
+ %a{ href: "./#{record.filename}" }= record.heading
metadata ADDED
@@ -0,0 +1,99 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: howdoc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Priit Tark
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: haml
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '6.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '6.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: i18n
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '1.8'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '1.8'
40
+ description: |
41
+ Howdoc turns a browser test into a step-by-step guide for the people who use
42
+ your application. It narrates the Capybara actions a test performs, captures a
43
+ screenshot at each interesting moment, and writes an illustrated HTML guide
44
+ plus a machine-readable manifest. Because the guide is produced by a test that
45
+ has to pass, it cannot drift away from the application it describes.
46
+ email:
47
+ - priit.tark@gmail.com
48
+ executables: []
49
+ extensions: []
50
+ extra_rdoc_files: []
51
+ files:
52
+ - CHANGELOG.md
53
+ - LICENSE.txt
54
+ - README.md
55
+ - config/locales/howdoc.en.yml
56
+ - config/locales/howdoc.et.yml
57
+ - lib/howdoc.rb
58
+ - lib/howdoc/capybara_actions.rb
59
+ - lib/howdoc/configuration.rb
60
+ - lib/howdoc/document.rb
61
+ - lib/howdoc/minitest.rb
62
+ - lib/howdoc/narrator.rb
63
+ - lib/howdoc/recorder.rb
64
+ - lib/howdoc/registry.rb
65
+ - lib/howdoc/screenshot.rb
66
+ - lib/howdoc/step.rb
67
+ - lib/howdoc/tasks.rb
68
+ - lib/howdoc/templates.rb
69
+ - lib/howdoc/version.rb
70
+ - lib/howdoc/writers.rb
71
+ - templates/default/assets/howdoc.css
72
+ - templates/default/document/html/layout.haml
73
+ - templates/default/document/html/step.haml
74
+ - templates/default/index/html/layout.haml
75
+ homepage: https://github.com/priit/howdoc
76
+ licenses:
77
+ - MIT
78
+ metadata:
79
+ source_code_uri: https://github.com/priit/howdoc
80
+ changelog_uri: https://github.com/priit/howdoc/blob/main/CHANGELOG.md
81
+ rubygems_mfa_required: 'true'
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '3.2'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubygems_version: 4.0.6
97
+ specification_version: 4
98
+ summary: Generate end-user documentation from your Capybara system tests.
99
+ test_files: []