Easy <ruby> html tag support

Thank you for the great software!

I'm a Japanese christian. 
In Japanese <ruby> tag (furigana) is important feature to reading Kanji for kids and foreigners.

わたしは日本人にほんじんです

However it is difficult for any presentation software. 
I found OpenLP can use <ruby> and <rt> html tags by formatting tags. It is so great!

Now we can write like below. rb is defind as <ruby> and rt is <rt> html tags.
わたしは{rb}日本人{rt}にほんじん{/rt}{/ruby}です

But I would like to write more simple, like below.
わたしは日本人(にほんじん)です

Is it possible?

If not, I request to add as new feature.
It should be possible to use regular expression like below. It is C# code in my software I wrote.
str = Regex.Replace(str, @"^([\p{IsCJKUnifiedIdeographs}々]+\()", "|$1");
str = Regex.Replace(str, @"([^\p{IsCJKUnifiedIdeographs}々|])([\p{IsCJKUnifiedIdeographs}々]+\()", "$1|$2");
str = Regex.Replace(str, @"\r\n", "<br>");
str = Regex.Replace(str, @"\|", "<ruby>");
str = Regex.Replace(str, @"\(", "<rt>");
str = Regex.Replace(str, @"\)", "</rt></ruby>");

Comments

  • @iwasakin  I am glad you are able to use the formatting tabs to implement the HTML code.

    You can add the formatting tabs by typing them in when edit text in OpenLP (I would use a keyboard shortcut or macro to make it simpler if I had a lot to enter) or you can use the right click menu to add the formatting tabs.

    I will post your Feature Request in the issue list.  I am not sure we can implement your code idea as you stated it, but the Development Group will look at your request and see if it is possible.

    Thanks for using OpenLP and for your suggestion! 

    Your Feature Request is #327
  • Thanks a lot!

    I try to modify code by myself too. I will read wiki to investigate.
    Maybe the following code can convert the text in Python.
    text_mod = re.sub('([一-龥]+)\((.+)\)',r'<ruby>\1<rt>\2</rt></ruby>',text)

Sign In or Register to comment.