プロジェクト

全般

プロフィール

Vote #69675

完了

Allow overriding direction of part of text

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

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Text formatting_26
対象バージョン:
開始日:
2011/04/10
期日:
進捗率:

0%

予定工数:
category_id:
26
version_id:
80
issue_org_id:
8121
author_id:
10982
assigned_to_id:
1
comments:
11
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

There should be a way to override direction of part of text. Maybe using <span dir="rtl"> and <p dir="rtl"> (needs permitting use of "dir" HTML attribute and/or "direction" CSS attribute) or even better some nicer shorter Textile-ful syntax.

Upstream Textile supports <span dir="rtl">. It also supports another trick using CSS, but just for a complete paragraph (not some part of it):

p{direction: rtl}.

This one doesn't work in Redmine too.

An example (paste it in some RTL context and view there):

ابراهیم C++ را دوست دارد.

In this example "C++" is shown as "++C" in an RTL context, while it should be shown like result of the following HTML snippet:

ابراهیم

C++
را دوست دارد.

(The "C++" example is a simple one to show the problem. I'm aware of workaround of writing it as "++C", but that's just a workaround. And even if someone prefers to go the workaround way, working around more complex examples can be very more difficult.)


journals

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

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

--------------------------------------------------------------------------------
Actually I should have used a @span@ tag instead of @div@:

<pre><code class="html">
<p dir="rtl">ابراهیم <span dir="ltr">C++</span> را دوست دارد.</p>
</code></pre>
--------------------------------------------------------------------------------
I'd be happy to see this one implemented. TIA!
--------------------------------------------------------------------------------
Temporary fix for persian users which converts the whole wiki paragraph to RTL (once detects persian/arabic content):

<pre><code class="html">
<script>
$(document).ready(function() {

$.each($(".wiki, .wiki-edit"), function(i,v){
var txt = $(v).text();
for(ci in txt) {
if (txt.charCodeAt(ci) > 0x600 && txt.charCodeAt(ci) < 0x700) {
$(v).css("direction", "rtl");
break;
}
}
});

$.each($(".issue .subject a"), function(i,v){
var txt = $(v).text();
console.log(txt);
for(ci in txt) {
if (txt.charCodeAt(ci) > 0x600 && txt.charCodeAt(ci) < 0x700) {
$(v).parent().css("direction", "rtl");
$(v).parent().css("text-align", "right");
break;
}
}
});

});
</script>
</code></pre>

Append the code above to the main layout file (app/views/layouts/base.html.erb) or any other javascript file which is included in all pages.
--------------------------------------------------------------------------------
Thanks for sharing, Ali!
--------------------------------------------------------------------------------
2 builtin css classes (rtl and ltr) are added in r13951.
You can use them with textile formatting by using parenthesis, here on a paragraph and a span:

<pre>
p(rtl). ابراهیم %(ltr)C++% را دوست دارد.
</pre>
--------------------------------------------------------------------------------
Jean-Philippe Lang wrote:
> 2 builtin css classes (rtl and ltr) are added in r13951.
> You can use them with textile formatting by using parenthesis, here on a paragraph and a span:
>
> [...]

This fix is broken.

My environment: Redmine 3.4.2, Google Chrome 63

Take this example:

Textile:
<pre>p(rtl). این یک test است</pre>
Generated html:
<pre><p class="wiki-class-rtl">این یک test است</p></pre>

First of all there is no such class as "wiki-class-rtl" in application.css.
Second, "unicode-bidi:bidi-override" makes the LTR parts of an RTL paragraph printed in reverse. e.g. 'tset' instead of 'test'. Simply having direction:rtl would make everything work just fine.

--------------------------------------------------------------------------------
Hooman Valibeigi wrote:
> Jean-Philippe Lang wrote:
> ...

FTR: #27884.
--------------------------------------------------------------------------------

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


related_issues

relates,Closed,27884,RTL wiki class broken in Redmine 3.2.6
duplicates,Closed,11784,{direction:rtl} doesn't work in text formatting

Admin Redmine さんが約4年前に更新

  • カテゴリText formatting_26 にセット
  • 対象バージョン3.0.0_80 にセット

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

いいね!0
いいね!0