commit b895180a0cc1c76fd09031e0ace23a590d5672e7
Author: Koji Yokota <[email protected]>
Date:   Mon Oct 19 11:00:39 2026 +0900

    Upgrade Ruby module (Annotation & Revision)
    
    Upgrade Ruby modele to use pxrubrica package. Kenten (emphasis dots) and
    ruby on both sides (above and below in the case of horizontal writing) are
    newly supported.
    
    Also, ruby is now highly customizable. Please refer to the documentation of
    pxrubrica package (https://ctan.org/pkg/pxrubrica).
    
    Note that English manual is a summary of Japanese version. Advanced options
    are only listed in the latter.
---
 lib/layouts/ruby.module | 106 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 81 insertions(+), 25 deletions(-)

diff --git a/lib/layouts/ruby.module b/lib/layouts/ruby.module
index 6240c5da2c..cb36f048c5 100644
--- a/lib/layouts/ruby.module
+++ b/lib/layouts/ruby.module
@@ -1,9 +1,8 @@
-#\DeclareLyXModule{Ruby (Furigana)}
+#\DeclareLyXModule{Ruby (Furigana) and Kenten}
 #\DeclareCategory{Annotation & Revision}
 #DescriptionBegin
-#Defines an inset to typeset reading aids (ruby, furigana) to Chinese
-#characters. Uses the 'okumakro', 'luatexja-ruby', or 'ruby' package
-#(depending on the TeX engine) or a fallback definition.
+#Defines insets to typeset reading aids (ruby, furigana) or emphasis dots
+#to Kanji (kenten). Uses the 'pxrubrica' package or a fallback definition.
 #DescriptionEnd
 #Requires
 #Excludes
@@ -12,43 +11,93 @@
 #         Günter Milde <[email protected]> (module)
 
 # References:
-# required packages
-#   okumacro.sty:       https://ctan.org/pkg/jsclasses
-#   luatexja-ruby.sty:  https://ctan.org/pkg/luatexja
-#   ruby.sty:           https://www.ctan.org/pkg/cjk
-# extended ruby support package (currently not used): 
+# required package
 #   https://ctan.org/pkg/pxrubrica
 # W3W spec: 
 #   https://www.w3.org/International/articles/ruby/markup.en.html
 
 Format 120
 
-InsetLayout Flex:Ruby
+AddToPreamble
+  \usepackage{pxrubrica}
+  \providecommand{\ruby}[2]{\shortstack{\tiny #2\\#1}}
+EndPreamble
+
+AddToHTMLPreamble
+<style type="text/css">
+/*<![CDATA[*/
+.flex_kenten {
+  -webkit-text-emphasis: filled dot; /* for Safari and old Chrome */
+  text-emphasis: filled dot;
+}
+/*]]>*/
+</style>
+EndPreamble
+
+InsetLayout Flex:Kenten
        LyxType         charstyle
        LatexType       command
-       LatexName       ruby
+       LatexName       kenten
+       HTMLTag         span
+       BgColor         none
+       LabelString     "Kenten"
+       MenuString      "Kenten|K"
+       Decoration      Conglomerate
+       Argument        1
+               LabelString     "Option|O"
+       EndArgument
+End
+
+InsetLayout Flex:Ruby
+       CopyStyle       Flex:Kenten
+       LatexName       jruby
+       LabelString     "Ruby"
+       MenuString      "Ruby|R"
        HTMLTag         ruby
        HTMLAttr        ""
        HTMLInnerTag    rb
        HTMLInnerAttr   ""
-       BgColor         none
-       LabelString     "Ruby"
-       Decoration      Conglomerate
+       # Fixme: Currently the ruby text is ignored in HTML
+
+       # Set default to auto-mono ruby mode
+       # (Group ruby if there is only one group, otherwise mono ruby)
        Preamble
-         \ifdefined\kanjiskip
-           \IfFileExists{okumacro.sty}{\usepackage{okumacro}}{}
-         \else \ifdefined\luatexversion
-           \usepackage{luatexja-ruby}
-         \else \ifdefined\XeTeXversion
-           \usepackage{ruby}%
-         \fi\fi\fi
-         \providecommand{\ruby}[2]{\shortstack{\tiny #2\\#1}}
+               \rubysetup{M}
        EndPreamble
-        # Fixme: Currently the ruby text is ignored in HTML
        Argument        post:1
                LabelString     "ruby text"
-               MenuString      "Ruby Text|R"
-               Tooltip         "Reading aid (ruby, furigana) for Chinese 
characters."
+               MenuString      "Ruby Text|x"
+               Tooltip         "Reading aid (ruby, furigana) for Kanji."
+               Decoration      Conglomerate
+               Font
+                 Size          tiny
+               EndFont
+               LabelFont
+                 Size          tiny
+               EndFont
+               Mandatory       1
+       EndArgument
+       Argument        1
+               LabelString     "Option|O"
+       EndArgument
+End
+
+InsetLayout Flex:aRuby
+       CopyStyle       Flex:Ruby
+       LatexName       aruby
+       LabelString     "Ruby (alph)"
+       MenuString      "Ruby on alphabets|a"
+End
+
+InsetLayout Flex:tRuby
+       CopyStyle       Flex:Ruby
+       LatexName       truby
+       LabelString     "Ruby (both)"
+       MenuString      "Ruby on both sides|b"
+       Argument        post:2
+               LabelString     "ruby subtext"
+               MenuString      "Ruby Subtext|S"
+               Tooltip         "Reading aid (ruby, furigana) for Kanji put 
below (or left in vertical writing)."
                Decoration      Conglomerate
                Font
                  Size          tiny
@@ -59,3 +108,10 @@ InsetLayout Flex:Ruby
                Mandatory       1
        EndArgument
 End
+
+InsetLayout Flex:atRuby
+       CopyStyle       Flex:tRuby
+       LatexName       atruby
+       LabelString     "Ruby (both, alph)"
+       MenuString      "Ruby on both sides of alphabets|o"
+End
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to