From e5fd1282005b473400c8905afec54ead3fcd9abb Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 18 Dec 2010 20:41:41 +0000 Subject: [PATCH] Increase tex2lyx output format to 295. 294: Nothing needed, but add some placeholders to the preamble for documentation 295: Convert URL command inset to Flex inset git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36941 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/tex2lyx/preamble.cpp | 58 ++++++++++++++++++++++++++++++++++++---- src/tex2lyx/tex2lyx.h | 2 +- src/tex2lyx/text.cpp | 6 ++--- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/src/tex2lyx/preamble.cpp b/src/tex2lyx/preamble.cpp index 5c3a4e6269..97cd46cd5c 100644 --- a/src/tex2lyx/preamble.cpp +++ b/src/tex2lyx/preamble.cpp @@ -143,8 +143,26 @@ string h_font_osf = "false"; string h_font_sf_scale = "100"; string h_font_tt_scale = "100"; string h_graphics = "default"; +string h_float_placement; string h_paperfontsize = "default"; string h_spacing = "single"; +string h_use_hyperref = "0"; +string h_pdf_title; +string h_pdf_author; +string h_pdf_subject; +string h_pdf_keywords; +string h_pdf_bookmarks = "1"; +string h_pdf_bookmarksnumbered = "0"; +string h_pdf_bookmarksopen = "0"; +string h_pdf_bookmarksopenlevel = "1"; +string h_pdf_breaklinks = "0"; +string h_pdf_pdfborder = "0"; +string h_pdf_colorlinks = "0"; +string h_pdf_backref = "0"; +string h_pdf_pagebackref = "0"; +string h_pdf_pdfusetitle = "1"; +string h_pdf_pagemode; +string h_pdf_quoted_options; string h_papersize = "default"; string h_use_geometry = "false"; string h_use_amsmath = "1"; @@ -160,6 +178,7 @@ string h_quotes_language = "english"; string h_papercolumns = "1"; string h_papersides = string(); string h_paperpagestyle = "default"; +string h_listings_params; string h_tracking_changes = "false"; string h_output_changes = "false"; string h_margins = ""; @@ -530,10 +549,37 @@ void end_preamble(ostream & os, TextClass const & /*textclass*/) << "\\font_osf " << h_font_osf << "\n" << "\\font_sf_scale " << h_font_sf_scale << "\n" << "\\font_tt_scale " << h_font_tt_scale << "\n" - << "\\graphics " << h_graphics << "\n" - << "\\paperfontsize " << h_paperfontsize << "\n" + << "\\graphics " << h_graphics << "\n"; + if (!h_float_placement.empty()) + os << "\\float_placement " << h_float_placement << "\n"; + os << "\\paperfontsize " << h_paperfontsize << "\n" << "\\spacing " << h_spacing << "\n" - << "\\papersize " << h_papersize << "\n" + << "\\use_hyperref " << h_use_hyperref << '\n'; + if (h_use_hyperref == "1") { + if (!h_pdf_title.empty()) + os << "\\pdf_title \"" << h_pdf_title << "\"\n"; + if (!h_pdf_author.empty()) + os << "\\pdf_author \"" << h_pdf_author << "\"\n"; + if (!h_pdf_subject.empty()) + os << "\\pdf_subject \"" << h_pdf_subject << "\"\n"; + if (!h_pdf_keywords.empty()) + os << "\\pdf_keywords \"" << h_pdf_keywords << "\"\n"; + os << "\\pdf_bookmarks " << h_pdf_bookmarks << "\n" + "\\pdf_bookmarksnumbered " << h_pdf_bookmarksnumbered << "\n" + "\\pdf_bookmarksopen " << h_pdf_bookmarksopen << "\n" + "\\pdf_bookmarksopenlevel " << h_pdf_bookmarksopenlevel << "\n" + "\\pdf_breaklinks " << h_pdf_breaklinks << "\n" + "\\pdf_pdfborder " << h_pdf_pdfborder << "\n" + "\\pdf_colorlinks " << h_pdf_colorlinks << "\n" + "\\pdf_backref " << h_pdf_backref << "\n" + "\\pdf_pagebackref " << h_pdf_pagebackref << "\n" + "\\pdf_pdfusetitle " << h_pdf_pdfusetitle << '\n'; + if (!h_pdf_pagemode.empty()) + os << "\\pdf_pagemode " << h_pdf_pagemode << '\n'; + if (!h_pdf_quoted_options.empty()) + os << "\\pdf_quoted_options \"" << h_pdf_quoted_options << "\"\n"; + } + os << "\\papersize " << h_papersize << "\n" << "\\use_geometry " << h_use_geometry << "\n" << "\\use_amsmath " << h_use_amsmath << "\n" << "\\use_esint " << h_use_esint << "\n" @@ -548,8 +594,10 @@ void end_preamble(ostream & os, TextClass const & /*textclass*/) << "\\quotes_language " << h_quotes_language << "\n" << "\\papercolumns " << h_papercolumns << "\n" << "\\papersides " << h_papersides << "\n" - << "\\paperpagestyle " << h_paperpagestyle << "\n" - << "\\tracking_changes " << h_tracking_changes << "\n" + << "\\paperpagestyle " << h_paperpagestyle << "\n"; + if (!h_listings_params.empty()) + os << "\\listings_params " << h_listings_params << "\n"; + os << "\\tracking_changes " << h_tracking_changes << "\n" << "\\output_changes " << h_output_changes << "\n" << "\\end_header\n\n" << "\\begin_body\n"; diff --git a/src/tex2lyx/tex2lyx.h b/src/tex2lyx/tex2lyx.h index 5b1e85f2bc..1f748de58d 100644 --- a/src/tex2lyx/tex2lyx.h +++ b/src/tex2lyx/tex2lyx.h @@ -114,7 +114,7 @@ extern CommandMap known_math_environments; /// extern bool noweb_mode; /// LyX format that is created by tex2lyx -int const LYX_FORMAT = 293; +int const LYX_FORMAT = 295; /// path of the master .tex file extern std::string getMasterFilePath(); diff --git a/src/tex2lyx/text.cpp b/src/tex2lyx/text.cpp index 4833b0ddc9..60c6135af5 100644 --- a/src/tex2lyx/text.cpp +++ b/src/tex2lyx/text.cpp @@ -2165,9 +2165,9 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer, else if (t.cs() == "url") { context.check_layout(os); - begin_command_inset(os, "url", "url"); - // LyX cannot handle newlines in a latex command - os << "target " << '"' << subst(p.verbatim_item(), "\n", " ") << '"' << "\n"; + begin_inset(os, "Flex URL\n"); + os << "status collapsed\n"; + parse_text_in_inset(p, os, FLAG_ITEM, false, context); end_inset(os); }