asciidoctor-bespoke 1.0.0.alpha.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.
@@ -0,0 +1,2 @@
1
+ / QUESTION should the role be "note" or "notes"?
2
+ aside role='note' =resolve_content
@@ -0,0 +1,14 @@
1
+ - _has_title = title?
2
+ - content_for :ol
3
+ ol id=id class=[(style unless style == 'arabic'), ('fit' if (_fit = option? :fit)), *build_roles, role] reversed=('true' if option? :reversed)
4
+ - items.each do |_item|
5
+ li class=('line' if _fit)
6
+ span.primary=_item.text
7
+ - if _item.blocks?
8
+ =_item.content
9
+ - if _has_title
10
+ figure.list.ordered id=id
11
+ figcaption=title
12
+ - yield_content :ol
13
+ - else
14
+ - yield_content :ol
@@ -0,0 +1,4 @@
1
+ - if !(_roles = roles + build_roles).empty? || id
2
+ div id=id class=_roles =content
3
+ - else
4
+ =content
@@ -0,0 +1,9 @@
1
+ p id=id class=role
2
+ - if title?
3
+ - _title = title
4
+ - _stacked = option? 'stacked'
5
+ strong.heading(class=(_stacked ? 'stacked' : 'run-in')
6
+ data-terminus=((local_attr 'heading-terminus', '.') unless _stacked || _title =~ /[.?!:,;]$/))=>_title
7
+ =content
8
+ - else
9
+ =content
@@ -0,0 +1,14 @@
1
+ - _has_attribution, _has_citetitle, _has_title = (local_attr? :attribution), (local_attr? :citetitle), title?
2
+ figure.quote id=id class=role
3
+ blockquote=resolve_content
4
+ - if _has_attribution || _has_citetitle || _has_title
5
+ =newline
6
+ figcaption
7
+ - if _has_attribution
8
+ =local_attr :attribution
9
+ =spacer if _has_citetitle || _has_title
10
+ - if _has_citetitle
11
+ cite=local_attr :citetitle
12
+ =spacer if _has_title
13
+ - if _has_title
14
+ span.context=title
@@ -0,0 +1,32 @@
1
+ - _title = title
2
+ - _id = (_id = id) && _title == '!' && !(local_attr? :id) ? nil : _id
3
+ - _roles = roles
4
+ / TODO support build attribute here for more fine-grained control
5
+ / QUESTION should build roles be applied to the section?
6
+ - _build_roles = (option? :build) ? ['build', 'build-items', *%w(fade vanish replace).map {|_r| _roles.delete _r }] : []
7
+ / TODO alternate terms for "canvas" - pane, slide, panel
8
+ / TODO also implement "surface" (alternate terms for "surface" - backdrop, screen)
9
+ - _style = nil
10
+ - if (_bg_img = pluck_first context: :image, role: 'canvas')
11
+ - _style = %[background-image: url(#{image_uri _bg_img.attr(:target)}); background-size: #{(_bg_img.roles & %w[cover contain])[0] || 'cover'}; background-repeat: no-repeat]
12
+ section id=_id class=[*_roles, ('image' if _bg_img)] style=_style data-title=(local_attr 'reftext') data-bespoke-backdrop=(local_attr 'backdrop-role')
13
+ - content_for :content
14
+ - unless (_title.start_with? '!') || (option? :conceal)
15
+ - if (_title_obj = partition_title _title).subtitle?
16
+ / QUESTION should we support fit option when there's a subtitle?
17
+ header class=_build_roles
18
+ h2=slice_text _title_obj.title
19
+ h3=slice_text _title_obj.subtitle
20
+ - else
21
+ / QUESTION always wrap in span.line when option? :fit
22
+ h2 class=[('fit' if option? :fit), *_build_roles] =slice_text _title_obj.title
23
+ - unless (_content = content).empty?
24
+ =_content
25
+ - if (option? :enclose) || (document.attr? 'enclose-option')
26
+ - _notes = pluck_first context: :sidebar, role: 'cue'
27
+ .content
28
+ - yield_content :content
29
+ - if _notes
30
+ =_notes.convert
31
+ - else
32
+ - yield_content :content
@@ -0,0 +1,7 @@
1
+ - if has_role? 'cue'
2
+ include notes.html.slim
3
+ - else
4
+ aside id=id class=role
5
+ - if title?
6
+ h1=title
7
+ =resolve_content
@@ -0,0 +1,13 @@
1
+ - _author = document.attr :author
2
+ - _id = (_id = id) && title == '!' && !(local_attr? :id) ? nil : _id
3
+ - _editable = (option? :editable) ? 'true' : nil
4
+ - _spellcheck = _editable ? 'false' : nil
5
+ section.speaker id=_id class=role data-title=(local_attr 'reftext')
6
+ header
7
+ h2 contenteditable=_editable spellcheck=_spellcheck =_author
8
+ h3 contenteditable=_editable spellcheck=_spellcheck =document.attr :position
9
+ figure.image.headshot
10
+ img src=(image_uri document.attr :avatar) alt=_author
11
+ p.contact contenteditable=_editable spellcheck=_spellcheck #{document.attr :twitter} | #{document.attr :email}
12
+ - unless (_content = content).empty?
13
+ =_content
@@ -0,0 +1,54 @@
1
+ / recognize id and options for the doctitle (aka header); should be part of Asciidoctor core
2
+ - (attr 'header-opts').split(',').each {|opt| header.set_option opt unless header.option? opt } if attr? 'header-opts'
3
+ - header.id = attr 'header-id'
4
+ - _bg_img = _style = nil
5
+ - if (_preamble = pluck_first context: :preamble)
6
+ - unless (_result = _preamble.find_by context: :image, role: 'canvas').empty?
7
+ - (_bg_img = _result[0]).set_attr 'skip-option', ''
8
+ - _style = %[background-image: url(#{image_uri _bg_img.attr(:target)}); background-size: #{(_bg_img.roles & %w[cover contain])[0] || 'cover'}; background-repeat: no-repeat]
9
+ section.title id=header.id class=[role, ('image' if _bg_img)] style=_style data-title='' data-bespoke-backdrop=(attr 'header-backdrop-role')
10
+ - content_for :content
11
+ - if (_title_obj = doctitle partition: true, use_fallback: true).subtitle?
12
+ header
13
+ h1=slice_text _title_obj.title, (_slice = header.option? :slice)
14
+ h2=slice_text _title_obj.subtitle, _slice
15
+ - else
16
+ h1=slice_text _title_obj.title, (header.option? :slice)
17
+ =_preamble ? _preamble.content : nil
18
+ / TODO move footer to include file
19
+ - if attr? :author
20
+ footer
21
+ / TODO handle multiple authors
22
+ p.author
23
+ span.personname
24
+ span.firstname=>attr :firstname
25
+ span.surname=attr :lastname
26
+ - if (attr? :position) || (attr? :organization)
27
+ =newline
28
+ span.affiliation
29
+ - if attr? :position
30
+ span.position=>attr :position
31
+ - if attr? :organization
32
+ span.organization=attr :organization
33
+ - if attr? :avatar
34
+ =newline
35
+ img.avatar src=(image_uri attr :avatar) alt=(attr :author)
36
+ - if (attr? :twitter) || (attr? :email)
37
+ =newline
38
+ span.contact
39
+ - if attr? :twitter
40
+ span.twitter=>attr :twitter
41
+ - if (attr? :email)
42
+ - if (((_val = attr :email).start_with? 'http://') || (_val.start_with? 'https://'))
43
+ span.url=_val[((_val.index '//') + 2)..-1]
44
+ - else
45
+ span.email=_val
46
+ /- if attr? :hashtag
47
+ / p.meta: span.hashtag=attr :hashtag
48
+ - if (header.option? :enclose) || (document.attr? 'enclose-option')
49
+ - _notes = _preamble ? (pluck_first context: :sidebar, role: 'cue') : nil
50
+ .content
51
+ - yield_content :content
52
+ =_notes ? _notes.convert : nil
53
+ - else
54
+ - yield_content :content
@@ -0,0 +1,14 @@
1
+ - _has_title = title?
2
+ - content_for :ul
3
+ ul id=(id unless _has_title) class=[style, ('fit' if (_fit = option? :fit)), *build_roles, role]
4
+ - items.each do |_item|
5
+ li class=('line' if _fit)
6
+ span.primary=_item.text
7
+ - if _item.blocks?
8
+ =_item.content
9
+ - if _has_title
10
+ figure.list.unordered id=id
11
+ figcaption=title
12
+ - yield_content :ul
13
+ - else
14
+ - yield_content :ul
@@ -0,0 +1,36 @@
1
+ / add support for %rewind option (data-rewind) and volume attribute (data-volume)
2
+ - _service = (%w(vimeo youtube) & [(local_attr :poster)])[0]
3
+ - _rew = (option? :rewind) ? 'true' : nil
4
+ - _vol = (option? :muted) ? 0 : (attr :volume)
5
+ figure.video class=_service id=id class=role
6
+ - case _service
7
+ - when 'vimeo'
8
+ - require 'securerandom' unless defined? ::SecureRandom
9
+ - _player_id = %(vimeo-#{SecureRandom.urlsafe_base64 7})
10
+ - _start = (local_attr? :start) ? %(#at=#{local_attr :start}) : nil
11
+ / NOTE for a list of params, see https://developer.vimeo.com/player/embedding#universal-parameters
12
+ - _params = [%(player_id=#{_player_id}), 'api=1']
13
+ - _params += (option? :background) ? ['autoplay=0', 'background=1'] : ['badge=0', 'portrait=0', 'title=0', 'byline=0']
14
+ - _params << 'loop=1' if option? :loop
15
+ - _src = %(#{asset_uri_scheme}//player.vimeo.com/video/#{local_attr :target}?#{_params * '&amp;'})
16
+ iframe(id=_player_id src=_src width=(local_attr :width) height=(local_attr :height) frameborder=0
17
+ allowfullscreen=('true' unless option? :nofullscreen) data-rewind=_rew data-volume=_vol)
18
+ - when 'youtube'
19
+ - _target = local_attr :target
20
+ - _params = ['enablejsapi=1', 'rel=0', 'showinfo=0', 'controls=0', 'disablekb=1']
21
+ / NOTE start and end must be in seconds
22
+ - _params << %(start=#{local_attr :start}) if local_attr? :start
23
+ - _params << %(end=#{local_attr :start}) if local_attr? :end
24
+ - _params += ['loop=1', %(playlist=#{_target})] if option? :loop
25
+ - _params << 'fs=0' if option? :nofullscreen
26
+ - _params << %(hl=#{document.attr :lang}) if document.attr? :lang
27
+ - _src = %(#{asset_uri_scheme}//www.youtube.com/embed/#{_target}?#{_params * '&amp;'})
28
+ iframe(src=_src width=(local_attr :width) height=(local_attr :height) frameborder=0
29
+ allowfullscreen=('true' unless option? :nofullscreen) data-rewind=_rew data-volume=_vol)
30
+ - else
31
+ video(src=(media_uri local_attr :target) width=(local_attr :width) height=(local_attr :height)
32
+ poster=((_poster = local_attr :poster).nil_or_empty? ? nil : (media_uri _poster)) preload='auto'
33
+ controls=('true' if option? :controls) loop=('true' if option? :loop) data-rewind=_rew data-volume=_vol)
34
+ span.alt=local_attr :alt, 'Your browser does not support the video element.'
35
+ - if title?
36
+ figcaption=title
metadata ADDED
@@ -0,0 +1,129 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asciidoctor-bespoke
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0.alpha.1
5
+ platform: ruby
6
+ authors:
7
+ - Dan Allen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: asciidoctor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: slim
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.0.6
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.6
41
+ - !ruby/object:Gem::Dependency
42
+ name: thread_safe
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.3.5
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.3.5
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 10.4.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 10.4.2
69
+ description: An Asciidoctor converter that generates the HTML component of a Bespoke.js
70
+ presentation from AsciiDoc.
71
+ email:
72
+ - dan.j.allen@gmail.com
73
+ executables:
74
+ - asciidoctor-bespoke
75
+ extensions: []
76
+ extra_rdoc_files:
77
+ - README.adoc
78
+ - LICENSE.adoc
79
+ files:
80
+ - LICENSE.adoc
81
+ - README.adoc
82
+ - Rakefile
83
+ - bin/asciidoctor-bespoke
84
+ - lib/asciidoctor-bespoke.rb
85
+ - lib/asciidoctor-bespoke/converter.rb
86
+ - lib/asciidoctor-bespoke/version.rb
87
+ - templates/slim/admonition.html.slim
88
+ - templates/slim/audio.html.slim
89
+ - templates/slim/document.html.slim
90
+ - templates/slim/helpers.rb
91
+ - templates/slim/image.html.slim
92
+ - templates/slim/listing.html.slim
93
+ - templates/slim/literal.html.slim
94
+ - templates/slim/notes.html.slim
95
+ - templates/slim/olist.html.slim
96
+ - templates/slim/open.html.slim
97
+ - templates/slim/paragraph.html.slim
98
+ - templates/slim/quote.html.slim
99
+ - templates/slim/section.html.slim
100
+ - templates/slim/sidebar.html.slim
101
+ - templates/slim/slide_speaker.html.slim
102
+ - templates/slim/slide_title.html.slim
103
+ - templates/slim/ulist.html.slim
104
+ - templates/slim/video.html.slim
105
+ homepage: https://github.com/asciidoctor/asciidoctor-bespoke
106
+ licenses:
107
+ - MIT
108
+ metadata: {}
109
+ post_install_message:
110
+ rdoc_options: []
111
+ require_paths:
112
+ - lib
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 1.9.3
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">"
121
+ - !ruby/object:Gem::Version
122
+ version: 1.3.1
123
+ requirements: []
124
+ rubyforge_project:
125
+ rubygems_version: 2.5.1
126
+ signing_key:
127
+ specification_version: 4
128
+ summary: Converts AsciiDoc to HTML for a Bespoke.js presentation
129
+ test_files: []