FIX: Inline error when converting html to markdown

Looks like some html elements like `aside` and `section` will throw an error
when checking if they are inline or not. The commit simply handles

```
Job exception: undefined method `inline?' for nil:NilClass
```

and adds a test for it.
This commit is contained in:
Blake Erickson
2020-06-03 15:26:40 -06:00
parent f683c5d0e0
commit a89574ccb9
2 changed files with 18 additions and 1 deletions

View File

@ -99,7 +99,7 @@ class HtmlToMarkdown
end
def is_inline?(node)
node.text? || ("br" != node.name && node.description.inline? && node.children.all? { |n| is_inline?(n) })
node.text? || ("br" != node.name && node.description&.inline? && node.children.all? { |n| is_inline?(n) })
end
def collapse_spaces!(nodes, was_space = true)