Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for quoted text attributes (prefixed in square brackets) #350

Closed
wants to merge 4 commits into from

Conversation

Hextremist
Copy link
Contributor

Supports all the types listed in the examples for asciidoc:
http://www.methods.co.nz/asciidoc/chunked/ch10.html
I.e. work for underline, overline, line-through, colors, big and
small.

@Hextremist
Copy link
Contributor Author

Hi, I did some changes to make underline, colors etc work as for the Asciidoctor HTML format.

Supports all the types listed in the examples for asciidoc:
http://www.methods.co.nz/asciidoc/chunked/ch10.html
I.e. work for underline, overline, line-through, colors, big and
small.
Instead of creating the hash on every invocation of apply(), it is created
once.
The keyboard keys now look more like keys.
@igagis
Copy link

igagis commented Jun 1, 2016

Absence of line-through and underline and red and blue colours blocks the use of potential asciidoc-diff utility with asciidoctor-pdf

@git-ere
Copy link

git-ere commented Oct 28, 2016

I came over the same problem:
stackoverflow discussion

I've tried to fix this issue and I think I've got a solution. As I never did Ruby programming neither know the ascidoctor architecture, below I describe the code changes I did.

Pls feel free to comment.
changed line 1817 of converter.rb
old:
quoted_text = %(<span class="#{role}">#{open}#{node.text}#{close}</span>)

new:

style = add_style style, role, 'font-style', 'font_style'
  style = add_style style, role, 'font-size', 'font_size'
  style = add_style style, role, 'color', 'font_color'
  quoted_text = %(<span style="#{style}">#{open}#{node.text}#{close}</span>)

added method in converter.rb

def add_style (style, role, styleName, *themeName)
    themeName = themeName ? themeName.first : styleName
    value = eval %(@theme.#{role}_#{themeName})
    if value
       if style
         style = %(#{style};)
       end
       style = %(#{style}#{styleName}:#{value})
    end
    return style
  end

added lines in transform.rb

added after line 225

  when 'font-size'
    unless fragment[:size]
      fragment[:size] = pvalue
    end

I've just tested with some styling properties. If ok all of theming-guide should propably being added.

@mojavelinux
Copy link
Member

I'm cherry picking from this pull request to make the changes easier to track. I've implemented the underline and line-through roles thus far.

I'm planning to map big and small to the base_font_size_large and base_font_size_small theme settings.

I'm still thinking about the best way to handle the colors.

@Patola
Copy link

Patola commented Sep 30, 2017

Any progress on the color dealing in asciidoctor?

@aoyawale
Copy link

any update on this?

@mojavelinux
Copy link
Member

This has now been implemented, mainly as part of #368.

The only thing not implemented is the background and border for custom roles. However, it wouldn't be too much effort to add it to the current implementation. If that's needed, let's pursue it as a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants