Author: uwestoehr
Date: Thu Oct 27 14:49:29 2011
New Revision: 40033
URL: http://www.lyx.org/trac/changeset/40033

Log:
backporting tex2lyx: the support for \href

Modified:
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/text.cpp
   lyx-devel/branches/BRANCH_2_0_X/status.20x

Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt        Thu Oct 27 
14:43:07 2011        (r40032)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt        Thu Oct 27 
14:49:29 2011        (r40033)
@@ -32,7 +32,6 @@
 290    wrapped tables                       InsetWrap
 292    japanese                             japanese-plain
 293    ?                                    InsetInfo
-299    hyperlink types                      InsetHyperlink
 309    \nocite                              InsetCitation
 310    \nocite{*}                           InsetBibtex
 312    rotfloat.sty                         InsetFloat

Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/text.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/text.cpp        Thu Oct 27 
14:43:07 2011        (r40032)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/text.cpp        Thu Oct 27 
14:49:29 2011        (r40033)
@@ -2453,6 +2453,30 @@
                        parse_text_in_inset(p, os, FLAG_ITEM, outer, context);
                        end_inset(os);
                }
+
+               else if (t.cs() == "href") {
+                       context.check_layout(os);
+                       string target = p.getArg('{', '}');
+                       string name = p.getArg('{', '}');
+                       string type;
+                       size_t i = target.find(':');
+                       if (i != string::npos) {
+                               type = target.substr(0, i + 1);
+                               if (type == "mailto:"; || type == "file:")
+                                       target = target.substr(i + 1);
+                               // handle the case that name is equal to 
target, except of "http://";
+                               else if (target.substr(i + 3) == name && type 
== "http:")
+                                       target = name;
+                       }
+                       begin_command_inset(os, "href", "href");
+                       if (name != target)
+                               os << "name \"" << name << "\"\n";
+                       os << "target \"" << target << "\"\n";
+                       if (type == "mailto:"; || type == "file:")
+                               os << "type \"" << type << "\"\n";
+                       end_inset(os);
+                       skip_spaces_braces(p);
+               }
                
                else if (t.cs() == "lyxline") {
                        // swallow size argument (it is not used anyway)

Modified: lyx-devel/branches/BRANCH_2_0_X/status.20x
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/status.20x  Thu Oct 27 14:43:07 2011        
(r40032)
+++ lyx-devel/branches/BRANCH_2_0_X/status.20x  Thu Oct 27 14:49:29 2011        
(r40033)
@@ -46,7 +46,7 @@
 
 - the setting of the document-wide background color and text color
   (\color, \pagecolor), the background color of shaded boxes and the
-  text color of greyed-out notes is now recognized
+  text color of greyed-out notes are now recognized
 
 - phantom spaces are recognized (\phantom, \hphanton, \vphantom)
 
@@ -56,6 +56,8 @@
 
 - all types of underlined or striked out text are recognized
 
+- hyperlinks are recognized (\href)
+
 
 * USER INTERFACE
 

Reply via email to