moderncv.layout: support the command \social

- \social can be used for social network addresses in the address block
This commit is contained in:
Uwe Stöhr 2013-05-29 01:11:14 +02:00
parent d12f7440fb
commit 6c0bc842b7
3 changed files with 104 additions and 2 deletions

View File

@ -260,6 +260,67 @@ testman@testman.xx
www.johndoe.com www.johndoe.com
\end_layout \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 \begin_layout ExtraInfo
www.lyx.org www.lyx.org
\end_layout \end_layout

View File

@ -152,6 +152,16 @@ Style Homepage
LabelString "Homepage:" LabelString "Homepage:"
End End
Style Social
CopyStyle CVStyle
LatexName social
LabelString "Social:"
Argument 1
LabelString "Name"
Tooltip "Name of the social network"
EndArgument
End
Style ExtraInfo Style ExtraInfo
CopyStyle CVStyle CopyStyle CVStyle
LatexName extrainfo LatexName extrainfo

View File

@ -1872,6 +1872,7 @@ def revert_ModernCV(document):
k = 0 k = 0
m = 0 m = 0
o = 0 o = 0
p = 0
while True: while True:
if j != -1: if j != -1:
j = find_token(document.body, "\\begin_layout Entry", j) 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) 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") document.body[o] = document.body[o].replace("\\begin_layout DoubleItem", "\\begin_layout Computer")
o = o + 1 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 return
@ -1944,6 +1950,31 @@ def revert_ModernCV_3(document):
return 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): def convert_ModernCV(document):
" Converts ERT of modernCV to InsetArgument " " Converts ERT of modernCV to InsetArgument "
if document.textclass == "moderncv": if document.textclass == "moderncv":
@ -4293,7 +4324,7 @@ revert = [
[449, [revert_garamondx, revert_garamondx_newtxmath]], [449, [revert_garamondx, revert_garamondx_newtxmath]],
[448, [revert_itemargs]], [448, [revert_itemargs]],
[447, [revert_literate]], [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]], [445, [revert_latexargs]],
[444, [revert_uop]], [444, [revert_uop]],
[443, [revert_biolinum]], [443, [revert_biolinum]],