diff --git a/lib/docx/containers/text_run.rb b/lib/docx/containers/text_run.rb index 59be9d3..1bc717f 100755 --- a/lib/docx/containers/text_run.rb +++ b/lib/docx/containers/text_run.rb @@ -95,7 +95,11 @@ def underlined? end def hyperlink? - @node.name == 'hyperlink' + @node.name == 'hyperlink' && external_link? + end + + def external_link? + !@node.attributes['id'].nil? end def href diff --git a/spec/docx/document_spec.rb b/spec/docx/document_spec.rb index 28db70f..980327a 100755 --- a/spec/docx/document_spec.rb +++ b/spec/docx/document_spec.rb @@ -522,4 +522,13 @@ end end + describe '#to_html' do + before do + @doc = Docx::Document.open(@fixtures_path + '/internal-links.docx') + end + + it 'should not raise error' do + expect { @doc.to_html }.to_not raise_error + end + end end diff --git a/spec/fixtures/internal-links.docx b/spec/fixtures/internal-links.docx new file mode 100644 index 0000000..31a7153 Binary files /dev/null and b/spec/fixtures/internal-links.docx differ