Une nouvelle version du portail de gestion des comptes externes sera mise en production lundi 09 août. Elle permettra d'allonger la validité d'un compte externe jusqu'à 3 ans. Pour plus de détails sur cette version consulter : https://doc-si.inria.fr/x/FCeS

Commit 8689e7be authored by Thierry Martinez's avatar Thierry Martinez
Browse files

LaTeX commands...

parent 0164f527
......@@ -562,22 +562,23 @@ write_argument(Argument, Doc) :-
)
;
camel_case(Type, CamelCaseType),
make_id(Type, Id),
format(atom(TypeLink), '<a href="#~a">~a</a>', [Id, Type]),
(
Argument = CamelCaseType
->
make_id(Type, Id),
format(Doc, '<a href="#~a">~a</a>', [Id, Type])
write(Doc, TypeLink)
;
atom_concat(CamelCaseType, Suffix, Argument)
->
make_id(Type, Id),
format(
Doc,
'<a href="#~a">~a</a><sub><var>~a</var></sub>',
[Id, Type, Suffix]
'~a<sub><var>~a</var></sub>',
[TypeLink, Suffix]
)
;
format(Doc, '<var>~a</var>: ~a', [Argument, Type])
format(Doc, '<var>~a</var>: ~a', [Argument, TypeLink])
)
)
;
......@@ -645,24 +646,16 @@ write_doc(Doc, DocBody) :-
write_doc_chars([], _).
write_doc_chars(['\\', '\\' | Tail], Doc) :-
!,
write(Doc, '\\'),
write_doc_chars(Tail, Doc).
write_doc_chars(['\\' | Tail], Doc) :-
!,
(
append(CommandChars, ['{' | TailArgument], Tail)
->
(
append(ArgumentChars, ['}' | TailDoc], TailArgument)
->
atom_chars(Command, CommandChars),
atom_chars(Argument, ArgumentChars),
write_command(Command, Argument, Doc),
write_doc_chars(TailDoc, Doc)
;
throw(error(unterminated_command))
)
;
throw(error(missing_argument))
).
parse_latex_command(Tail, Command, Argument, TailDoc),
write_command(Command, Argument, Doc),
write_doc_chars(TailDoc, Doc).
write_doc_chars(['-', '-' | Tail], Doc) :-
!,
......@@ -679,6 +672,65 @@ write_doc_chars([Char | Tail], Doc) :-
write_doc_chars(Tail, Doc).
parse_latex_command(Chars, Command, Argument, Tail) :-
parse_latex_command_name(Chars, CommandChars, Tail0),
parse_latex_command_arguments(Tail0, ArgumentChars, Tail),
atom_chars(Command, CommandChars),
atom_chars(Argument, ArgumentChars).
parse_latex_command_name([Head | Tail], CommandChars, Others) :-
(
'A' @=< Head, Head @=< 'Z'
;
'a' @=< Head, Head @=< 'z'
),
!,
CommandChars = [Head | TailCommandChars],
parse_latex_command_name(Tail, TailCommandChars, Others).
parse_latex_command_name(Tail, [], Tail).
parse_latex_command_arguments([Head | Tail], ArgumentChars, Others) :-
(
Head = ' '
;
Head = '\n'
;
Head = '\t'
),
!,
parse_latex_command_arguments(Tail, ArgumentChars, Others).
parse_latex_command_arguments(['{' | Tail], ArgumentsChars, Others) :-
!,
read_latex_command_arguments(Tail, ArgumentsChars, [], Others).
parse_latex_command_arguments(Tail, [], Tail).
read_latex_command_arguments(
['{' | Tail], ['{' | ArgumentsChars], End, Others
) :-
!,
read_latex_command_arguments(Tail, ArgumentsChars, ['}' | End0], Others0),
read_latex_command_arguments(Others0, End0, End, Others).
read_latex_command_arguments(
['}' | Tail], ArgumentsChars, ArgumentsChars, Tail
) :-
!.
read_latex_command_arguments(
[Char | Tail], [Char | ArgumentsChars], End, Others
) :-
read_latex_command_arguments(Tail, ArgumentsChars, End, Others).
read_latex_command_arguments([], _ArgumentChars, _End, _Others) :-
throw(error(missing_closing_curly_braces)).
write_command(texttt, Text, Doc) :-
!,
format(Doc, '<code>~a</code>', [Text]).
......@@ -707,6 +759,30 @@ write_command(index, Key, Doc) :-
atom_chars(Key, KeyChars),
write_doc_chars(KeyChars, Doc).
write_command(begin, itemize, Doc) :-
!,
nb_setvar(opened_li, false),
write(Doc, '<ul>').
write_command(begin, enumerate, Doc) :-
!,
nb_setvar(opened_li, false),
write(Doc, '<ol>').
write_command(item, Argument, Doc) :-
!,
(
nb_getvar(opened_li, true)
->
write(Doc, '</li>'),
nb
;
true
),
atom_chars(Argument, ArgumentChars),
write_doc_chars(ArgumentChars, Doc),
write(Doc, Argu).
write_command(Command, _Argument, _Doc) :-
throw(error(unknown_command(Command))).
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment