forked from jexp/TinyMacros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutil.conv.tf
88 lines (80 loc) · 2.2 KB
/
util.conv.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
; $Log: util.conv.tf,v $
; Revision 1.1 2002/05/12 09:11:07 thufhnik
; Scratch
;
/set util_conv_tf_version $Id$
/set [email protected]
/set util_conv_tf_requires=
/set util_conv_tf_desc Verschiedene Konvertierungen
/addh info \
Gibt einen String aus, der die uebergebene Zeit minutengenau im Klartext enthaelt. Soll die Zeit sekundengenau ausgegeben werden muss sek_flag gesetzt werden.
/addh syn /time2str zeit [sek_flag]
/addh ex /time2str 1000000 1
/addh time2str mak
/def time2str = \
/let T2SMINS=$[{1} / 60]%;\
/let T2SSECS=$[mod({1}, 60)]%;\
/let T2SHOURS=$[T2SMINS / 60]%;\
/let T2SDAYS=$[T2SHOURS / 24]%;\
/let T2SWEEKS=$[T2SDAYS / 7]%;\
/let T2SDAYS=$[mod(T2SDAYS,7)]%;\
/let T2SHOURS=$[mod(T2SHOURS,24)]%;\
/let T2SMINS=$[mod(T2SMINS,60)]%;\
/if (T2SWEEKS) \
/if (T2SWEEKS == 1) \
/let T2SSTR=eine Woche, @{n}%;\
/else \
/let T2SSTR=%T2SWEEKS Wochen, @{n}%;\
/endif%;\
/else \
/let T2SSTR=%;\
/endif%;\
/if (T2SWEEKS | T2SDAYS) \
/if (T2SDAYS == 1) \
/let T2SSTR=$[strcat(T2SSTR, "einen Tag, @{n}")]%;\
/else \
/let T2SSTR=%T2SSTR%T2SDAYS Tage, @{n}%;\
/endif%;\
/endif%;\
/if (T2SWEEKS | T2SDAYS | T2SHOURS) \
/if (T2SHOURS == 1) \
/let T2SSTR=$[strcat(T2SSTR, "eine Stunde, @{n}")]%;\
/else \
/let T2SSTR=%T2SSTR%T2SHOURS Stunden, @{n}%;\
/endif%;\
/endif%;\
/if (T2SMINS == 1) \
/let T2SSTR=$[strcat(T2SSTR, "eine Minute")]%;\
/else \
/let T2SSTR=%T2SSTR%T2SMINS Minuten%;\
/endif%;\
/if ({2}) \
/if (T2SSECS == 1) \
/test T2SSTR := strcat(T2SSTR, " und eine Sekunde")%;\
/else \
/test T2SSTR := strcat(T2SSTR, " und ", T2SSECS, \
" Sekunden")%;\
/endif%;\
/endif%;\
/echo -p -- %T2SSTR
/addh info \
Entfernt aus dem uebergebenen String den fuehrenden Artikel.
/addh syn /remove_article text
/addh ex /remove_article Das Auto
/addh remove_article mak
/def remove_article = \
/if (regmatch(articles, {*})) \
/echo -- %PR%;\
/else \
/echo -- %*%;\
/endif
/set articles=
/if (mud_lang=~'en') \
/test articles:="^[Tt]h(e|is) "%;\
/else \
/test articles:="^[Dd]e[rsmn] |[Dd]ie |[Dd]as |[Dd]ein(e[srnm]?)? |\
[Ee]in(e[srmn]?)? "%;\
/endif
/if /ismacro compile_regexp%; /then \
/compile_regexp articles%;\
/endif