Skip to content

Commit

Permalink
add convert button method in the semantic HTML 5 converter (#4323)
Browse files Browse the repository at this point in the history
Co-authored-by: Kimberlee I. Model <kimee@redbow.kim>
  • Loading branch information
ggrossetie and redbow-kimee committed Dec 16, 2023
1 parent 3b5a886 commit cc33772
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
11 changes: 7 additions & 4 deletions devdocs/modern-html-converter/built-in-roles.adoc
Expand Up @@ -38,14 +38,17 @@ Here's the list of all the built-in roles used in the (new) modern HTML converte
|Double quotation mark

|menuseq
|Sequence of menu items (`menu` macro)
|Sequence of UI menu items (`menu` macro)

|menu
|Menu which can contain a submenu or a menu item (`menu` macro)
|UI menu which can contain a submenu or a menu item (`menu` macro)

|submenu
|Submenu which can contain submenus or a menu item (`menu` macro)
|UI submenu which can contain submenus or a menu item (`menu` macro)

|menuitem
|Menu item (`menu` macro)
|UI menu item (`menu` macro)

|button
|UI button (`button` macro)
|====
4 changes: 4 additions & 0 deletions lib/asciidoctor/converter/semantic_html5.rb
Expand Up @@ -188,6 +188,10 @@ def convert_inline_break node
%(#{node.text}<br>)
end

def convert_inline_button node
%(<span class="button">#{node.text}</span>)
end

def convert_inline_menu node
caret = '&#160;<b class="caret">&#8250;</b> '
submenu_joiner = %(</b>#{caret}<b class="submenu">)
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/semantic-html5-scenarios/button-text.adoc
@@ -0,0 +1,3 @@
:experimental:

Press btn:[Okay] or btn:[Cancel] to close the dialog.
3 changes: 3 additions & 0 deletions test/fixtures/semantic-html5-scenarios/button-text.html
@@ -0,0 +1,3 @@
<p>
Press <span class="button">Okay</span> or <span class="button">Cancel</span> to close the dialog.
</p>

0 comments on commit cc33772

Please sign in to comment.