From 1cb33612e7669f894dd8ac277468b2e2b8ea7654 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=BCnter=20Milde?= Date: Wed, 15 May 2019 17:32:09 +0200 Subject: [PATCH] Format incremented to 574: Ruby inset, fixes for Japanese. New auxiliary functions for lyx2lyx: del_module(), append_local_layout(), del_local_layout() --- development/FORMAT | 5 +- lib/doc/ja/Additional.lyx | 47 +---- lib/doc/ja/Customization.lyx | 67 +----- lib/doc/ja/EmbeddedObjects.lyx | 135 +++++++++---- lib/doc/ja/Intro.lyx | 47 +---- lib/doc/ja/Math.lyx | 53 ++--- lib/doc/ja/Shortcuts.lyx | 47 +---- lib/doc/ja/Tutorial.lyx | 43 +--- lib/doc/ja/UserGuide.lyx | 63 +++--- .../Multilingual_Typesetting_with_CJKutf8.lyx | 6 +- lib/layouts/ruby.module | 15 ++ lib/lyx2lyx/LyX.py | 85 ++++++-- lib/lyx2lyx/lyx_2_3.py | 190 ++++-------------- lib/lyx2lyx/lyx_2_4.py | 100 +++++++-- src/tex2lyx/test/CJK.lyx.lyx | 2 +- src/tex2lyx/test/CJKutf8.lyx.lyx | 2 +- src/tex2lyx/test/DummyDocument.lyx.lyx | 2 +- src/tex2lyx/test/Dummy~Document.lyx.lyx | 2 +- src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx | 2 +- src/tex2lyx/test/algo2e.lyx.lyx | 2 +- src/tex2lyx/test/beamer.lyx.lyx | 2 +- .../test/box-color-size-space-align.lyx.lyx | 2 +- src/tex2lyx/test/listpreamble.lyx.lyx | 2 +- src/tex2lyx/test/tabular-x-test.lyx.lyx | 2 +- src/tex2lyx/test/test-insets-basic.lyx.lyx | 2 +- src/tex2lyx/test/test-insets.lyx.lyx | 2 +- src/tex2lyx/test/test-memoir.lyx.lyx | 2 +- src/tex2lyx/test/test-minted.lyx.lyx | 2 +- src/tex2lyx/test/test-modules.lyx.lyx | 2 +- .../test/test-refstyle-theorems.lyx.lyx | 2 +- src/tex2lyx/test/test-scr.lyx.lyx | 2 +- src/tex2lyx/test/test-structure.lyx.lyx | 2 +- src/tex2lyx/test/test.lyx.lyx | 2 +- src/tex2lyx/test/verbatim.lyx.lyx | 2 +- src/version.h | 4 +- 35 files changed, 419 insertions(+), 528 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 3b99985ca0..fd2b6c4f93 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -8,7 +8,10 @@ changes happened in particular if possible. A good example would be ----------------------- 2019-04-16 Günter Milde - * format incremented to 573: Rename legacy input encoding settings. + * Format incremented to 574: Ruby inset, fixes for Japanese. + +2019-04-16 Günter Milde + * Format incremented to 573: Rename legacy input encoding settings. 2019-04-07 Kornel Benko * format incremented to 572: Extended Noto fonts. diff --git a/lib/doc/ja/Additional.lyx b/lib/doc/ja/Additional.lyx index aaba5802a3..13cd17ec6e 100644 --- a/lib/doc/ja/Additional.lyx +++ b/lib/doc/ja/Additional.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 574 \begin_document \begin_header \save_transient_properties false @@ -48,6 +48,7 @@ theorems-ams theorems-ams-extended multicol shapepar +ruby \end_modules \maintain_unincluded_children false \begin_local_layout @@ -64,42 +65,11 @@ Preamble \newcommand*{\menuitem}[1]{{\sffamily #1}} EndPreamble End -InsetLayout Flex:Ruby -LyxType charstyle -LatexType command -LatexName ruby -BgColor none -LabelString "ルビ" -Decoration Conglomerate -Argument post:1 -LabelString "ルビ文" -MenuString "ルビ文(S)|S" -Decoration Conglomerate -Font -Size tiny -EndFont -LabelFont -Size tiny -EndFont -Mandatory 1 -EndArgument -Preamble -\ifdefined\kanjiskip - \IfFileExists{okumacro.sty}% - {\usepackage{okumacro}}% - {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}% -\else \ifdefined\luatexversion - \usepackage{luatexja-ruby} -\else \ifdefined\XeTeXversion - \usepackage{ruby}% -\fi\fi\fi -EndPreamble -End \end_local_layout \language japanese \language_package default -\inputencoding utf8-platex -\fontencoding global +\inputencoding utf8 +\fontencoding auto \font_roman "lmodern" "IPAexMincho" \font_sans "default" "IPAexGothic" \font_typewriter "default" "default" @@ -173,6 +143,7 @@ End \papercolumns 1 \papersides 2 \paperpagestyle headings +\tablestyle default \tracking_changes false \output_changes false \html_math_output 0 @@ -206,7 +177,6 @@ status collapsed status open \begin_layout Plain Layout -\noindent \family typewriter @@ -5424,7 +5394,6 @@ includegraphics{logo.eps}}} status collapsed \begin_layout Plain Layout -\noindent \family typewriter @@ -23621,7 +23590,6 @@ go back to the default status collapsed \begin_layout Plain Layout -\noindent shapepar \end_layout @@ -24123,7 +24091,6 @@ shapepar status collapsed \begin_layout Plain Layout -\noindent shapepar \end_layout @@ -24447,6 +24414,7 @@ status open \begin_inset CommandInset include LatexCommand input filename "../SpecialParagraphShape.tex" +literal "true" \end_inset @@ -24520,7 +24488,6 @@ status collapsed status collapsed \begin_layout Plain Layout -\noindent shapepar \end_layout diff --git a/lib/doc/ja/Customization.lyx b/lib/doc/ja/Customization.lyx index 175f7d9e84..8717759166 100644 --- a/lib/doc/ja/Customization.lyx +++ b/lib/doc/ja/Customization.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties false @@ -28,6 +28,7 @@ \use_default_options false \begin_modules logicalmkup +ruby \end_modules \maintain_unincluded_children false \begin_local_layout @@ -54,42 +55,10 @@ End #\renewcommand{\code}[1]{{\sffamily #1}} #EndPreamble #End -InsetLayout Flex:Ruby -LyxType charstyle -LatexType command -LatexName ruby -BgColor none -LabelString "ルビ" -Decoration Conglomerate -Argument post:1 -LabelString "ルビ文" -MenuString "ルビ文(S)|S" -Decoration Conglomerate -Font -Size tiny -EndFont -LabelFont -Size tiny -EndFont -Mandatory 1 -EndArgument -Preamble -\ifdefined\kanjiskip - \IfFileExists{okumacro.sty}% - {\usepackage{okumacro}}% - {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}% -\else \ifdefined\luatexversion - \usepackage{luatexja-ruby} -\else \ifdefined\XeTeXversion - \usepackage{ruby}% -\fi\fi\fi -EndPreamble -ResetsFont true -End \end_local_layout \language japanese \language_package default -\inputencoding utf8-platex +\inputencoding utf8 \fontencoding auto \font_roman "lmodern" "IPAexMincho" \font_sans "default" "IPAexGothic" @@ -108,8 +77,6 @@ End \output_sync 0 \bibtex_command default \index_command default -\float_placement class -\float_alignment class \paperfontsize 12 \spacing single \use_hyperref true @@ -5965,13 +5932,7 @@ type "lyxinfo" arg "version" \end_inset -では,最新書式は -\begin_inset Info -type "lyxinfo" -arg "layoutformat" -\end_inset - -です) +では,最新書式は69です) \end_layout \begin_layout Standard @@ -6294,13 +6255,7 @@ DeclareLyXModule{My Package} \end_layout \begin_layout LyX-Code -Format -\begin_inset Info -type "lyxinfo" -arg "layoutformat" -\end_inset - - +Format 69 \begin_inset Newline newline \end_inset @@ -7631,16 +7586,10 @@ status collapsed \end_inset 1.3.x以前のレイアウトファイルには,明示されたファイル形式がないため,書式1と解されます.\SpecialChar LyX -現行版のファイル形式は,書式 -\begin_inset Info -type "lyxinfo" -arg "layoutformat" -\end_inset - -です.しかし,\SpecialChar LyX +現行版のファイル形式は,書式69です.しかし,\SpecialChar LyX の各版は,旧版の\SpecialChar LyX -で作成されたファイルを読むことができるように,旧版のレイアウトファイルも読むことができます.しかしながら,以前の書式に変換する方法 -はありません. +で作成さ +れたファイルを読むことができるように,旧版のレイアウトファイルも読むことができます.しかしながら,以前の書式に変換する方法はありません. \end_layout \begin_layout Subsection diff --git a/lib/doc/ja/EmbeddedObjects.lyx b/lib/doc/ja/EmbeddedObjects.lyx index 8359ea5c79..90699a857a 100644 --- a/lib/doc/ja/EmbeddedObjects.lyx +++ b/lib/doc/ja/EmbeddedObjects.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 574 \begin_document \begin_header \save_transient_properties false @@ -174,45 +174,13 @@ initials graphicboxes varwidth +ruby \end_modules \maintain_unincluded_children false -\begin_local_layout -InsetLayout Flex:Ruby -LyxType charstyle -LatexType command -LatexName ruby -BgColor none -LabelString "ルビ" -Decoration Conglomerate -Argument post:1 -LabelString "ルビ文" -MenuString "ルビ文(S)|S" -Decoration Conglomerate -Font -Size tiny -EndFont -LabelFont -Size tiny -EndFont -Mandatory 1 -EndArgument -Preamble -\ifdefined\kanjiskip - \IfFileExists{okumacro.sty}% - {\usepackage{okumacro}}% - {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}% -\else \ifdefined\luatexversion - \usepackage{luatexja-ruby} -\else \ifdefined\XeTeXversion - \usepackage{ruby}% -\fi\fi\fi -EndPreamble -End -\end_local_layout \language japanese \language_package default -\inputencoding utf8-platex -\fontencoding global +\inputencoding utf8 +\fontencoding auto \font_roman "lmodern" "IPAexMincho" \font_sans "default" "IPAexGothic" \font_typewriter "default" "default" @@ -289,6 +257,7 @@ End \papercolumns 1 \papersides 2 \paperpagestyle default +\tablestyle default \bullet 1 1 34 -1 \bullet 2 2 35 -1 \bullet 3 2 7 -1 @@ -775,6 +744,8 @@ reference "sec:キャプションの配置" \begin_layout Standard \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -818,6 +789,8 @@ name "fig:星形" \begin_layout Standard \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -957,6 +930,8 @@ reference "fig:A-star" \begin_layout Standard \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -967,6 +942,8 @@ status open \begin_inset Float figure +placement document +alignment document wide false sideways false status collapsed @@ -1009,6 +986,8 @@ name "fig:Pink-object" \begin_inset Float figure +placement document +alignment document wide false sideways false status collapsed @@ -2503,6 +2482,7 @@ reference "sec:フロートはじめに" \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -10687,6 +10667,7 @@ status collapsed \noindent \begin_inset Float table placement H +alignment document wide false sideways false status open @@ -10912,6 +10893,7 @@ p\SpecialChar LaTeX \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -11377,6 +11359,7 @@ status collapsed \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -11564,6 +11547,8 @@ reference "tab:半分でない表" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -14214,6 +14199,7 @@ reference "tab:ブックタブ表の例" \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -14944,6 +14930,7 @@ status collapsed \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -16239,6 +16226,7 @@ status collapsed \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -16803,6 +16791,7 @@ cellcolor{Maroon} \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -17264,6 +17253,7 @@ rowcolors{1}{white}{lightgray} \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -17443,6 +17433,7 @@ hline]{1}{lightgray}{cyan} \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -17793,6 +17784,7 @@ Wc \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -18024,6 +18016,7 @@ arrayrulecolor{black}} \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -18184,6 +18177,7 @@ reference "tab:色付き罫線の表" \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -18394,6 +18388,8 @@ reference "tab:着色水平罫線表" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -19008,6 +19004,8 @@ multicolumn{1}{|c|}{ \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -19776,6 +19774,8 @@ reference "tab:回転表" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -19999,6 +19999,8 @@ is an example for a rotated multiline cell where a variable width minipage \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -20787,6 +20789,7 @@ reference "tab:垂直揃え" \noindent \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -20815,6 +20818,8 @@ name "tab:垂直揃え" \begin_inset Float table +placement document +alignment document wide false sideways false status collapsed @@ -20929,6 +20934,8 @@ status collapsed \begin_inset Float table +placement document +alignment document wide false sideways false status collapsed @@ -21160,6 +21167,7 @@ arg "tabular-feature align-decimal" \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -21247,6 +21255,7 @@ name "tab:表セル" \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -21433,6 +21442,8 @@ reference "tab:演算子揃え表" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -22047,6 +22058,7 @@ S{2.5cm}{2} \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -22289,6 +22301,8 @@ arrayrulewidth}{1.5pt} \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -22567,6 +22581,8 @@ arrayrulewidth 0.4pt}} \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -22779,6 +22795,8 @@ Vc \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -22960,6 +22978,7 @@ arydshln \begin_layout Standard \begin_inset Float table placement H +alignment document wide false sideways false status open @@ -23559,6 +23578,7 @@ status collapsed \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -24545,6 +24565,7 @@ status collapsed \begin_layout Standard \begin_inset Float algorithm placement h +alignment document wide false sideways false status open @@ -26220,6 +26241,8 @@ status open \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways true status open @@ -26367,6 +26390,8 @@ reference "tab:従属表を横に並べたもの" の従属フロートです. \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -26395,6 +26420,8 @@ name "tab:従属表を横に並べたもの" \begin_inset Float table +placement document +alignment document wide false sideways false status collapsed @@ -26489,6 +26516,8 @@ name "tab:これは従属表a" \begin_inset Float table +placement document +alignment document wide false sideways false status collapsed @@ -26588,6 +26617,8 @@ name "tab:これは従属表b" \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -26614,6 +26645,8 @@ name "tab:従属表を縦に並べたもの" \noindent \align center \begin_inset Float table +placement document +alignment document wide false sideways false status collapsed @@ -26693,6 +26726,8 @@ status collapsed \noindent \align center \begin_inset Float table +placement document +alignment document wide false sideways false status collapsed @@ -26854,6 +26889,8 @@ reference "sec:ミニページ" \begin_layout Standard \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -27355,6 +27392,7 @@ status open \begin_layout Standard \begin_inset Float figure placement !p +alignment document wide false sideways false status open @@ -27413,6 +27451,7 @@ on} \begin_layout Standard \begin_inset Float table placement !p +alignment document wide false sideways false status open @@ -27686,6 +27725,8 @@ reference "tab:標準表" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -27829,6 +27870,8 @@ c & d \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -28680,6 +28723,8 @@ FigBesBeg \begin_layout Standard \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -28752,6 +28797,8 @@ TabBesBeg \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -29027,6 +29074,8 @@ sidecaptionvpos{figure}{c} \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -29099,6 +29148,8 @@ TabBesBeg[5] \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -30536,6 +30587,7 @@ status collapsed を読み込みます. \begin_inset Float figure placement !h +alignment document wide false sideways false status open @@ -30603,6 +30655,7 @@ name "fig:標準的脚注配置" \begin_layout Standard \begin_inset Float figure placement !h +alignment document wide false sideways false status open @@ -30721,6 +30774,8 @@ theendnotes \begin_layout Standard \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -37741,6 +37796,7 @@ status collapsed \begin_inset CommandInset include LatexCommand include filename "DummyDocument1.lyx" +literal "true" \end_inset @@ -37829,6 +37885,7 @@ includeonly \begin_inset CommandInset include LatexCommand input filename "DummyDocument2.lyx" +literal "true" \end_inset @@ -37869,6 +37926,7 @@ textvisiblespace \begin_inset CommandInset include LatexCommand verbatiminput filename "DummyTextDocument.txt" +literal "true" \end_inset @@ -37884,6 +37942,7 @@ filename "DummyTextDocument.txt" \begin_inset CommandInset include LatexCommand verbatiminput* filename "DummyTextDocument.txt" +literal "true" \end_inset @@ -38768,6 +38827,7 @@ reference "lst:file-listing" LatexCommand lstinputlisting filename "EmbeddedObjects.lyx" lstparams "breaklines=true,caption={Lines 10 - 15 of this LyX file},extendedchars=true,firstline=10,label={lst:file-listing},language={[LaTeX]TeX},lastline=15" +literal "true" \end_inset @@ -38970,6 +39030,7 @@ reference "tab:単位" \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open diff --git a/lib/doc/ja/Intro.lyx b/lib/doc/ja/Intro.lyx index 8ff8db9135..f9b8bd82a3 100644 --- a/lib/doc/ja/Intro.lyx +++ b/lib/doc/ja/Intro.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 574 \begin_document \begin_header \save_transient_properties true @@ -26,44 +26,14 @@ \pagenumbering{arabic} } \end_preamble \use_default_options false +\begin_modules +ruby +\end_modules \maintain_unincluded_children false -\begin_local_layout -InsetLayout Flex:Ruby -LyxType charstyle -LatexType command -LatexName ruby -BgColor none -LabelString "ルビ" -Decoration Conglomerate -Argument post:1 -LabelString "ルビ文" -MenuString "ルビ文(S)|S" -Decoration Conglomerate -Font -Size tiny -EndFont -LabelFont -Size tiny -EndFont -Mandatory 1 -EndArgument -Preamble -\ifdefined\kanjiskip - \IfFileExists{okumacro.sty}% - {\usepackage{okumacro}}% - {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}% -\else \ifdefined\luatexversion - \usepackage{luatexja-ruby} -\else \ifdefined\XeTeXversion - \usepackage{ruby}% -\fi\fi\fi -EndPreamble -End -\end_local_layout \language japanese \language_package auto -\inputencoding utf8-platex -\fontencoding global +\inputencoding utf8 +\fontencoding auto \font_roman "lmodern" "IPAexMincho" \font_sans "default" "IPAexGothic" \font_typewriter "default" "default" @@ -135,6 +105,7 @@ End \papercolumns 1 \papersides 2 \paperpagestyle default +\tablestyle default \tracking_changes false \output_changes false \html_math_output 0 @@ -2991,6 +2962,8 @@ reference "tab:画像用単位" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open diff --git a/lib/doc/ja/Math.lyx b/lib/doc/ja/Math.lyx index 217674b52b..5ae171fd75 100644 --- a/lib/doc/ja/Math.lyx +++ b/lib/doc/ja/Math.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 574 \begin_document \begin_header \save_transient_properties false @@ -145,45 +145,13 @@ \use_default_options true \begin_modules subequations +ruby \end_modules \maintain_unincluded_children false -\begin_local_layout -InsetLayout Flex:Ruby -LyxType charstyle -LatexType command -LatexName ruby -BgColor none -LabelString "ルビ" -Decoration Conglomerate -Argument post:1 -LabelString "ルビ文" -MenuString "ルビ文(S)|S" -Decoration Conglomerate -Font -Size tiny -EndFont -LabelFont -Size tiny -EndFont -Mandatory 1 -EndArgument -Preamble -\ifdefined\kanjiskip - \IfFileExists{okumacro.sty}% - {\usepackage{okumacro}}% - {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}% -\else \ifdefined\luatexversion - \usepackage{luatexja-ruby} -\else \ifdefined\XeTeXversion - \usepackage{ruby}% -\fi\fi\fi -EndPreamble -End -\end_local_layout \language japanese \language_package default -\inputencoding utf8-platex -\fontencoding global +\inputencoding utf8 +\fontencoding auto \font_roman "lmodern" "IPAexMincho" \font_sans "default" "IPAexGothic" \font_typewriter "default" "default" @@ -201,6 +169,8 @@ End \output_sync 0 \bibtex_command default \index_command default +\float_placement class +\float_alignment class \paperfontsize default \spacing single \use_hyperref true @@ -260,6 +230,7 @@ End \papercolumns 1 \papersides 2 \paperpagestyle plain +\tablestyle default \tracking_changes false \output_changes false \html_math_output 0 @@ -971,6 +942,7 @@ status collapsed \align center \begin_inset Float table placement H +alignment document wide false sideways false status open @@ -35219,8 +35191,8 @@ begin{multicols}{2} \lang ngerman Das Spektrum wird fouriertransformiert. - Die Fouriertransformation wird verwendet, um die - überlagerten Signale (Netzwerk, Lösungsmittel) zu trennen. + Die Fouriertransformation wird verwendet, um die überlagerten Signale + (Netzwerk, Lösungsmittel) zu trennen. Nachdem wir die Phasenverschiebung bestimmen konnten, interessiert uns nun das Aussehen des Ausgangssignals. Im Experiment haben wir es mit sehr vielen Teilchen zu tun, so das man @@ -35295,7 +35267,8 @@ wobei -rf-Puls beginnt sich die Magnetisierung zu entfokussieren, wodurch sich das Signal zusätzlich abschwächt. - Diese Abschwächung verläuft exponentiell in Abhängigkeit der so genannten + Diese Abschwächung verläuft exponentiell in Abhängigkeit der so genannten + \begin_inset Formula $T_{2}$ \end_inset diff --git a/lib/doc/ja/Shortcuts.lyx b/lib/doc/ja/Shortcuts.lyx index 800fd2a2c5..2e55500913 100644 --- a/lib/doc/ja/Shortcuts.lyx +++ b/lib/doc/ja/Shortcuts.lyx @@ -1,49 +1,19 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 574 \begin_document \begin_header \save_transient_properties true \origin /systemlyxdir/doc/ja/ \textclass bxjsarticle \use_default_options true +\begin_modules +ruby +\end_modules \maintain_unincluded_children false -\begin_local_layout -InsetLayout Flex:Ruby -LyxType charstyle -LatexType command -LatexName ruby -BgColor none -LabelString "ルビ" -Decoration Conglomerate -Argument post:1 -LabelString "ルビ文" -MenuString "ルビ文(S)|S" -Decoration Conglomerate -Font -Size tiny -EndFont -LabelFont -Size tiny -EndFont -Mandatory 1 -EndArgument -Preamble -\ifdefined\kanjiskip - \IfFileExists{okumacro.sty}% - {\usepackage{okumacro}}% - {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}% -\else \ifdefined\luatexversion - \usepackage{luatexja-ruby} -\else \ifdefined\XeTeXversion - \usepackage{ruby}% -\fi\fi\fi -EndPreamble -End -\end_local_layout \language japanese \language_package auto -\inputencoding utf8-platex -\fontencoding global +\inputencoding utf8 +\fontencoding auto \font_roman "lmodern" "IPAexMincho" \font_sans "default" "IPAexGothic" \font_typewriter "default" "default" @@ -61,6 +31,8 @@ End \output_sync 0 \bibtex_command default \index_command default +\float_placement class +\float_alignment class \paperfontsize default \spacing single \use_hyperref false @@ -101,6 +73,7 @@ End \papercolumns 1 \papersides 1 \paperpagestyle empty +\tablestyle default \tracking_changes false \output_changes false \html_math_output 0 diff --git a/lib/doc/ja/Tutorial.lyx b/lib/doc/ja/Tutorial.lyx index 146aee9de5..5ae7415dc8 100644 --- a/lib/doc/ja/Tutorial.lyx +++ b/lib/doc/ja/Tutorial.lyx @@ -1,49 +1,19 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 544 +\lyxformat 574 \begin_document \begin_header \save_transient_properties false \origin /systemlyxdir/doc/ja/ \textclass bxjsbook \use_default_options true +\begin_modules +ruby +\end_modules \maintain_unincluded_children false -\begin_local_layout -InsetLayout Flex:Ruby -LyxType charstyle -LatexType command -LatexName ruby -BgColor none -LabelString "ルビ" -Decoration Conglomerate -Argument post:1 -LabelString "ルビ文" -MenuString "ルビ文(S)|S" -Decoration Conglomerate -Font -Size tiny -EndFont -LabelFont -Size tiny -EndFont -Mandatory 1 -EndArgument -Preamble -\ifdefined\kanjiskip - \IfFileExists{okumacro.sty}% - {\usepackage{okumacro}}% - {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}% -\else \ifdefined\luatexversion - \usepackage{luatexja-ruby} -\else \ifdefined\XeTeXversion - \usepackage{ruby}% -\fi\fi\fi -EndPreamble -End -\end_local_layout \language japanese \language_package auto -\inputencoding utf8-platex -\fontencoding global +\inputencoding utf8 +\fontencoding auto \font_roman "lmodern" "IPAexMincho" \font_sans "default" "IPAexGothic" \font_typewriter "default" "IPAGothic" @@ -115,6 +85,7 @@ End \papercolumns 1 \papersides 2 \paperpagestyle default +\tablestyle default \tracking_changes false \output_changes false \html_math_output 0 diff --git a/lib/doc/ja/UserGuide.lyx b/lib/doc/ja/UserGuide.lyx index bbb35df091..5fd34cf19d 100644 --- a/lib/doc/ja/UserGuide.lyx +++ b/lib/doc/ja/UserGuide.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 574 \begin_document \begin_header \save_transient_properties false @@ -53,46 +53,13 @@ \begin_modules customHeadersFooters enumitem +ruby \end_modules \maintain_unincluded_children false -\begin_local_layout -InsetLayout Flex:Ruby -LyxType charstyle -LatexType command -LatexName ruby -BgColor none -LabelString "ルビ" -Decoration Conglomerate -Argument post:1 -LabelString "ルビ文" -MenuString "ルビ文(S)|S" -Decoration Conglomerate -Font -Size tiny -EndFont -LabelFont -Size tiny -EndFont -Mandatory 1 -EndArgument -Preamble -\IfFileExists{okumacro.sty} -\ifdefined\kanjiskip - \IfFileExists{okumacro.sty}% - {\usepackage{okumacro}}% - {\newcommand{\ruby}[2]{\shortstack{\tiny ##2\\##1}}}% -\else \ifdefined\luatexversion - \usepackage{luatexja-ruby} -\else \ifdefined\XeTeXversion - \usepackage{ruby}% -\fi\fi\fi -EndPreamble -End -\end_local_layout \language japanese \language_package auto -\inputencoding utf8-platex -\fontencoding global +\inputencoding utf8 +\fontencoding auto \font_roman "lmodern" "IPAexMincho" \font_sans "default" "IPAexGothic" \font_typewriter "default" "default" @@ -175,6 +142,7 @@ End \papercolumns 1 \papersides 2 \paperpagestyle default +\tablestyle default \tracking_changes false \output_changes false \html_math_output 0 @@ -1615,6 +1583,7 @@ reference "tab:水平スクロールのテスト" \begin_layout Standard \begin_inset Float table placement h +alignment document wide false sideways false status open @@ -6650,6 +6619,8 @@ Return \begin_layout Standard \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -9756,6 +9727,8 @@ reference "tab:空白の幅" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -19973,6 +19946,7 @@ arg "layout-paragraph" \begin_layout Standard \begin_inset Float figure placement htbp +alignment document wide false sideways false status open @@ -20083,6 +20057,8 @@ reference "fig:カモノハシ" \begin_layout Standard \begin_inset Float figure +placement document +alignment document wide false sideways false status open @@ -20093,6 +20069,8 @@ status open \begin_inset Float figure +placement document +alignment document wide false sideways false status collapsed @@ -20134,6 +20112,8 @@ name "fig:何かわからない" \begin_inset Float figure +placement document +alignment document wide false sideways false status collapsed @@ -20244,6 +20224,7 @@ reference "tab:表フロート" \begin_layout Standard \begin_inset Float table placement htbp +alignment document wide false sideways false status open @@ -21613,6 +21594,8 @@ reference "tab:アクセント名とそれに対応するコマンド" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -22692,6 +22675,8 @@ reference "tab:書体とそれに対応するコマンド" \begin_layout Standard \begin_inset Float table +placement document +alignment document wide false sideways false status open @@ -28660,6 +28645,7 @@ reference "fig:ページレイアウト" \begin_layout Standard \begin_inset Float figure placement h +alignment document wide false sideways false status open @@ -40706,6 +40692,7 @@ reference "tab:単位" \begin_layout Standard \begin_inset Float table placement t +alignment document wide false sideways false status open diff --git a/lib/examples/ja/Multilingual_Typesetting_with_CJKutf8.lyx b/lib/examples/ja/Multilingual_Typesetting_with_CJKutf8.lyx index 1b3fe93d18..05a25ae455 100644 --- a/lib/examples/ja/Multilingual_Typesetting_with_CJKutf8.lyx +++ b/lib/examples/ja/Multilingual_Typesetting_with_CJKutf8.lyx @@ -1,5 +1,5 @@ #LyX 2.4 created this file. For more info see https://www.lyx.org/ -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true @@ -351,7 +351,7 @@ Ruby (ルビ, furigana) with the help of the Ruby module: \lang japanese-cjk \begin_inset Flex Ruby -status open +status collapsed \begin_layout Plain Layout 東 京 @@ -396,7 +396,7 @@ Edit\SpecialChar menuseparator Custom Text Styles\SpecialChar menuseparator Ruby \family default - for the base characters. + for the base character(s). \end_layout \begin_layout Itemize diff --git a/lib/layouts/ruby.module b/lib/layouts/ruby.module index 1ad14e2e3d..95532bde8f 100644 --- a/lib/layouts/ruby.module +++ b/lib/layouts/ruby.module @@ -11,12 +11,26 @@ #Authors: Koji Yokota (original implementation as local layout), # Günter Milde (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): +# https://ctan.org/pkg/pxrubrica +# W3W spec: +# https://www.w3.org/International/articles/ruby/markup.en.html + Format 74 InsetLayout Flex:Ruby LyxType charstyle LatexType command LatexName ruby + HTMLTag ruby + HTMLAttr "" + HTMLInnerTag rb + HTMLInnerAttr "" BgColor none LabelString "Ruby" Decoration Conglomerate @@ -30,6 +44,7 @@ InsetLayout Flex:Ruby \fi\fi\fi \providecommand{\ruby}[2]{\shortstack{\tiny #2\\#1}} EndPreamble + # Fixme: Currently the ruby text is ignored in HTML Argument post:1 LabelString "ruby text" MenuString "Ruby Text|R" diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 5ea84b7963..245cc6e5b8 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -20,8 +20,8 @@ " The LyX module has all the rules related with different lyx file formats." -from parser_tools import get_value, check_token, find_token, \ - find_tokens, find_end_of +from parser_tools import (get_value, check_token, find_token, find_tokens, + find_end_of, find_complete_lines) import os.path import gzip import locale @@ -595,6 +595,7 @@ class LyX_base: #Note that the module will be added at the END of the extant ones def add_module(self, module): + " Append module to the modules list." i = find_token(self.header, "\\begin_modules", 0) if i == -1: #No modules yet included @@ -615,7 +616,16 @@ class LyX_base: self.header.insert(j, module) + def del_module(self, module): + " Delete `module` from module list, return success." + modlist = self.get_module_list() + if module not in modlist: + return False + self.set_module_list([line for line in modlist if line != "ruby"]) + return True + def get_module_list(self): + " Return list of modules." i = find_token(self.header, "\\begin_modules", 0) if (i == -1): return [] @@ -624,23 +634,23 @@ class LyX_base: def set_module_list(self, mlist): - modbegin = find_token(self.header, "\\begin_modules", 0) - newmodlist = ['\\begin_modules'] + mlist + ['\\end_modules'] - if (modbegin == -1): + i = find_token(self.header, "\\begin_modules", 0) + if (i == -1): #No modules yet included tclass = find_token(self.header, "\\textclass", 0) if tclass == -1: self.warning("Malformed LyX document: No \\textclass!!") return - modbegin = tclass + 1 - self.header[modbegin:modbegin] = newmodlist - return - modend = find_token(self.header, "\\end_modules", modbegin) - if modend == -1: - self.warning("(set_module_list)Malformed LyX document: No \\end_modules.") - return - newmodlist = ['\\begin_modules'] + mlist + ['\\end_modules'] - self.header[modbegin:modend + 1] = newmodlist + i = j = tclass + 1 + else: + j = find_token(self.header, "\\end_modules", i) + if j == -1: + self.warning("(set_module_list) Malformed LyX document: No \\end_modules.") + return + j += 1 + if mlist: + mlist = ['\\begin_modules'] + mlist + ['\\end_modules'] + self.header[i:j] = mlist def set_parameter(self, param, value): @@ -773,6 +783,53 @@ class LyX_base: return mode, steps + def append_local_layout(self, new_layout): + " Append `new_layout` to the local layouts." + # new_layout may be a string or a list of strings (lines) + try: + new_layout = new_layout.splitlines() + except AttributeError: + pass + i = find_token(self.header, "\\begin_local_layout", 0) + if i == -1: + k = find_token(self.header, "\\language", 0) + if k == -1: + # this should not happen + self.warning("Malformed LyX document! No \\language header found!") + return + self.header[k-1 : k-1] = ["\\begin_local_layout", "\\end_local_layout"] + i = k - 1 + + j = find_end_of(self.header, i, "\\begin_local_layout", "\\end_local_layout") + if j == -1: + # this should not happen + self.warning("Malformed LyX document: Can't find end of local layout!") + return + + self.header[i+1 : i+1] = new_layout + + def del_local_layout(self, old_layout): + " Delete `old_layout` from local layouts, return success." + i = find_complete_lines(self.header, old_layout) + if i == -1: + return False + j = i+len(old_layout) + if (self.header[i-1] == "\\begin_local_layout" and + self.header[j] == "\\end_local_layout"): + i -=1 + j +=1 + self.header[i:j] = [] + return True + + def del_from_header(self, lines): + " Delete `lines` from the document header, return success." + i = find_complete_lines(self.header, lines) + if i == -1: + return False + j = i + len(lines) + self.header[i:j] = [] + return True + # Part of an unfinished attempt to make lyx2lyx gave a more # structured view of the document. # def get_toc(self, depth = 4): diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py index 8b834c1abc..48e0dab82e 100644 --- a/lib/lyx2lyx/lyx_2_3.py +++ b/lib/lyx2lyx/lyx_2_3.py @@ -26,7 +26,7 @@ import sys, os from parser_tools import (del_token, del_value, del_complete_lines, find_complete_lines, find_end_of, find_end_of_layout, find_end_of_inset, - find_re, find_substring, find_token, find_token_backwards, + find_re, find_substring, find_token, find_token_backwards, find_across_lines, get_containing_inset, get_containing_layout, get_bool_value, get_value, get_quoted_value, is_in_inset, set_bool_value) # find_tokens, find_token_exact, check_token, get_option_value @@ -157,6 +157,31 @@ def revert_ibranches(document): document.header[i:i] = lines +beamer_article_styles = [ + "### Inserted by lyx2lyx (more [scr]article styles) ###", + "Input article.layout", + "Input beamer.layout", + "Provides geometry 0", + "Provides hyperref 0", + "DefaultFont", + " Family Roman", + " Series Medium", + " Shape Up", + " Size Normal", + " Color None", + "EndFont", + "Preamble", + " \\usepackage{beamerarticle,pgf}", + " % this default might be overridden by plain title style", + " \\newcommand\makebeamertitle{\\frame{\\maketitle}}%", + " \\AtBeginDocument{", + " \\let\\origtableofcontents=\\tableofcontents", + " \\def\\tableofcontents{\\@ifnextchar[{\\origtableofcontents}{\\gobbletableofcontents}}", + " \\def\\gobbletableofcontents#1{\\origtableofcontents}", + " }", + "EndPreamble", + "### End of insertion by lyx2lyx (more [scr]article styles) ###"] + def revert_beamer_article_styles(document): " Include (scr)article styles in beamer article " @@ -164,52 +189,9 @@ def revert_beamer_article_styles(document): if document.textclass not in beamer_articles: return - inclusion = "article.layout" if document.textclass == "scrarticle-beamer": - inclusion = "scrartcl.layout" - - i = find_token(document.header, "\\begin_local_layout", 0) - if i == -1: - k = find_token(document.header, "\\language", 0) - if k == -1: - # this should not happen - document.warning("Malformed LyX document! No \\language header found!") - return - document.header[k-1 : k-1] = ["\\begin_local_layout", "\\end_local_layout"] - i = k - 1 - - j = find_end_of(document.header, i, "\\begin_local_layout", "\\end_local_layout") - if j == -1: - # this should not happen - document.warning("Malformed LyX document: Can't find end of local layout!") - return - - document.header[i+1 : i+1] = [ - "### Inserted by lyx2lyx (more [scr]article styles) ###", - "Input " + inclusion, - "Input beamer.layout", - "Provides geometry 0", - "Provides hyperref 0", - "DefaultFont", - " Family Roman", - " Series Medium", - " Shape Up", - " Size Normal", - " Color None", - "EndFont", - "Preamble", - " \\usepackage{beamerarticle,pgf}", - " % this default might be overridden by plain title style", - " \\newcommand\makebeamertitle{\\frame{\\maketitle}}%", - " \\AtBeginDocument{", - " \\let\\origtableofcontents=\\tableofcontents", - " \\def\\tableofcontents{\\@ifnextchar[{\\origtableofcontents}{\\gobbletableofcontents}}", - " \\def\\gobbletableofcontents#1{\\origtableofcontents}", - " }", - "EndPreamble", - "### End of insertion by lyx2lyx (more [scr]article styles) ###" - ] - + beamer_article_styles[1] = "Input scrartcl.layout" + document.append_local_layout(beamer_article_styles) def convert_beamer_article_styles(document): " Remove included (scr)article styles in beamer article " @@ -218,29 +200,9 @@ def convert_beamer_article_styles(document): if document.textclass not in beamer_articles: return - i = find_token(document.header, "\\begin_local_layout", 0) - if i == -1: - return - - j = find_end_of(document.header, i, "\\begin_local_layout", "\\end_local_layout") - if j == -1: - # this should not happen - document.warning("Malformed LyX document: Can't find end of local layout!") - return - - k = find_token(document.header, "### Inserted by lyx2lyx (more [scr]article styles) ###", i, j) - if k != -1: - l = find_token(document.header, "### End of insertion by lyx2lyx (more [scr]article styles) ###", i, j) - if l == -1: - # this should not happen - document.warning("End of lyx2lyx local layout insertion not found!") - return - - if k == i + 1 and l == j - 1: - # that was all the local layout there was - document.header[i : j + 1] = [] - else: - document.header[k : l + 1] = [] + if document.textclass == "scrarticle-beamer": + beamer_article_styles[1] = "Input scrartcl.layout" + document.del_local_layout(beamer_article_styles) def revert_new_babel_languages(document): @@ -396,61 +358,22 @@ def revert_quotes(document): i = l +iopart_local_layout = ["### Inserted by lyx2lyx (stdlayouts) ###", + "Input stdlayouts.inc", + "### End of insertion by lyx2lyx (stdlayouts) ###"""] + def revert_iopart(document): " Input new styles via local layout " if document.textclass != "iopart": return - - i = find_token(document.header, "\\begin_local_layout", 0) - if i == -1: - k = find_token(document.header, "\\language", 0) - if k == -1: - # this should not happen - document.warning("Malformed LyX document! No \\language header found!") - return - document.header[k-1 : k-1] = ["\\begin_local_layout", "\\end_local_layout"] - i = k-1 - - j = find_end_of(document.header, i, "\\begin_local_layout", "\\end_local_layout") - if j == -1: - # this should not happen - document.warning("Malformed LyX document! Can't find end of local layout!") - return - - document.header[i+1 : i+1] = [ - "### Inserted by lyx2lyx (stdlayouts) ###", - "Input stdlayouts.inc", - "### End of insertion by lyx2lyx (stdlayouts) ###" - ] + document.append_local_layout(iopart_local_layout) def convert_iopart(document): " Remove local layout we added, if it is there " if document.textclass != "iopart": return - - i = find_token(document.header, "\\begin_local_layout", 0) - if i == -1: - return - - j = find_end_of(document.header, i, "\\begin_local_layout", "\\end_local_layout") - if j == -1: - # this should not happen - document.warning("Malformed LyX document! Can't find end of local layout!") - return - - k = find_token(document.header, "### Inserted by lyx2lyx (stdlayouts) ###", i, j) - if k != -1: - l = find_token(document.header, "### End of insertion by lyx2lyx (stdlayouts) ###", i, j) - if l == -1: - # this should not happen - document.warning("End of lyx2lyx local layout insertion not found!") - return - if k == i + 1 and l == j - 1: - # that was all the local layout there was - document.header[i : j + 1] = [] - else: - document.header[k : l + 1] = [] + document.del_local_layout(iopart_local_layout) def convert_quotestyle(document): @@ -1192,27 +1115,12 @@ def revert_biblatex(document): # Emulate the old biblatex-workaround (pretend natbib in order to use the styles) if biblatex: - i = find_token(document.header, "\\begin_local_layout", 0) - if i == -1: - k = find_token(document.header, "\\language", 0) - if k == -1: - # this should not happen - document.warning("Malformed LyX document! No \\language header found!") - return - document.header[k-1 : k-1] = ["\\begin_local_layout", "\\end_local_layout"] - i = k-1 - - j = find_end_of(document.header, i, "\\begin_local_layout", "\\end_local_layout") - if j == -1: - # this should not happen - document.warning("Malformed LyX document! Can't find end of local layout!") - return - - document.header[i+1 : i+1] = [ + biblatex_emulation = [ "### Inserted by lyx2lyx (biblatex emulation) ###", "Provides natbib 1", "### End of insertion by lyx2lyx (biblatex emulation) ###" ] + document.append_local_layout(biblatex_emulation) def revert_citekeyonly(document): @@ -1273,28 +1181,12 @@ def revert_bibpackopts(document): # Nothing to do for empty options return - i = find_token(document.header, "\\begin_local_layout", 0) - if i == -1: - k = find_token(document.header, "\\language", 0) - if k == -1: - # this should not happen - document.warning("Malformed LyX document! No \\language header found!") - return - document.header[k-1 : k-1] = ["\\begin_local_layout", "\\end_local_layout"] - i = k - 1 - - j = find_end_of(document.header, i, "\\begin_local_layout", "\\end_local_layout") - if j == -1: - # this should not happen - document.warning("Malformed LyX document! Can't find end of local layout!") - return - - document.header[i+1 : i+1] = [ + bibliography_package_options = [ "### Inserted by lyx2lyx (bibliography package options) ###", "PackageOptions " + engine + " " + biblio_options, "### End of insertion by lyx2lyx (bibliography package options) ###" ] - + document.append_local_layout(bibliography_package_options) def revert_qualicites(document): " Revert qualified citation list commands to ERT " diff --git a/lib/lyx2lyx/lyx_2_4.py b/lib/lyx2lyx/lyx_2_4.py index fa61754f80..56490855d9 100644 --- a/lib/lyx2lyx/lyx_2_4.py +++ b/lib/lyx2lyx/lyx_2_4.py @@ -1083,13 +1083,10 @@ def revert_dateinfo(document): } types = ["date", "fixdate", "moddate" ] - i = 0 - i = find_token(document.header, "\\language", 0) - if i == -1: - # this should not happen + lang = get_value(document.header, "\\language") + if lang == "": document.warning("Malformed LyX document! No \\language header found!") return - lang = get_value(document.header, "\\language", i) i = 0 while True: @@ -1146,7 +1143,7 @@ def revert_dateinfo(document): # In Python 2, datetime module works with binary strings, # our dateformat strings are utf8-encoded: result = result.decode('utf-8') - document.body[i : j+1] = result + document.body[i : j+1] = [result] i = i + 1 @@ -1435,20 +1432,19 @@ def revert_lformatinfo(document): def convert_hebrew_parentheses(document): - """ Swap opening/closing parentheses in Hebrew text. - - Up to LyX 2.4, ")" was used as opening parenthesis and - "(" as closing parenthesis for Hebrew in the LyX source. + """ Swap opening/closing parentheses in Hebrew text. + + Up to LyX 2.4, "(" was used as closing parenthesis and + ")" as opening parenthesis for Hebrew in the LyX source. """ - - print("convert hebrew parentheses") + # print("convert hebrew parentheses") current_languages = [document.language] for i, line in enumerate(document.body): if line.startswith('\\lang '): current_languages[-1] = line.lstrip('\\lang ') elif line.startswith('\\begin_layout'): current_languages.append(current_languages[-1]) - print (line, current_languages[-1]) + # print (line, current_languages[-1]) elif line.startswith('\\end_layout'): current_languages.pop() elif current_languages[-1] == 'hebrew' and not line.startswith('\\'): @@ -1480,7 +1476,7 @@ def revert_soul(document): i = find_token(document.body, "\\begin_inset Flex Highlight", 0) if i != -1: add_to_preamble(document, ["\\usepackage{color}"]) - + revert_flex_inset(document.body, "Spaceletters", "\\so") revert_flex_inset(document.body, "Strikethrough", "\\st") revert_flex_inset(document.body, "Underline", "\\ul") @@ -1627,6 +1623,78 @@ def revert_cmidruletrimming(document): i += 1 +ruby_inset_def = [ + r'### Inserted by lyx2lyx (ruby inset) ###', + r'InsetLayout Flex:Ruby', + r' LyxType charstyle', + r' LatexType command', + r' LatexName ruby', + r' HTMLTag ruby', + r' HTMLAttr ""', + r' HTMLInnerTag rb', + r' HTMLInnerAttr ""', + r' BgColor none', + r' LabelString "Ruby"', + r' Decoration Conglomerate', + r' Preamble', + r' \ifdefined\kanjiskip', + r' \IfFileExists{okumacro.sty}{\usepackage{okumacro}}{}', + r' \else \ifdefined\luatexversion', + r' \usepackage{luatexja-ruby}', + r' \else \ifdefined\XeTeXversion', + r' \usepackage{ruby}%', + r' \fi\fi\fi', + r' \providecommand{\ruby}[2]{\shortstack{\tiny #2\\#1}}', + r' EndPreamble', + r' Argument post:1', + r' LabelString "ruby text"', + r' MenuString "Ruby Text|R"', + r' Tooltip "Reading aid (ruby, furigana) for Chinese characters."', + r' Decoration Conglomerate', + r' Font', + r' Size tiny', + r' EndFont', + r' LabelFont', + r' Size tiny', + r' EndFont', + r' Mandatory 1', + r' EndArgument', + r'End', +] + +def convert_ruby_module(document): + " Use ruby module instead of local module definition " + if document.del_local_layout(ruby_inset_def): + document.add_module("ruby") + +def revert_ruby_module(document): + " Replace ruby module with local module definition " + if document.del_module("ruby"): + document.append_local_layout(ruby_inset_def) + + +def convert_utf8_japanese(document): + " Use generic utf8 with Japanese documents." + lang = get_value(document.header, "\\language") + if not lang.startswith("japanese"): + return + inputenc = get_value(document.header, "\\inputencoding") + if ((lang == "japanese" and inputenc == "utf8-platex") + or (lang == "japanese-cjk" and inputenc == "utf8-cjk")): + document.set_parameter("inputencoding", "utf8") + +def revert_utf8_japanese(document): + " Use Japanese utf8 variants with Japanese documents." + inputenc = get_value(document.header, "\\inputencoding") + if inputenc != "utf8": + return + lang = get_value(document.header, "\\language") + if lang == "japanese": + document.set_parameter("inputencoding", "utf8-platex") + if lang == "japanese-cjk": + document.set_parameter("inputencoding", "utf8-cjk") + + ## # Conversion hub # @@ -1662,9 +1730,11 @@ convert = [ [571, []], [572, [convert_notoFonts]], # Added options thin, light, extralight for Noto [573, [convert_inputencoding_namechange]], + [574, [convert_ruby_module, convert_utf8_japanese]], ] -revert = [[572, [revert_inputencoding_namechange]], +revert = [[573, [revert_ruby_module, revert_utf8_japanese]], + [572, [revert_inputencoding_namechange]], [571, [revert_notoFonts]], [570, [revert_cmidruletrimming]], [569, [revert_bibfileencodings]], diff --git a/src/tex2lyx/test/CJK.lyx.lyx b/src/tex2lyx/test/CJK.lyx.lyx index 266d4ab50d..1ac86dd012 100644 --- a/src/tex2lyx/test/CJK.lyx.lyx +++ b/src/tex2lyx/test/CJK.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/CJKutf8.lyx.lyx b/src/tex2lyx/test/CJKutf8.lyx.lyx index e0115ee1f3..bac8bbea75 100644 --- a/src/tex2lyx/test/CJKutf8.lyx.lyx +++ b/src/tex2lyx/test/CJKutf8.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/DummyDocument.lyx.lyx b/src/tex2lyx/test/DummyDocument.lyx.lyx index 0e01be3950..158ba2ae1f 100644 --- a/src/tex2lyx/test/DummyDocument.lyx.lyx +++ b/src/tex2lyx/test/DummyDocument.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/Dummy~Document.lyx.lyx b/src/tex2lyx/test/Dummy~Document.lyx.lyx index 1f26fee5ef..c9cfcf29ee 100644 --- a/src/tex2lyx/test/Dummy~Document.lyx.lyx +++ b/src/tex2lyx/test/Dummy~Document.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx index f88a7e19de..560db824ca 100644 --- a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx +++ b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/algo2e.lyx.lyx b/src/tex2lyx/test/algo2e.lyx.lyx index f18e438e26..b2f6e9690a 100644 --- a/src/tex2lyx/test/algo2e.lyx.lyx +++ b/src/tex2lyx/test/algo2e.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/beamer.lyx.lyx b/src/tex2lyx/test/beamer.lyx.lyx index 81c60c5a3e..da885118d9 100644 --- a/src/tex2lyx/test/beamer.lyx.lyx +++ b/src/tex2lyx/test/beamer.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx index 8671944359..dc66a3ad3b 100644 --- a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx +++ b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/listpreamble.lyx.lyx b/src/tex2lyx/test/listpreamble.lyx.lyx index 00119a71ca..71efd675bd 100644 --- a/src/tex2lyx/test/listpreamble.lyx.lyx +++ b/src/tex2lyx/test/listpreamble.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/tabular-x-test.lyx.lyx b/src/tex2lyx/test/tabular-x-test.lyx.lyx index 449c9b4455..856cf146b4 100644 --- a/src/tex2lyx/test/tabular-x-test.lyx.lyx +++ b/src/tex2lyx/test/tabular-x-test.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test-insets-basic.lyx.lyx b/src/tex2lyx/test/test-insets-basic.lyx.lyx index d9102f6438..7e3f2c3d6c 100644 --- a/src/tex2lyx/test/test-insets-basic.lyx.lyx +++ b/src/tex2lyx/test/test-insets-basic.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test-insets.lyx.lyx b/src/tex2lyx/test/test-insets.lyx.lyx index 9f98df22eb..3a4991d759 100644 --- a/src/tex2lyx/test/test-insets.lyx.lyx +++ b/src/tex2lyx/test/test-insets.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test-memoir.lyx.lyx b/src/tex2lyx/test/test-memoir.lyx.lyx index b0d381c586..d00374d6f6 100644 --- a/src/tex2lyx/test/test-memoir.lyx.lyx +++ b/src/tex2lyx/test/test-memoir.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test-minted.lyx.lyx b/src/tex2lyx/test/test-minted.lyx.lyx index e2a1bffee9..b6f8c3cb07 100644 --- a/src/tex2lyx/test/test-minted.lyx.lyx +++ b/src/tex2lyx/test/test-minted.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test-modules.lyx.lyx b/src/tex2lyx/test/test-modules.lyx.lyx index 79ff14c5e2..78788f7c9b 100644 --- a/src/tex2lyx/test/test-modules.lyx.lyx +++ b/src/tex2lyx/test/test-modules.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx index 8264db5c0c..170d87ab67 100644 --- a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx +++ b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test-scr.lyx.lyx b/src/tex2lyx/test/test-scr.lyx.lyx index 24eba4a6d8..fb6ad8252d 100644 --- a/src/tex2lyx/test/test-scr.lyx.lyx +++ b/src/tex2lyx/test/test-scr.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test-structure.lyx.lyx b/src/tex2lyx/test/test-structure.lyx.lyx index 16e26dcb13..0f94d6da74 100644 --- a/src/tex2lyx/test/test-structure.lyx.lyx +++ b/src/tex2lyx/test/test-structure.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/test.lyx.lyx b/src/tex2lyx/test/test.lyx.lyx index 2ec3708335..7df48ccf53 100644 --- a/src/tex2lyx/test/test.lyx.lyx +++ b/src/tex2lyx/test/test.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/tex2lyx/test/verbatim.lyx.lyx b/src/tex2lyx/test/verbatim.lyx.lyx index db1231394b..6193574cb0 100644 --- a/src/tex2lyx/test/verbatim.lyx.lyx +++ b/src/tex2lyx/test/verbatim.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.4 -\lyxformat 573 +\lyxformat 574 \begin_document \begin_header \save_transient_properties true diff --git a/src/version.h b/src/version.h index 7ed1561ac9..a92854e8a9 100644 --- a/src/version.h +++ b/src/version.h @@ -32,8 +32,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 573 // gm: rename input encoding settings -#define LYX_FORMAT_TEX2LYX 573 +#define LYX_FORMAT_LYX 574 // gm: Japanese fixes +#define LYX_FORMAT_TEX2LYX 574 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER -- 2.39.5