プロジェクト

全般

プロフィール

Vote #80176

完了

Convert HTML links to Textile/Markdown links when creating an issue from an email

Admin Redmine さんが4年以上前に追加. 4年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Email receiving_29
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
29
version_id:
127
issue_org_id:
31695
author_id:
362529
assigned_to_id:
332
comments:
8
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

When creating an issue from HTML format email, the href attribute of the A tag disappears, and only the string is acquired.

[Input]

foobarbaz

[Expected]

foo "bar":http://example.com/ baz

[Actual]

foobarbaz

journals

I attached a patch for Textile and Markdown.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Setting the target version to 4.1.0.
--------------------------------------------------------------------------------
Committed the patch. Thank you for improving Redmine.
--------------------------------------------------------------------------------
The current implementation fails with the following error if the link doesn't contain the @href@ attribute.

<pre>
Error:
Redmine::WikiFormatting::MarkdownHtmlParserTest#test_should_not_convert_a_tag_without_href:
NoMethodError: undefined method `value' for nil:NilClass
lib/redmine/wiki_formatting/markdown/html_parser.rb:40:in `block in <class:HtmlParser>'
lib/redmine/wiki_formatting/html_parser.rb:58:in `scrub'
lib/redmine/wiki_formatting/html_parser.rb:36:in `to_text'
test/unit/lib/redmine/wiki_formatting/markdown_html_parser_test.rb:41:in `test_should_not_convert_a_tag_without_href'
</pre>

I'm attaching:
1. Tests for for markdown and textile which fail on the current trunk
2. A proposed fix, but I'm not sure if @foo<a name="Header-one">bar</a>baz@ should be converted to @foo bar baz@ or to @foobarbaz@.

--------------------------------------------------------------------------------
Marius BALTEANU wrote:
> The current implementation fails with the following error if the link doesn't contain the @href@ attribute.

Thank you for catching and fixing the error.

> 2. A proposed fix, but I'm not sure if @foo<a name="Header-one">bar</a>baz@ should be converted to @foo bar baz@ or to @foobarbaz@.

I think we can omit the surrounding spaces for that case. Text generated from `@<a href="http://www.example.com/">foo</a>@` style HTML should have surrounding spaces because Textile link `<notextile>"foo":http://www.example.com/</notextile>` does not work without surrounding spaces. However, the text "bar" you will get by converting from `@<a name="Header-one">bar</a>@` does not have any markup and will be always rendered properly. So, I think the surrounding spaces are unnecessary.

--------------------------------------------------------------------------------
Go MAEDA wrote:
> Marius BALTEANU wrote:
> > The current implementation fails with the following error if the link doesn't contain the @href@ attribute.
>
> Thank you for catching and fixing the error.
>
> > 2. A proposed fix, but I'm not sure if @foo<a name="Header-one">bar</a>baz@ should be converted to @foo bar baz@ or to @foobarbaz@.
>
> I think we can omit the surrounding spaces for that case. Text generated from `@<a href="http://www.example.com/">foo</a>@` style HTML should have surrounding spaces because Textile link `<notextile>"foo":http://www.example.com/</notextile>` does not work without surrounding spaces. However, the text "bar" you will get by converting from `@<a name="Header-one">bar</a>@` does not have any markup and will be always rendered properly. So, I think the surrounding spaces are unnecessary.

Great! Please feel free to update the patches.

--------------------------------------------------------------------------------
Marius BALTEANU wrote:
> The current implementation fails with the following error if the link doesn't contain the @href@ attribute.

Committed the patches. Thank you.

--------------------------------------------------------------------------------

Admin Redmine さんが4年以上前に更新

  • カテゴリEmail receiving_29 にセット
  • 対象バージョン4.1.0_127 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0