Fossil SCM
Added style_emit_script_bundle() to simplify page-level bundle usage a small bit. /forumpost, /wikiedit, /fileedit now use that routine.
Commit
0c233bc6974016c57e34545b9c68f8036e9e7af1f1d5bc03c708811f60d9c028
Parent
18da05b9033c732…
4 files changed
+1
-1
+1
-1
+13
+1
-1
+1
-1
| --- src/fileedit.c | ||
| +++ src/fileedit.c | ||
| @@ -1970,11 +1970,11 @@ | ||
| 1970 | 1970 | blob_appendf(&endScript,");\n"); |
| 1971 | 1971 | } |
| 1972 | 1972 | |
| 1973 | 1973 | blob_reset(&err); |
| 1974 | 1974 | CheckinMiniInfo_cleanup(&cimi); |
| 1975 | - style_emit_script_builtin(0, 0, ":fileedit.js"); | |
| 1975 | + style_emit_script_bundle("fileedit.js"); | |
| 1976 | 1976 | if(blob_size(&endScript)>0){ |
| 1977 | 1977 | style_emit_script_tag(0,0); |
| 1978 | 1978 | CX("\n(function(){\n"); |
| 1979 | 1979 | CX("try{\n%b}\n" |
| 1980 | 1980 | "catch(e){" |
| 1981 | 1981 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1970,11 +1970,11 @@ | |
| 1970 | blob_appendf(&endScript,");\n"); |
| 1971 | } |
| 1972 | |
| 1973 | blob_reset(&err); |
| 1974 | CheckinMiniInfo_cleanup(&cimi); |
| 1975 | style_emit_script_builtin(0, 0, ":fileedit.js"); |
| 1976 | if(blob_size(&endScript)>0){ |
| 1977 | style_emit_script_tag(0,0); |
| 1978 | CX("\n(function(){\n"); |
| 1979 | CX("try{\n%b}\n" |
| 1980 | "catch(e){" |
| 1981 |
| --- src/fileedit.c | |
| +++ src/fileedit.c | |
| @@ -1970,11 +1970,11 @@ | |
| 1970 | blob_appendf(&endScript,");\n"); |
| 1971 | } |
| 1972 | |
| 1973 | blob_reset(&err); |
| 1974 | CheckinMiniInfo_cleanup(&cimi); |
| 1975 | style_emit_script_bundle("fileedit.js"); |
| 1976 | if(blob_size(&endScript)>0){ |
| 1977 | style_emit_script_tag(0,0); |
| 1978 | CX("\n(function(){\n"); |
| 1979 | CX("try{\n%b}\n" |
| 1980 | "catch(e){" |
| 1981 |
+1
-1
| --- src/forum.c | ||
| +++ src/forum.c | ||
| @@ -887,11 +887,11 @@ | ||
| 887 | 887 | }else{ |
| 888 | 888 | style_submenu_element("Chronological", "%R/%s/%s?t=c", g.zPath, zName); |
| 889 | 889 | style_submenu_element("Unformatted", "%R/%s/%s?t=r", g.zPath, zName); |
| 890 | 890 | forum_display_hierarchical(froot, fpid); |
| 891 | 891 | } |
| 892 | - style_emit_script_builtin(0, 0, ":forum.js"); | |
| 892 | + style_emit_script_bundle("forum.js"); | |
| 893 | 893 | style_footer(); |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | 896 | /* |
| 897 | 897 | ** Return true if a forum post should be moderated. |
| 898 | 898 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -887,11 +887,11 @@ | |
| 887 | }else{ |
| 888 | style_submenu_element("Chronological", "%R/%s/%s?t=c", g.zPath, zName); |
| 889 | style_submenu_element("Unformatted", "%R/%s/%s?t=r", g.zPath, zName); |
| 890 | forum_display_hierarchical(froot, fpid); |
| 891 | } |
| 892 | style_emit_script_builtin(0, 0, ":forum.js"); |
| 893 | style_footer(); |
| 894 | } |
| 895 | |
| 896 | /* |
| 897 | ** Return true if a forum post should be moderated. |
| 898 |
| --- src/forum.c | |
| +++ src/forum.c | |
| @@ -887,11 +887,11 @@ | |
| 887 | }else{ |
| 888 | style_submenu_element("Chronological", "%R/%s/%s?t=c", g.zPath, zName); |
| 889 | style_submenu_element("Unformatted", "%R/%s/%s?t=r", g.zPath, zName); |
| 890 | forum_display_hierarchical(froot, fpid); |
| 891 | } |
| 892 | style_emit_script_bundle("forum.js"); |
| 893 | style_footer(); |
| 894 | } |
| 895 | |
| 896 | /* |
| 897 | ** Return true if a forum post should be moderated. |
| 898 |
+13
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -1719,10 +1719,23 @@ | ||
| 1719 | 1719 | CX("<script src='%R/%T?cache=%.8s'></script>\n", |
| 1720 | 1720 | zFullName, zHash); |
| 1721 | 1721 | fossil_free(zFullName); |
| 1722 | 1722 | } |
| 1723 | 1723 | } |
| 1724 | + | |
| 1725 | +/* | |
| 1726 | +** A convenience wrapper arond style_emit_script_builtin() which | |
| 1727 | +** prepends a ':' to zName and passes (0,0,newName) to that | |
| 1728 | +** function. i.e. it emits a SCRIPT tag with | |
| 1729 | +** src=.../builtin/:${zName}?cache=.... The given name is assumed to | |
| 1730 | +** have been added to the style.c:BundleEmitters map. | |
| 1731 | +*/ | |
| 1732 | +void style_emit_script_bundle(char const * zName){ | |
| 1733 | + char *zBundle = mprintf(":%s", zName); | |
| 1734 | + style_emit_script_builtin(0, 0, zBundle); | |
| 1735 | + fossil_free(zBundle); | |
| 1736 | +} | |
| 1724 | 1737 | |
| 1725 | 1738 | /* |
| 1726 | 1739 | ** The first time this is called it emits the JS code from the |
| 1727 | 1740 | ** built-in file fossil.fossil.js. Subsequent calls are no-ops. |
| 1728 | 1741 | ** |
| 1729 | 1742 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1719,10 +1719,23 @@ | |
| 1719 | CX("<script src='%R/%T?cache=%.8s'></script>\n", |
| 1720 | zFullName, zHash); |
| 1721 | fossil_free(zFullName); |
| 1722 | } |
| 1723 | } |
| 1724 | |
| 1725 | /* |
| 1726 | ** The first time this is called it emits the JS code from the |
| 1727 | ** built-in file fossil.fossil.js. Subsequent calls are no-ops. |
| 1728 | ** |
| 1729 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -1719,10 +1719,23 @@ | |
| 1719 | CX("<script src='%R/%T?cache=%.8s'></script>\n", |
| 1720 | zFullName, zHash); |
| 1721 | fossil_free(zFullName); |
| 1722 | } |
| 1723 | } |
| 1724 | |
| 1725 | /* |
| 1726 | ** A convenience wrapper arond style_emit_script_builtin() which |
| 1727 | ** prepends a ':' to zName and passes (0,0,newName) to that |
| 1728 | ** function. i.e. it emits a SCRIPT tag with |
| 1729 | ** src=.../builtin/:${zName}?cache=.... The given name is assumed to |
| 1730 | ** have been added to the style.c:BundleEmitters map. |
| 1731 | */ |
| 1732 | void style_emit_script_bundle(char const * zName){ |
| 1733 | char *zBundle = mprintf(":%s", zName); |
| 1734 | style_emit_script_builtin(0, 0, zBundle); |
| 1735 | fossil_free(zBundle); |
| 1736 | } |
| 1737 | |
| 1738 | /* |
| 1739 | ** The first time this is called it emits the JS code from the |
| 1740 | ** built-in file fossil.fossil.js. Subsequent calls are no-ops. |
| 1741 | ** |
| 1742 |
+1
-1
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -1259,11 +1259,11 @@ | ||
| 1259 | 1259 | CX("<hr><h3>Wiki Name Rules</h3>"); |
| 1260 | 1260 | well_formed_wiki_name_rules(); |
| 1261 | 1261 | CX("</div>"/*#wikiedit-tab-save*/); |
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | - style_emit_script_builtin(0, 0, ":wikiedit.js"); | |
| 1264 | + style_emit_script_bundle("wikiedit.js"); | |
| 1265 | 1265 | |
| 1266 | 1266 | /* Dynamically populate the editor... */ |
| 1267 | 1267 | style_emit_script_tag(0,0); |
| 1268 | 1268 | CX("\nfossil.onPageLoad(function(){\n"); |
| 1269 | 1269 | CX("const P = fossil.page;\n" |
| 1270 | 1270 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1259,11 +1259,11 @@ | |
| 1259 | CX("<hr><h3>Wiki Name Rules</h3>"); |
| 1260 | well_formed_wiki_name_rules(); |
| 1261 | CX("</div>"/*#wikiedit-tab-save*/); |
| 1262 | } |
| 1263 | |
| 1264 | style_emit_script_builtin(0, 0, ":wikiedit.js"); |
| 1265 | |
| 1266 | /* Dynamically populate the editor... */ |
| 1267 | style_emit_script_tag(0,0); |
| 1268 | CX("\nfossil.onPageLoad(function(){\n"); |
| 1269 | CX("const P = fossil.page;\n" |
| 1270 |
| --- src/wiki.c | |
| +++ src/wiki.c | |
| @@ -1259,11 +1259,11 @@ | |
| 1259 | CX("<hr><h3>Wiki Name Rules</h3>"); |
| 1260 | well_formed_wiki_name_rules(); |
| 1261 | CX("</div>"/*#wikiedit-tab-save*/); |
| 1262 | } |
| 1263 | |
| 1264 | style_emit_script_bundle("wikiedit.js"); |
| 1265 | |
| 1266 | /* Dynamically populate the editor... */ |
| 1267 | style_emit_script_tag(0,0); |
| 1268 | CX("\nfossil.onPageLoad(function(){\n"); |
| 1269 | CX("const P = fossil.page;\n" |
| 1270 |