diff options
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 4 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 4 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 1 | ||||
-rw-r--r-- | lib/skin_parser/tag_table.c | 2 | ||||
-rw-r--r-- | manual/appendix/wps_tags.tex | 14 |
5 files changed, 24 insertions, 1 deletions
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 3899f605f3..340cbbdb01 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -824,6 +824,10 @@ static int parse_substring_tag(struct skin_element* element, | |||
824 | else | 824 | else |
825 | ss->length = get_param(element, 1)->data.number; | 825 | ss->length = get_param(element, 1)->data.number; |
826 | ss->token = get_param_code(element, 2)->data; | 826 | ss->token = get_param_code(element, 2)->data; |
827 | if (element->params_count > 3) | ||
828 | ss->expect_number = !strcmp(get_param_text(element, 3), "number"); | ||
829 | else | ||
830 | ss->expect_number = false; | ||
827 | token->value.data = PTRTOSKINOFFSET(skin_buffer, ss); | 831 | token->value.data = PTRTOSKINOFFSET(skin_buffer, ss); |
828 | return 0; | 832 | return 0; |
829 | } | 833 | } |
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 82d96f6993..765102513a 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -942,6 +942,10 @@ const char *get_token_value(struct gui_wps *gwps, | |||
942 | buf = &buf[start_byte]; | 942 | buf = &buf[start_byte]; |
943 | 943 | ||
944 | buf[byte_len] = '\0'; | 944 | buf[byte_len] = '\0'; |
945 | if (ss->expect_number && | ||
946 | intval && (buf[0] >= '0' && buf[0] <= '9')) | ||
947 | *intval = atoi(buf) + 1; /* so 0 is the first item */ | ||
948 | |||
945 | return buf; | 949 | return buf; |
946 | } | 950 | } |
947 | return NULL; | 951 | return NULL; |
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index 9c3fa1b5bc..c55c8d2515 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -286,6 +286,7 @@ struct logical_if { | |||
286 | struct substring { | 286 | struct substring { |
287 | int start; | 287 | int start; |
288 | int length; | 288 | int length; |
289 | bool expect_number; | ||
289 | OFFSETTYPE(struct wps_token *) token; | 290 | OFFSETTYPE(struct wps_token *) token; |
290 | }; | 291 | }; |
291 | 292 | ||
diff --git a/lib/skin_parser/tag_table.c b/lib/skin_parser/tag_table.c index d10b319dcf..14876d11c4 100644 --- a/lib/skin_parser/tag_table.c +++ b/lib/skin_parser/tag_table.c | |||
@@ -240,7 +240,7 @@ static const struct tag_info legal_tags[] = | |||
240 | { SKIN_TOKEN_VAR_GETVAL, "vg", "S", SKIN_REFRESH_DYNAMIC }, | 240 | { SKIN_TOKEN_VAR_GETVAL, "vg", "S", SKIN_REFRESH_DYNAMIC }, |
241 | { SKIN_TOKEN_VAR_TIMEOUT, "vl", "S|D", SKIN_REFRESH_DYNAMIC }, | 241 | { SKIN_TOKEN_VAR_TIMEOUT, "vl", "S|D", SKIN_REFRESH_DYNAMIC }, |
242 | 242 | ||
243 | { SKIN_TOKEN_SUBSTRING, "ss", "IiT", SKIN_REFRESH_DYNAMIC }, | 243 | { SKIN_TOKEN_SUBSTRING, "ss", "IiT|s", SKIN_REFRESH_DYNAMIC }, |
244 | { SKIN_TOKEN_UNKNOWN, "" , "", 0 } | 244 | { SKIN_TOKEN_UNKNOWN, "" , "", 0 } |
245 | /* Keep this here to mark the end of the table */ | 245 | /* Keep this here to mark the end of the table */ |
246 | }; | 246 | }; |
diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex index 0096075695..ba4cbd16ee 100644 --- a/manual/appendix/wps_tags.tex +++ b/manual/appendix/wps_tags.tex | |||
@@ -740,6 +740,20 @@ a horizontal progressbar which doesn't fill and draws the image | |||
740 | fits inside the specified width and height.} | 740 | fits inside the specified width and height.} |
741 | 741 | ||
742 | \section{Other Tags} | 742 | \section{Other Tags} |
743 | |||
744 | \begin{tagmap} | ||
745 | \config{\%ss(start, length, tag [,number]} & Get a substring from another tag.\\ | ||
746 | \end{tagmap} | ||
747 | Use this tag to get a substring from another tag. | ||
748 | \begin{description} | ||
749 | \item[start] -- first character to take (0 being the start of the string) | ||
750 | \item[length] -- length of the substring to return (- for the rest of the string) | ||
751 | \item[tag] -- tag to get | ||
752 | \item[number] -- OPTIONAL. if this is present it will assume the | ||
753 | substring is a number so it can be used with conditionals. (i.e \config{\%cM}). | ||
754 | 0 is the first conditional option | ||
755 | \end{description} | ||
756 | |||
743 | \begin{tagmap} | 757 | \begin{tagmap} |
744 | \config{\%(} & The character `('\\ | 758 | \config{\%(} & The character `('\\ |
745 | \config{\%)} & The character `)'\\ | 759 | \config{\%)} & The character `)'\\ |