diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-10-09 09:57:21 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2008-10-09 09:57:21 +0000 |
commit | ae569c6f820c1b6e8759e2ecc36641b870ae26f3 (patch) | |
tree | be94210bf1e46684b88b54beb019adadd1156c47 | |
parent | 8c0b661d074a7f9a9c42f143304c4807084f3cea (diff) | |
download | rockbox-ae569c6f820c1b6e8759e2ecc36641b870ae26f3.tar.gz rockbox-ae569c6f820c1b6e8759e2ecc36641b870ae26f3.zip |
Functionize some stuff
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18751 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-x | utils/rockbox_api/functions.php | 7 | ||||
-rwxr-xr-x | utils/rockbox_api/gen_html.php | 48 |
2 files changed, 17 insertions, 38 deletions
diff --git a/utils/rockbox_api/functions.php b/utils/rockbox_api/functions.php index 0f34fc69e0..57a7c99b13 100755 --- a/utils/rockbox_api/functions.php +++ b/utils/rockbox_api/functions.php | |||
@@ -334,4 +334,11 @@ function do_markup($data) | |||
334 | 334 | ||
335 | return $data; | 335 | return $data; |
336 | } | 336 | } |
337 | |||
338 | function get_tpl_part($search, $haystack) | ||
339 | { | ||
340 | $tpl = array(); | ||
341 | ereg($search[0].".*".$search[1], $haystack, $tpl); | ||
342 | return str_replace(array($search[0], $search[1]), "", $tpl[0]); | ||
343 | } | ||
337 | ?> | 344 | ?> |
diff --git a/utils/rockbox_api/gen_html.php b/utils/rockbox_api/gen_html.php index b3cec02036..d85d5f86b4 100755 --- a/utils/rockbox_api/gen_html.php +++ b/utils/rockbox_api/gen_html.php | |||
@@ -19,13 +19,8 @@ $inh = parse_documentation($input); | |||
19 | $index_tpl = file_get_contents($mypath."index.tpl"); | 19 | $index_tpl = file_get_contents($mypath."index.tpl"); |
20 | 20 | ||
21 | $group_data = array(); | 21 | $group_data = array(); |
22 | $group_tpl = array(); | 22 | $group_tpl = get_tpl_part(array("%GROUP_START%", "%GROUP_END%"), $index_tpl); |
23 | ereg("%GROUP_START%.*%GROUP_END%", $index_tpl, $group_tpl); | 23 | $func_tpl = get_tpl_part(array("%FUNCTION_START%", "%FUNCTION_END%"), $index_tpl); |
24 | $group_tpl = str_replace(array("%GROUP_START%", "%GROUP_END%"), "", $group_tpl[0]); | ||
25 | |||
26 | $func_tpl = array(); | ||
27 | ereg("%FUNCTION_START%.*%FUNCTION_END%", $group_tpl, $func_tpl); | ||
28 | $func_tpl = str_replace(array("%FUNCTION_START%", "%FUNCTION_END%"), "", $func_tpl[0]); | ||
29 | 24 | ||
30 | foreach($inh as $group_name => $group) | 25 | foreach($inh as $group_name => $group) |
31 | { | 26 | { |
@@ -46,10 +41,7 @@ $index_tpl = ereg_replace("%GROUP_START%.*%GROUP_END%", implode("", $group_data) | |||
46 | file_put_contents("output/index.html", $index_tpl); | 41 | file_put_contents("output/index.html", $index_tpl); |
47 | 42 | ||
48 | $menu_tpl = file_get_contents($mypath."menu.tpl"); | 43 | $menu_tpl = file_get_contents($mypath."menu.tpl"); |
49 | 44 | $group_tpl = get_tpl_part(array("%GROUP_START%", "%GROUP_END%"), $menu_tpl); | |
50 | $group_tpl = array(); | ||
51 | ereg("%GROUP_START%.*%GROUP_END%", $menu_tpl, $group_tpl); | ||
52 | $group_tpl = str_replace(array("%GROUP_START%", "%GROUP_END%"), "", $group_tpl[0]); | ||
53 | 45 | ||
54 | $menu = array(); | 46 | $menu = array(); |
55 | foreach($inh as $group_name => $group) | 47 | foreach($inh as $group_name => $group) |
@@ -65,33 +57,13 @@ $menu = ereg_replace("%GROUP_START%.*%GROUP_END%", implode("", $menu), $menu_tpl | |||
65 | 57 | ||
66 | $section_tpl = file_get_contents($mypath."section.tpl"); | 58 | $section_tpl = file_get_contents($mypath."section.tpl"); |
67 | 59 | ||
68 | $func_tpl = array(); | 60 | $func_tpl = get_tpl_part(array("%FUNCTION_START%", "%FUNCTION_END%"), $section_tpl); |
69 | ereg("%FUNCTION_START%.*%FUNCTION_END%", $section_tpl, $func_tpl); | 61 | $description_tpl = get_tpl_part(array("%DESCRIPTION_START%", "%DESCRIPTION_END%"), $section_tpl); |
70 | $func_tpl = str_replace(array("%FUNCTION_START%", "%FUNCTION_END%"), "", $func_tpl[0]); | 62 | $parameter_tpl = get_tpl_part(array("%PARAMETER_START%", "%PARAMETER_END%"), $section_tpl); |
71 | 63 | $parameters_tpl = get_tpl_part(array("%PARAMETERS_START%", "%PARAMETERS_END%"), $section_tpl); | |
72 | $description_tpl = array(); | 64 | $return_tpl = get_tpl_part(array("%RETURN_START%", "%RETURN_END%"), $section_tpl); |
73 | ereg("%DESCRIPTION_START%.*%DESCRIPTION_END%", $func_tpl, $description_tpl); | 65 | $conditions_tpl = get_tpl_part(array("%CONDITIONS_START%", "%CONDITIONS_END%"), $section_tpl); |
74 | $description_tpl = str_replace(array("%DESCRIPTION_START%", "%DESCRIPTION_END%"), "", $description_tpl[0]); | 66 | $see_tpl = get_tpl_part(array("%SEE_START%", "%SEE_END%"), $section_tpl); |
75 | |||
76 | $parameter_tpl = array(); | ||
77 | ereg("%PARAMETER_START%.*%PARAMETER_END%", $func_tpl, $parameter_tpl); | ||
78 | $parameter_tpl = str_replace(array("%PARAMETER_START%", "%PARAMETER_END%"), "", $parameter_tpl[0]); | ||
79 | |||
80 | $parameters_tpl = array(); | ||
81 | ereg("%PARAMETERS_START%.*%PARAMETERS_END%", $parameter_tpl, $parameters_tpl); | ||
82 | $parameters_tpl = str_replace(array("%PARAMETERS_START%", "%PARAMETERS_END%"), "", $parameters_tpl[0]); | ||
83 | |||
84 | $return_tpl = array(); | ||
85 | ereg("%RETURN_START%.*%RETURN_END%", $func_tpl, $return_tpl); | ||
86 | $return_tpl = str_replace(array("%RETURN_START%", "%RETURN_END%"), "", $return_tpl[0]); | ||
87 | |||
88 | $conditions_tpl = array(); | ||
89 | ereg("%CONDITIONS_START%.*%CONDITIONS_END%", $func_tpl, $conditions_tpl); | ||
90 | $conditions_tpl = str_replace(array("%CONDITIONS_START%", "%CONDITIONS_END%"), "", $conditions_tpl[0]); | ||
91 | |||
92 | $see_tpl = array(); | ||
93 | ereg("%SEE_START%.*%SEE_END%", $func_tpl, $see_tpl); | ||
94 | $see_tpl = str_replace(array("%SEE_START%", "%SEE_END%"), "", $see_tpl[0]); | ||
95 | 67 | ||
96 | foreach($inh as $group_name => $group) | 68 | foreach($inh as $group_name => $group) |
97 | { | 69 | { |