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

Improper space parsing within codeblock #72

Closed
maestromac opened this issue May 7, 2018 · 2 comments
Closed

Improper space parsing within codeblock #72

maestromac opened this issue May 7, 2018 · 2 comments

Comments

@maestromac
Copy link

The use of String#squeeze in the file below is messing with codeblock's indentation.

text.tr("\n\t", ' ').squeeze(' ')

I.E.

# Original code block
def original_value
  if assigned?
    original_attribute.original_value
  else
    type_cast(value_before_type_cast)
  end
end

# After ReverseMarkdown
def original_value
 if assigned?
 original_attribute.original_value
 else
 type_cast(value_before_type_cast)
 end
end
@xijo
Copy link
Owner

xijo commented Apr 5, 2019

@maestromac Thanks for reporting. Can you provide a complete example of the problem.

The following looks ok for me:

code =<<~EOS
  <pre>
    <code>
      def original_value
        if assigned?
          original_attribute.original_value
        else
          type_cast(value_before_type_cast)
        end
      end
    </code>
  </pre>
EOS

puts ReverseMarkdown.convert(code)

        def original_value
          if assigned?
            original_attribute.original_value
          else
            type_cast(value_before_type_cast)
          end
        end

@maestromac
Copy link
Author

It's been a while so I'm having trouble recalling and providing the original item that caused this problem. One thing I do remember is that the code block may not have been wrapped in a pre/code tag.

Thanks for following up. Since we went ahead and monkey patched that method, I'm closing this 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

No branches or pull requests

2 participants