]> git.lyx.org Git - features.git/commitdiff
moderncv.layout: support the command \social
authorUwe Stöhr <uwestoehr@lyx.org>
Tue, 28 May 2013 23:11:14 +0000 (01:11 +0200)
committerUwe Stöhr <uwestoehr@lyx.org>
Tue, 28 May 2013 23:11:14 +0000 (01:11 +0200)
- \social can be used for social network addresses in the address block

lib/examples/modernCV.lyx
lib/layouts/moderncv.layout
lib/lyx2lyx/lyx_2_1.py

index 5138a2176e90f7911650404d1babad26fe993c4c..46962907f4fee877fd219f8d7b6a8d3e7c9eacc0 100644 (file)
@@ -260,6 +260,67 @@ testman@testman.xx
 www.johndoe.com
 \end_layout
 
+\begin_layout Social
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+twitter
+\end_layout
+
+\end_inset
+
+ptestman
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
+currently only 
+\series bold
+twitter
+\series default
+, 
+\series bold
+linkedin
+\series default
+ or 
+\series bold
+github
+\series default
+ is supported as name
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\begin_layout Social
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+linkedin
+\end_layout
+
+\end_inset
+
+ptestman
+\end_layout
+
+\begin_layout Social
+\begin_inset Argument 1
+status open
+
+\begin_layout Plain Layout
+github
+\end_layout
+
+\end_inset
+
+ptestman
+\end_layout
+
 \begin_layout ExtraInfo
 www.lyx.org
 \end_layout
index 7512e3fa02aac7e36dc49dcf2d14f657151d570a..8dcdcf5cfd564696f9fe974ea59b04ddb38105fa 100644 (file)
@@ -152,6 +152,16 @@ Style Homepage
        LabelString     "Homepage:"
 End
 
+Style Social
+       CopyStyle       CVStyle
+       LatexName       social
+       LabelString     "Social:"
+       Argument 1
+         LabelString   "Name"
+         Tooltip       "Name of the social network"
+       EndArgument
+End
+
 Style ExtraInfo
        CopyStyle       CVStyle
        LatexName       extrainfo
index 59c81420ecf92a797eac59bb642196d7982554eb..0c38796f6f5161b69fc3c64e0915e6273365f2a5 100644 (file)
@@ -1872,6 +1872,7 @@ def revert_ModernCV(document):
     k = 0
     m = 0
     o = 0
+    p = 0
     while True:
       if j != -1:
         j = find_token(document.body, "\\begin_layout Entry", j)
@@ -1895,7 +1896,12 @@ def revert_ModernCV(document):
         revert_Argument_to_TeX_brace(document, o, 0, 1, 3, False, False)
         document.body[o] = document.body[o].replace("\\begin_layout DoubleItem", "\\begin_layout Computer")
         o = o + 1
-      if j == -1 and k == -1 and m == -1 and o == -1:
+      if p != -1:
+        p = find_token(document.body, "\\begin_layout Social", p)
+      if p != -1:
+        revert_Argument_to_TeX_brace(document, p, 0, 1, 1, False, True)
+        p = p + 1
+      if j == -1 and k == -1 and m == -1 and o == -1 and p == -1:
         return
 
 
@@ -1944,6 +1950,31 @@ def revert_ModernCV_3(document):
         return
 
 
+def revert_ModernCV_4(document):
+  " Reverts the style Social to TeX-code "
+  if document.textclass == "moderncv":
+    # revert the layouts
+    revert_ModernCV(document)
+    p = 0
+    while True:
+      if p != -1:
+        p = find_token(document.body, "\\begin_layout Social", p)
+      if p != -1:
+        pEnd = find_end_of_layout(document.body, p)
+        document.body[p] = document.body[p].replace("\\begin_layout Social", "\\begin_layout Standard")
+        document.body[p + 1 : p + 1] = put_cmd_in_ert("\\social")
+        hasOpt = find_token(document.body, "[", p + 9)
+        if hasOpt < p + 18:
+            document.body[p + 30 : p + 30] = put_cmd_in_ert("{")
+            document.body[p + 41 : p + 41] = put_cmd_in_ert("}")
+        else:
+            document.body[p + 11 : p + 11] = put_cmd_in_ert("{")
+            document.body[p + 21 : p + 21] = put_cmd_in_ert("}")
+        p = p + 1
+      if p == -1:
+        return
+
+
 def convert_ModernCV(document):
   " Converts ERT of modernCV to InsetArgument "
   if document.textclass == "moderncv":
@@ -4293,7 +4324,7 @@ revert =  [
            [449, [revert_garamondx, revert_garamondx_newtxmath]],
            [448, [revert_itemargs]],
            [447, [revert_literate]],
-           [446, [revert_IEEEtran, revert_IEEEtran_2, revert_AASTeX, revert_AGUTeX, revert_IJMP, revert_SIGPLAN, revert_SIGGRAPH, revert_EuropeCV, revert_Initials, revert_ModernCV_3]],
+           [446, [revert_IEEEtran, revert_IEEEtran_2, revert_AASTeX, revert_AGUTeX, revert_IJMP, revert_SIGPLAN, revert_SIGGRAPH, revert_EuropeCV, revert_Initials, revert_ModernCV_3, revert_ModernCV_4]],
            [445, [revert_latexargs]],
            [444, [revert_uop]],
            [443, [revert_biolinum]],