Fossil SCM
/setup_skinedit, when editing CSS, now shows the list of built-in CSS selectors, as mentioned in [https://fossil-scm.org/forum/forumpost/b2d7ce8ab1|/forumpost/b2d7ce8ab1].
Commit
fd138236c9418cd9f38dc00ffa5cf911336e8f4651fef98187e4436b71dbccfb
Parent
483ac3db837246c…
2 files changed
+19
+54
+19
| --- src/default_css.txt | ||
| +++ src/default_css.txt | ||
| @@ -841,5 +841,24 @@ | ||
| 841 | 841 | } |
| 842 | 842 | .accordion_panel { |
| 843 | 843 | overflow: hidden; |
| 844 | 844 | transition: max-height 0.25s ease-out; |
| 845 | 845 | } |
| 846 | +#setup_skinedit_css_defaults { | |
| 847 | + max-width: 98%; | |
| 848 | + font-family: monospace; | |
| 849 | +// These are for the UL-based implementation: | |
| 850 | + column-width: auto; | |
| 851 | + column-count: 2; | |
| 852 | + padding-top: 1em; | |
| 853 | +} | |
| 854 | +// These are for the alternate table-based skinedit CSS list: | |
| 855 | +// #setup_skinedit_css_defaults > tbody > tr > td { | |
| 856 | +// font-family: monospace; | |
| 857 | +// white-space: pre-wrap; | |
| 858 | +// border: 1px solid black; | |
| 859 | +// vertical-align: top; | |
| 860 | +// } | |
| 861 | +// #setup_skinedit_css_defaults > tbody > tr > td:nth-of-type(2) > div { | |
| 862 | +// max-width: 30em; | |
| 863 | +// overflow: auto; | |
| 864 | +// } | |
| 846 | 865 |
| --- src/default_css.txt | |
| +++ src/default_css.txt | |
| @@ -841,5 +841,24 @@ | |
| 841 | } |
| 842 | .accordion_panel { |
| 843 | overflow: hidden; |
| 844 | transition: max-height 0.25s ease-out; |
| 845 | } |
| 846 |
| --- src/default_css.txt | |
| +++ src/default_css.txt | |
| @@ -841,5 +841,24 @@ | |
| 841 | } |
| 842 | .accordion_panel { |
| 843 | overflow: hidden; |
| 844 | transition: max-height 0.25s ease-out; |
| 845 | } |
| 846 | #setup_skinedit_css_defaults { |
| 847 | max-width: 98%; |
| 848 | font-family: monospace; |
| 849 | // These are for the UL-based implementation: |
| 850 | column-width: auto; |
| 851 | column-count: 2; |
| 852 | padding-top: 1em; |
| 853 | } |
| 854 | // These are for the alternate table-based skinedit CSS list: |
| 855 | // #setup_skinedit_css_defaults > tbody > tr > td { |
| 856 | // font-family: monospace; |
| 857 | // white-space: pre-wrap; |
| 858 | // border: 1px solid black; |
| 859 | // vertical-align: top; |
| 860 | // } |
| 861 | // #setup_skinedit_css_defaults > tbody > tr > td:nth-of-type(2) > div { |
| 862 | // max-width: 30em; |
| 863 | // overflow: auto; |
| 864 | // } |
| 865 |
+54
| --- src/skins.c | ||
| +++ src/skins.c | ||
| @@ -688,10 +688,61 @@ | ||
| 688 | 688 | } |
| 689 | 689 | } |
| 690 | 690 | return zResult; |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | +extern const struct strctCssDefaults { | |
| 694 | +/* From the generated default_css.h, which we cannot #include here | |
| 695 | +** without causing an ODR violation. | |
| 696 | +*/ | |
| 697 | + const char *elementClass; /* Name of element needed */ | |
| 698 | + const char *value; /* CSS text */ | |
| 699 | +} cssDefaultList[]; | |
| 700 | + | |
| 701 | +/* | |
| 702 | +** Emits the list of built-in default CSS selectors. Intended | |
| 703 | +** for use only from the /setup_skinedit page. | |
| 704 | +*/ | |
| 705 | +static void skin_emit_css_defaults(){ | |
| 706 | + struct strctCssDefaults const * pCss; | |
| 707 | + fossil_print("<h1>CSS Defaults</h1>"); | |
| 708 | + fossil_print("If a skin defines any of the following CSS selectors, " | |
| 709 | + "that definition replaces the default, as opposed to " | |
| 710 | + "cascading from it. "); | |
| 711 | + fossil_print("See <a href=\"%s/doc/trunk/www/css-tricks.md\">this " | |
| 712 | + "document</a> for more details.", g.zTop); | |
| 713 | + /* To discuss: do we want to list only the default selectors or | |
| 714 | + ** also their default values? The latter increases the size of the | |
| 715 | + ** page considerably, but is arguably more useful. We could, of | |
| 716 | + ** course, offer a URL param to toggle the view, but that currently | |
| 717 | + ** seems like overkill. | |
| 718 | + ** | |
| 719 | + ** Be sure to adjust the default_css.txt #setup_skinedit_css entry | |
| 720 | + ** for whichever impl ends up being selected. | |
| 721 | + */ | |
| 722 | +#if 1 | |
| 723 | + /* List impl which elides style values */ | |
| 724 | + fossil_print("<div class=\"columns\" " | |
| 725 | + "id=\"setup_skinedit_css_defaults\"><ul>"); | |
| 726 | + for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){ | |
| 727 | + fossil_print("<li>%s</li>", pCss->elementClass); | |
| 728 | + } | |
| 729 | + fossil_print("</ul>"); | |
| 730 | +#else | |
| 731 | + /* Table impl which also includes style values. */ | |
| 732 | + fossil_print("<table id=\"setup_skinedit_css_defaults\"><tbody>"); | |
| 733 | + for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){ | |
| 734 | + fossil_print("<tr><td>%s</td>", pCss->elementClass); | |
| 735 | + /* A TD element apparently cannot be told to scroll its contents, | |
| 736 | + ** so we require a DIV inside the value TD to scroll the long | |
| 737 | + ** url(data:...) entries. */ | |
| 738 | + fossil_print("<td><div>%s</div></td>", pCss->value); | |
| 739 | + fossil_print("</td></tr>"); | |
| 740 | + } | |
| 741 | + fossil_print("</tbody></table>"); | |
| 742 | +#endif | |
| 743 | +} | |
| 693 | 744 | |
| 694 | 745 | /* |
| 695 | 746 | ** WEBPAGE: setup_skinedit |
| 696 | 747 | ** |
| 697 | 748 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -814,10 +865,13 @@ | ||
| 814 | 865 | blob_reset(&from); |
| 815 | 866 | blob_reset(&to); |
| 816 | 867 | blob_reset(&out); |
| 817 | 868 | } |
| 818 | 869 | @ </div></form> |
| 870 | + if(ii==0/*CSS*/){ | |
| 871 | + skin_emit_css_defaults(); | |
| 872 | + } | |
| 819 | 873 | style_footer(); |
| 820 | 874 | db_end_transaction(0); |
| 821 | 875 | } |
| 822 | 876 | |
| 823 | 877 | /* |
| 824 | 878 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -688,10 +688,61 @@ | |
| 688 | } |
| 689 | } |
| 690 | return zResult; |
| 691 | } |
| 692 | |
| 693 | |
| 694 | /* |
| 695 | ** WEBPAGE: setup_skinedit |
| 696 | ** |
| 697 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -814,10 +865,13 @@ | |
| 814 | blob_reset(&from); |
| 815 | blob_reset(&to); |
| 816 | blob_reset(&out); |
| 817 | } |
| 818 | @ </div></form> |
| 819 | style_footer(); |
| 820 | db_end_transaction(0); |
| 821 | } |
| 822 | |
| 823 | /* |
| 824 |
| --- src/skins.c | |
| +++ src/skins.c | |
| @@ -688,10 +688,61 @@ | |
| 688 | } |
| 689 | } |
| 690 | return zResult; |
| 691 | } |
| 692 | |
| 693 | extern const struct strctCssDefaults { |
| 694 | /* From the generated default_css.h, which we cannot #include here |
| 695 | ** without causing an ODR violation. |
| 696 | */ |
| 697 | const char *elementClass; /* Name of element needed */ |
| 698 | const char *value; /* CSS text */ |
| 699 | } cssDefaultList[]; |
| 700 | |
| 701 | /* |
| 702 | ** Emits the list of built-in default CSS selectors. Intended |
| 703 | ** for use only from the /setup_skinedit page. |
| 704 | */ |
| 705 | static void skin_emit_css_defaults(){ |
| 706 | struct strctCssDefaults const * pCss; |
| 707 | fossil_print("<h1>CSS Defaults</h1>"); |
| 708 | fossil_print("If a skin defines any of the following CSS selectors, " |
| 709 | "that definition replaces the default, as opposed to " |
| 710 | "cascading from it. "); |
| 711 | fossil_print("See <a href=\"%s/doc/trunk/www/css-tricks.md\">this " |
| 712 | "document</a> for more details.", g.zTop); |
| 713 | /* To discuss: do we want to list only the default selectors or |
| 714 | ** also their default values? The latter increases the size of the |
| 715 | ** page considerably, but is arguably more useful. We could, of |
| 716 | ** course, offer a URL param to toggle the view, but that currently |
| 717 | ** seems like overkill. |
| 718 | ** |
| 719 | ** Be sure to adjust the default_css.txt #setup_skinedit_css entry |
| 720 | ** for whichever impl ends up being selected. |
| 721 | */ |
| 722 | #if 1 |
| 723 | /* List impl which elides style values */ |
| 724 | fossil_print("<div class=\"columns\" " |
| 725 | "id=\"setup_skinedit_css_defaults\"><ul>"); |
| 726 | for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){ |
| 727 | fossil_print("<li>%s</li>", pCss->elementClass); |
| 728 | } |
| 729 | fossil_print("</ul>"); |
| 730 | #else |
| 731 | /* Table impl which also includes style values. */ |
| 732 | fossil_print("<table id=\"setup_skinedit_css_defaults\"><tbody>"); |
| 733 | for(pCss = &cssDefaultList[0]; pCss->value!=0; ++pCss){ |
| 734 | fossil_print("<tr><td>%s</td>", pCss->elementClass); |
| 735 | /* A TD element apparently cannot be told to scroll its contents, |
| 736 | ** so we require a DIV inside the value TD to scroll the long |
| 737 | ** url(data:...) entries. */ |
| 738 | fossil_print("<td><div>%s</div></td>", pCss->value); |
| 739 | fossil_print("</td></tr>"); |
| 740 | } |
| 741 | fossil_print("</tbody></table>"); |
| 742 | #endif |
| 743 | } |
| 744 | |
| 745 | /* |
| 746 | ** WEBPAGE: setup_skinedit |
| 747 | ** |
| 748 | ** Edit aspects of a skin determined by the w= query parameter. |
| @@ -814,10 +865,13 @@ | |
| 865 | blob_reset(&from); |
| 866 | blob_reset(&to); |
| 867 | blob_reset(&out); |
| 868 | } |
| 869 | @ </div></form> |
| 870 | if(ii==0/*CSS*/){ |
| 871 | skin_emit_css_defaults(); |
| 872 | } |
| 873 | style_footer(); |
| 874 | db_end_transaction(0); |
| 875 | } |
| 876 | |
| 877 | /* |
| 878 |