asciidoctor-tabs 1.0.0.alpha.1 → 1.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +23 -0
- data/README.adoc +4 -4
- data/lib/asciidoctor/tabs/block.rb +10 -9
- data/lib/asciidoctor/tabs/extensions.rb +11 -6
- data/lib/asciidoctor/tabs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3efce4ce7fa405dd4983609797c24e85e5ee768ff1e70ee3df4e702cd579d79
|
4
|
+
data.tar.gz: b7671c6c76d775c1e46850fd0464c45e9b4ef7f9478c478b5f8c13d9a2cebb02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18b40647d4c424f1d9ce9749c7ca038342ae31ce4660ba4099b89cf9ca5a4c37540eb984384212f74f7b11b8987b9762847ff32710b2372a9bb3f186a720cd31
|
7
|
+
data.tar.gz: 21296914a580547da6f0703af319390351f9326a18ccc99b51719482fa6e73f2e466b6d2f9b0e99c673d7337aaf32faa8cc7a1d221f9b9bc5b6dc427b89bef34
|
data/CHANGELOG.adoc
CHANGED
@@ -4,6 +4,29 @@
|
|
4
4
|
This document provides a curated view of the changes to Asciidoctor Tabs per release.
|
5
5
|
For a detailed view of what has changed, refer to the {url-repo}/commits/main[commit history] on GitHub.
|
6
6
|
|
7
|
+
== 1.0.0-alpha.2 (2022-10-03) - @mojavelinux
|
8
|
+
|
9
|
+
=== Added
|
10
|
+
|
11
|
+
* Transpile `Asciidoctor::Tabs::Extensions` class for npm package
|
12
|
+
|
13
|
+
=== Changed
|
14
|
+
|
15
|
+
* Rename `idx-tabset` counter to `tabset-number` to be consistent with built-in counter names
|
16
|
+
* Don't register docinfo extensions if converter is producing embedded output
|
17
|
+
* Update `register` and `unregister` on `Asciidoctor::Tabs::Extensions` to accept a registry argument
|
18
|
+
* Delegate registration of extension in npm package to `Asciidoctor::Tabs::Extensions.register` method
|
19
|
+
* Allow `Extensions` class to be required from `@asciidoctor/tabs/extensions` in Node.js; attach `Block` and `Docinfo` classes
|
20
|
+
|
21
|
+
=== Fixed
|
22
|
+
|
23
|
+
* Honor explicit ID on tabs block and use it as ID prefix for tabs
|
24
|
+
* Autogenerate IDs for tabsets and tabs in a manner consistent with section ID generation (#2)
|
25
|
+
|
26
|
+
=== Details
|
27
|
+
|
28
|
+
{url-repo}/releases/tag/v1.0.0-alpha.2[git tag] | {url-repo}/compare/v1.0.0-alpha.1\...v1.0.0-alpha.2[full diff]
|
29
|
+
|
7
30
|
== 1.0.0-alpha.1 (2022-10-01) - @mojavelinux
|
8
31
|
|
9
32
|
_Initial release._
|
data/README.adoc
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
= Asciidoctor Tabs
|
2
2
|
Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
|
3
|
-
v1.0.0-alpha.
|
3
|
+
v1.0.0-alpha.2, 2022-10-03
|
4
4
|
:idprefix:
|
5
5
|
:idseparator: -
|
6
6
|
|
7
|
-
An Asciidoctor extension that adds tabs to the AsciiDoc syntax.
|
8
|
-
|
7
|
+
An Asciidoctor extension that adds a tabs block to the AsciiDoc syntax.
|
8
|
+
Each set of tabs (a "tabset") is constructed from a dlist enclosed in an example block marked with the tabs style.
|
9
9
|
This extension is only designed to be used with the `html` backend.
|
10
10
|
|
11
11
|
== Install
|
@@ -41,7 +41,7 @@ Then use Bundler to install the gem:
|
|
41
41
|
|
42
42
|
A tabset is defined using a dlist enclosed in an example block marked with the tabs style.
|
43
43
|
Each item in the dlist becomes a separate tab.
|
44
|
-
The term in the dlist item is used
|
44
|
+
The term in the dlist item is used as the tab's label.
|
45
45
|
The description in the dlist item is used for the contents of the tab.
|
46
46
|
The contents can be defined as primary text, attached blocks, or blocks enclosed in an attached open block.
|
47
47
|
If the blocks are enclosed in an attached open block, the open block enclosure itself will be discarded.
|
@@ -6,16 +6,13 @@ module Asciidoctor
|
|
6
6
|
use_dsl
|
7
7
|
on_context :example
|
8
8
|
|
9
|
-
ID_SEPARATOR_CHAR = '-'
|
10
|
-
INVALID_ID_CHARS_RX = /[^a-zA-Z0-9_]/
|
11
|
-
|
12
9
|
def process parent, reader, attrs
|
13
|
-
block = create_block parent,
|
10
|
+
block = create_block parent, attrs['cloaked-context'], nil, attrs, content_model: :compound
|
14
11
|
children = (parse_content block, reader).blocks
|
15
12
|
return block unless children.size == 1 && (source_tabs = children[0]).context == :dlist && source_tabs.items?
|
16
13
|
nodes = []
|
17
|
-
|
18
|
-
id =
|
14
|
+
tabset_number = (doc = parent.document).counter 'tabset-number'
|
15
|
+
id = attrs['id'] || %(#{doc.attributes['idprefix'] || '_'}tabset#{tabset_number})
|
19
16
|
nodes << (create_html_fragment parent, %(<div id="#{id}" class="tabset is-loading">))
|
20
17
|
tabs = create_list parent, :ulist
|
21
18
|
tabs.add_role 'tabs'
|
@@ -23,7 +20,7 @@ module Asciidoctor
|
|
23
20
|
source_tabs.items.each do |(title), details|
|
24
21
|
tab = create_list_item tabs
|
25
22
|
tabs << tab
|
26
|
-
tab_id = generate_id title.text, id
|
23
|
+
tab_id = generate_id title.text, id, doc
|
27
24
|
tab.text = %([[#{tab_id}]]#{title.instance_variable_get :@text})
|
28
25
|
if details.blocks?
|
29
26
|
blocks = details.blocks
|
@@ -56,8 +53,12 @@ module Asciidoctor
|
|
56
53
|
create_block parent, 'pass', html, nil
|
57
54
|
end
|
58
55
|
|
59
|
-
def generate_id str, base_id
|
60
|
-
|
56
|
+
def generate_id str, base_id, doc
|
57
|
+
restore_idprefix = (attrs = doc.attributes)['idprefix']
|
58
|
+
attrs['idprefix'] = %(#{base_id}#{attrs['idseparator'] || '_'})
|
59
|
+
::Asciidoctor::Section.generate_id str, doc
|
60
|
+
ensure
|
61
|
+
restore_idprefix ? (attrs['idprefix'] = restore_idprefix) : (attrs.delete 'idprefix')
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require_relative '
|
3
|
+
unless RUBY_ENGINE == 'opal'
|
4
|
+
require_relative 'block'
|
5
|
+
require_relative 'docinfo'
|
6
|
+
end
|
5
7
|
|
6
8
|
module Asciidoctor
|
7
9
|
module Tabs
|
@@ -11,8 +13,10 @@ module Asciidoctor
|
|
11
13
|
def group
|
12
14
|
proc do
|
13
15
|
block Block, :tabs
|
16
|
+
next if @document.embedded?
|
14
17
|
docinfo_processor Docinfo::Styles
|
15
18
|
docinfo_processor Docinfo::Behavior
|
19
|
+
nil
|
16
20
|
end
|
17
21
|
end
|
18
22
|
|
@@ -20,12 +24,13 @@ module Asciidoctor
|
|
20
24
|
:tabs
|
21
25
|
end
|
22
26
|
|
23
|
-
def register
|
24
|
-
::Asciidoctor::Extensions.
|
27
|
+
def register registry = nil
|
28
|
+
(registry || ::Asciidoctor::Extensions).groups[key] ||= group
|
25
29
|
end
|
26
30
|
|
27
|
-
def unregister
|
28
|
-
::Asciidoctor::Extensions.groups.delete key
|
31
|
+
def unregister registry = nil
|
32
|
+
(registry || ::Asciidoctor::Extensions).groups.delete key
|
33
|
+
nil
|
29
34
|
end
|
30
35
|
end
|
31
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor-tabs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.alpha.
|
4
|
+
version: 1.0.0.alpha.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-10-
|
11
|
+
date: 2022-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|