From 22f0771fa2ff627475d2ead89fbba6c5a16f3c1d Mon Sep 17 00:00:00 2001 From: Joan Josep Ordinas Rosa Date: Wed, 7 Sep 2016 18:47:45 +0200 Subject: [PATCH] New CSS preprocessor --- .gitignore | 4 - Makefile | 7 +- bin/jqt | 17 +- docs/content/content.md | 3 +- docs/content/data.md | 3 +- docs/content/engine.md | 41 ++-- docs/content/structure.md | 3 +- docs/styles/csscolors.m | 297 +++++++++++++------------- docs/styles/github.css | 4 +- docs/styles/jqt.css | 10 +- tests/expand/expected/mpcss-01.css | 8 + tests/expand/expected/mpcss-02.css | 8 + tests/expand/expected/mpcss-03.css | 29 +++ tests/expand/expected/mpcss-04.css | 12 ++ tests/expand/expected/mpcss-05.css | 18 ++ tests/expand/expected/mpcss-06.css | 9 + tests/expand/generated/.gitignore | 5 + tests/expand/generated/mpjqt-00.jqt | 1 - tests/expand/generated/mpjqt-01.jqt | 1 - tests/expand/generated/mpjqt-02.jqt | 2 - tests/expand/generated/mpjqt-03.jqt | 1 - tests/expand/generated/mpjqt-04.jqt | 1 - tests/expand/generated/mpjqt-05.jqt | 4 - tests/expand/generated/mpjqt-06.jqt | 14 -- tests/expand/generated/mpjqt-07.jqt | 5 - tests/expand/generated/mpjqt-08.jqt | 12 -- tests/expand/generated/mpjqt-09.jqt | 6 - tests/expand/generated/mpjqt-10.jqt | 6 - tests/expand/generated/mpjqt-11.jqt | 6 - tests/expand/generated/mpjqt-12.jqt | 3 - tests/expand/generated/mpjson-01.json | 25 --- tests/expand/generated/mpjson-02.json | 26 --- tests/expand/generated/mpjson-03.json | 9 - tests/expand/generated/mpjson-04.json | 9 - tests/expand/generated/mpjson-05.json | 26 --- tests/expand/generated/mpjson-06.json | 32 --- tests/expand/generated/mpjson-07.json | 24 --- tests/expand/generated/mpjson-08.json | 9 - tests/expand/generated/mpjson-09.json | 7 - tests/expand/generated/mpjson-10.json | 4 - tests/expand/generated/mpjson-11.json | 4 - tests/expand/generated/mpmd-01.md | 1 - tests/expand/generated/mpmd-02.md | 1 - tests/expand/generated/mpmd-03.md | 2 - tests/expand/generated/mpmd-04.md | 1 - tests/expand/generated/mpmd-05.md | 1 - tests/expand/generated/mpmd-06.md | 4 - tests/expand/generated/mpmd-07.md | 14 -- tests/expand/generated/mpmd-08.md | 5 - tests/expand/generated/mpmd-09.md | 12 -- tests/expand/generated/mpmd-10.md | 6 - tests/expand/generated/mpmd-11.md | 6 - tests/expand/generated/mpmd-12.md | 6 - tests/expand/generated/mpmd-13.md | 3 - tests/expand/generated/mpmd-14.md | 5 - tests/expand/generated/mpmd-15.md | 5 - tests/expand/mpcss-01.css | 8 + tests/expand/mpcss-02.css | 8 + tests/expand/mpcss-03.css | 24 +++ tests/expand/mpcss-04.css | 11 + tests/expand/mpcss-05.css | 18 ++ tests/expand/mpcss-06.css | 12 ++ 62 files changed, 365 insertions(+), 503 deletions(-) create mode 100644 tests/expand/expected/mpcss-01.css create mode 100644 tests/expand/expected/mpcss-02.css create mode 100644 tests/expand/expected/mpcss-03.css create mode 100644 tests/expand/expected/mpcss-04.css create mode 100644 tests/expand/expected/mpcss-05.css create mode 100644 tests/expand/expected/mpcss-06.css create mode 100644 tests/expand/generated/.gitignore delete mode 100644 tests/expand/generated/mpjqt-00.jqt delete mode 100644 tests/expand/generated/mpjqt-01.jqt delete mode 100644 tests/expand/generated/mpjqt-02.jqt delete mode 100644 tests/expand/generated/mpjqt-03.jqt delete mode 100644 tests/expand/generated/mpjqt-04.jqt delete mode 100644 tests/expand/generated/mpjqt-05.jqt delete mode 100644 tests/expand/generated/mpjqt-06.jqt delete mode 100644 tests/expand/generated/mpjqt-07.jqt delete mode 100644 tests/expand/generated/mpjqt-08.jqt delete mode 100644 tests/expand/generated/mpjqt-09.jqt delete mode 100644 tests/expand/generated/mpjqt-10.jqt delete mode 100644 tests/expand/generated/mpjqt-11.jqt delete mode 100644 tests/expand/generated/mpjqt-12.jqt delete mode 100644 tests/expand/generated/mpjson-01.json delete mode 100644 tests/expand/generated/mpjson-02.json delete mode 100644 tests/expand/generated/mpjson-03.json delete mode 100644 tests/expand/generated/mpjson-04.json delete mode 100644 tests/expand/generated/mpjson-05.json delete mode 100644 tests/expand/generated/mpjson-06.json delete mode 100644 tests/expand/generated/mpjson-07.json delete mode 100644 tests/expand/generated/mpjson-08.json delete mode 100644 tests/expand/generated/mpjson-09.json delete mode 100644 tests/expand/generated/mpjson-10.json delete mode 100644 tests/expand/generated/mpjson-11.json delete mode 100644 tests/expand/generated/mpmd-01.md delete mode 100644 tests/expand/generated/mpmd-02.md delete mode 100644 tests/expand/generated/mpmd-03.md delete mode 100644 tests/expand/generated/mpmd-04.md delete mode 100644 tests/expand/generated/mpmd-05.md delete mode 100644 tests/expand/generated/mpmd-06.md delete mode 100644 tests/expand/generated/mpmd-07.md delete mode 100644 tests/expand/generated/mpmd-08.md delete mode 100644 tests/expand/generated/mpmd-09.md delete mode 100644 tests/expand/generated/mpmd-10.md delete mode 100644 tests/expand/generated/mpmd-11.md delete mode 100644 tests/expand/generated/mpmd-12.md delete mode 100644 tests/expand/generated/mpmd-13.md delete mode 100644 tests/expand/generated/mpmd-14.md delete mode 100644 tests/expand/generated/mpmd-15.md create mode 100644 tests/expand/mpcss-01.css create mode 100644 tests/expand/mpcss-02.css create mode 100644 tests/expand/mpcss-03.css create mode 100644 tests/expand/mpcss-04.css create mode 100644 tests/expand/mpcss-05.css create mode 100644 tests/expand/mpcss-06.css diff --git a/.gitignore b/.gitignore index fc30d75..e14723c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ # cache /docs/.yummy -# output of templates expansion -tests/generated/*.jqe -tests/generated/*.jqs -tests/generated/*.txt # man pages jqt.1.gz diff --git a/Makefile b/Makefile index 8875ff3..e166a83 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ all: check .PHONY: clean clobber install uninstall clean: - rm -f tests/generated/* jqt.1.gz + rm -f tests/*/generated/* jqt.1.gz clobber: clean @@ -166,8 +166,8 @@ $(eval $(call TestJQT,syntax)) # # Test macro expansion # -.PHONY: test-expand test-mpjqt -test-expand: test-mpjqt test-mpmd test-mpjson +.PHONY: test-expand test-mpjqt test-mpmd test-mpjson test-mpcss +test-expand: test-mpjqt test-mpmd test-mpjson test-mpcss define TestMacroExpand # Run one example @@ -184,6 +184,7 @@ endef $(eval $(call TestMacroExpand,jqt,mpjqt)) $(eval $(call TestMacroExpand,md,mpmd)) $(eval $(call TestMacroExpand,json,mpjson)) +$(eval $(call TestMacroExpand,css,mpcss)) # # Test file format conversions diff --git a/bin/jqt b/bin/jqt index 108bd53..9f7c9a9 100755 --- a/bin/jqt +++ b/bin/jqt @@ -203,16 +203,15 @@ function expand_json function expand_css { local -r minify=$1 - local -r -a user=( -U '' '' '(\W' ',\W' ')' '(' ')' '$' '' ) - local -r -a meta=( -M '\n&' '\n' '\b' '\b' '\n' '(' ')' ) + local -r -a user=( -U '&' '' '{\W' '}{\W' '}' '{' '}' '&' '' ) + local -r -a meta=( -M '&' '' '{\W' '}{\W' '}' '{' '}' ) local -r -a skips=( +cccc '&\n' '' # continuation line (& and \n removed) - +cccc '\\n' '' # continuation line (\ and \n removed) - +cccc '/*' '*/' # multiline comment +cccc '//' '\n' # line comment + # multiline comment: see below +sqqq '`' '`' '\' # literal string; like sh single quotes - +ssss '"' '"' '\' # CSS string - +ssss "'" "'" '\' # CSS string + +sSSS '"' '"' '\' # CSS string + +sSSS "'" "'" '\' # CSS string ) local -r -a gpp_opts=( --nostdinc @@ -224,10 +223,12 @@ function expand_css "${DEFINE[@]}" ) if [[ $minify == 'min' ]]; then - gpp "${gpp_opts[@]}" \ + # +cccc '/*' '*/' # removed multiline comment + gpp "${gpp_opts[@]}" +cccc '/*' '*/' \ | sed 's/^[ \t]\+//;s/[ \t]$//;/^$/d;s/[\t ]*\([{}:,;>+~]\)[\t ]*/\1/g' else - gpp "${gpp_opts[@]}" + # +cSSS '/*' '*/' # expanded multiline comment + gpp "${gpp_opts[@]}" +sSSS '/*' '*/' '' fi echo # always generate almost one line!!! } diff --git a/docs/content/content.md b/docs/content/content.md index 50950ac..e7a1c0f 100644 --- a/docs/content/content.md +++ b/docs/content/content.md @@ -104,7 +104,8 @@ the character `>`. The more common predefined macros have this syntax: <%undef x> ``` -Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.): +Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.), +but named arguments are also possible: ``` <%define sc diff --git a/docs/content/data.md b/docs/content/data.md index 1f036a7..36216ae 100644 --- a/docs/content/data.md +++ b/docs/content/data.md @@ -82,7 +82,8 @@ The more common predefined macros have this syntax: <%undef x> ``` -Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.): +Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.), +but named arguments are also possible: ``` <%define euro \u20AC> diff --git a/docs/content/engine.md b/docs/content/engine.md index 43ff105..ba79b5f 100644 --- a/docs/content/engine.md +++ b/docs/content/engine.md @@ -129,32 +129,33 @@ The CSS minimization is not extremely aggressive, but is safe and sufficient. #### Macro calls The macro syntax used by _jqt_ in CSS files is very similar to the syntax used by the traditional -preprocessing of C and C++ languages, but changing the prefix character `#` by +TeX language macro processor, but changing the prefix character `\\` by `&`. The more common predefined macros have this syntax: ``` -&defeval x y -&define x y -&elif expr +&defeval{x}{y} +&define{x}{y} +&elif{expr} &else &endif -&eval expr -&if expr -&ifdef x -&ifeq x y -&ifndef x -&ifneq x y -&include file -&undef x +&eval{expr} +&if{expr} +&ifdef{x} +&ifeq{x}{y} +&ifndef{x} +&ifneq{x}{y} +&include{file} +&undef{x} ``` -Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.). +Inside macro definitions argument references are prefixed by an ampersand (`&1`, `&2`, etc.), +but named arguments are also possible. The more used features are the inclusion on external files and the definition of simple constants: ``` -&include theme.css -&define Blue #0000FF +&include{theme.css} +&define{Blue}{#0000FF} { color: &Blue; } ``` @@ -177,19 +178,17 @@ This table summarizes all the available skips in CSS files: Delimiters Macro expansion Delimiters removed Content removed ------------- --------------- ------------------ --------------- `&\n`[^1] No Yes There is no content -`\\n`[^2] No Yes There is no content -`/*` `*/` No Yes Yes +`/*` `*/`[^2] Yes/No No/Yes No/Yes `//` `\n`[^3] No Yes Yes `` ` `` `` ` `` No Yes No -`"` `"` No No No -`'` `'` No No No +`"` `"` Yes No No +`'` `'` Yes No No Table: **Semantics for all CSS skips** [^1]: An ampersand followed by a newline is treated as a line continuation (that is, the ampersand and the newline are removed and effectively ignored). -[^2]: A backslash followed by a newline is treated as a line continuation (that -is, the backslash and the newline are removed and effectively ignored). +[^2]: Multiline comments are expanded and preserved when not minifying CSS. [^3]: This represents a newline character. <# diff --git a/docs/content/structure.md b/docs/content/structure.md index e8a9b9c..3ec78e3 100644 --- a/docs/content/structure.md +++ b/docs/content/structure.md @@ -71,7 +71,8 @@ The more common predefined macros have this syntax: <%undef x> ``` -Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.): +Inside macro definitions argument references are prefixed by a dollar (`$1`, `$2`, etc.), +but named arguments are also possible: ``` <%define stylesheet diff --git a/docs/styles/csscolors.m b/docs/styles/csscolors.m index 703205b..4e581b6 100644 --- a/docs/styles/csscolors.m +++ b/docs/styles/csscolors.m @@ -1,148 +1,149 @@ -&define Black #000000 -&define Navy #000080 -&define DarkBlue #00008B -&define MediumBlue #0000CD -&define Blue #0000FF -&define DarkGreen #006400 -&define Green #008000 -&define Teal #008080 -&define DarkCyan #008B8B -&define DeepSkyBlue #00BFFF -&define DarkTurquoise #00CED1 -&define MediumSpringGreen #00FA9A -&define Lime #00FF00 -&define SpringGreen #00FF7F -&define Aqua #00FFFF -&define Cyan #00FFFF -&define MidnightBlue #191970 -&define DodgerBlue #1E90FF -&define LightSeaGreen #20B2AA -&define ForestGreen #228B22 -&define SeaGreen #2E8B57 -&define DarkSlateGray #2F4F4F -&define DarkSlateGrey #2F4F4F -&define LimeGreen #32CD32 -&define MediumSeaGreen #3CB371 -&define Turquoise #40E0D0 -&define RoyalBlue #4169E1 -&define SteelBlue #4682B4 -&define DarkSlateBlue #483D8B -&define MediumTurquoise #48D1CC -&define Indigo #4B0082 -&define DarkOliveGreen #556B2F -&define CadetBlue #5F9EA0 -&define CornflowerBlue #6495ED -&define RebeccaPurple #663399 -&define MediumAquaMarine #66CDAA -&define DimGray #696969 -&define DimGrey #696969 -&define SlateBlue #6A5ACD -&define OliveDrab #6B8E23 -&define SlateGray #708090 -&define SlateGrey #708090 -&define LightSlateGray #778899 -&define LightSlateGrey #778899 -&define MediumSlateBlue #7B68EE -&define LawnGreen #7CFC00 -&define Chartreuse #7FFF00 -&define Aquamarine #7FFFD4 -&define Maroon #800000 -&define Purple #800080 -&define Olive #808000 -&define Gray #808080 -&define Grey #808080 -&define SkyBlue #87CEEB -&define LightSkyBlue #87CEFA -&define BlueViolet #8A2BE2 -&define DarkRed #8B0000 -&define DarkMagenta #8B008B -&define SaddleBrown #8B4513 -&define DarkSeaGreen #8FBC8F -&define LightGreen #90EE90 -&define MediumPurple #9370DB -&define DarkViolet #9400D3 -&define PaleGreen #98FB98 -&define DarkOrchid #9932CC -&define YellowGreen #9ACD32 -&define Sienna #A0522D -&define Brown #A52A2A -&define DarkGray #A9A9A9 -&define DarkGrey #A9A9A9 -&define LightBlue #ADD8E6 -&define GreenYellow #ADFF2F -&define PaleTurquoise #AFEEEE -&define LightSteelBlue #B0C4DE -&define PowderBlue #B0E0E6 -&define FireBrick #B22222 -&define DarkGoldenRod #B8860B -&define MediumOrchid #BA55D3 -&define RosyBrown #BC8F8F -&define DarkKhaki #BDB76B -&define Silver #C0C0C0 -&define MediumVioletRed #C71585 -&define IndianRed #CD5C5C -&define Peru #CD853F -&define Chocolate #D2691E -&define Tan #D2B48C -&define LightGray #D3D3D3 -&define LightGrey #D3D3D3 -&define Thistle #D8BFD8 -&define Orchid #DA70D6 -&define GoldenRod #DAA520 -&define PaleVioletRed #DB7093 -&define Crimson #DC143C -&define Gainsboro #DCDCDC -&define Plum #DDA0DD -&define BurlyWood #DEB887 -&define LightCyan #E0FFFF -&define Lavender #E6E6FA -&define DarkSalmon #E9967A -&define Violet #EE82EE -&define PaleGoldenRod #EEE8AA -&define LightCoral #F08080 -&define Khaki #F0E68C -&define AliceBlue #F0F8FF -&define HoneyDew #F0FFF0 -&define Azure #F0FFFF -&define SandyBrown #F4A460 -&define Wheat #F5DEB3 -&define Beige #F5F5DC -&define WhiteSmoke #F5F5F5 -&define MintCream #F5FFFA -&define GhostWhite #F8F8FF -&define Salmon #FA8072 -&define AntiqueWhite #FAEBD7 -&define Linen #FAF0E6 -&define LightGoldenRodYellow #FAFAD2 -&define OldLace #FDF5E6 -&define Red #FF0000 -&define Fuchsia #FF00FF -&define Magenta #FF00FF -&define DeepPink #FF1493 -&define OrangeRed #FF4500 -&define Tomato #FF6347 -&define HotPink #FF69B4 -&define Coral #FF7F50 -&define DarkOrange #FF8C00 -&define LightSalmon #FFA07A -&define Orange #FFA500 -&define LightPink #FFB6C1 -&define Pink #FFC0CB -&define Gold #FFD700 -&define PeachPuff #FFDAB9 -&define NavajoWhite #FFDEAD -&define Moccasin #FFE4B5 -&define Bisque #FFE4C4 -&define MistyRose #FFE4E1 -&define BlanchedAlmond #FFEBCD -&define PapayaWhip #FFEFD5 -&define LavenderBlush #FFF0F5 -&define SeaShell #FFF5EE -&define Cornsilk #FFF8DC -&define LemonChiffon #FFFACD -&define FloralWhite #FFFAF0 -&define Snow #FFFAFA -&define Yellow #FFFF00 -&define LightYellow #FFFFE0 -&define Ivory #FFFFF0 -&define White #FFFFFF +&define{Black}{#000000} +&define{Navy}{#000080} +&define{DarkBlue}{#00008B} +&define{MediumBlue}{#0000CD} +&define{Blue}{#0000FF} +&define{DarkGreen}{#006400} +&define{Green}{#008000} +&define{Teal}{#008080} +&define{DarkCyan}{#008B8B} +&define{DeepSkyBlue}{#00BFFF} +&define{DarkTurquoise}{#00CED1} +&define{MediumSpringGreen}{#00FA9A} +&define{Lime}{#00FF00} +&define{SpringGreen}{#00FF7F} +&define{Aqua}{#00FFFF} +&define{Cyan}{#00FFFF} +&define{MidnightBlue}{#191970} +&define{DodgerBlue}{#1E90FF} +&define{LightSeaGreen}{#20B2AA} +&define{ForestGreen}{#228B22} +&define{SeaGreen}{#2E8B57} +&define{DarkSlateGray}{#2F4F4F} +&define{DarkSlateGrey}{#2F4F4F} +&define{LimeGreen}{#32CD32} +&define{MediumSeaGreen}{#3CB371} +&define{Turquoise}{#40E0D0} +&define{RoyalBlue}{#4169E1} +&define{SteelBlue}{#4682B4} +&define{DarkSlateBlue}{#483D8B} +&define{MediumTurquoise}{#48D1CC} +&define{Indigo}{#4B0082} +&define{DarkOliveGreen}{#556B2F} +&define{CadetBlue}{#5F9EA0} +&define{CornflowerBlue}{#6495ED} +&define{RebeccaPurple}{#663399} +&define{MediumAquaMarine}{#66CDAA} +&define{DimGray}{#696969} +&define{DimGrey}{#696969} +&define{SlateBlue}{#6A5ACD} +&define{OliveDrab}{#6B8E23} +&define{SlateGray}{#708090} +&define{SlateGrey}{#708090} +&define{LightSlateGray}{#778899} +&define{LightSlateGrey}{#778899} +&define{MediumSlateBlue}{#7B68EE} +&define{LawnGreen}{#7CFC00} +&define{Chartreuse}{#7FFF00} +&define{Aquamarine}{#7FFFD4} +&define{Maroon}{#800000} +&define{Purple}{#800080} +&define{Olive}{#808000} +&define{Gray}{#808080} +&define{Grey}{#808080} +&define{SkyBlue}{#87CEEB} +&define{LightSkyBlue}{#87CEFA} +&define{BlueViolet}{#8A2BE2} +&define{DarkRed}{#8B0000} +&define{DarkMagenta}{#8B008B} +&define{SaddleBrown}{#8B4513} +&define{DarkSeaGreen}{#8FBC8F} +&define{LightGreen}{#90EE90} +&define{MediumPurple}{#9370DB} +&define{DarkViolet}{#9400D3} +&define{PaleGreen}{#98FB98} +&define{DarkOrchid}{#9932CC} +&define{YellowGreen}{#9ACD32} +&define{Sienna}{#A0522D} +&define{Brown}{#A52A2A} +&define{DarkGray}{#A9A9A9} +&define{DarkGrey}{#A9A9A9} +&define{LightBlue}{#ADD8E6} +&define{GreenYellow}{#ADFF2F} +&define{PaleTurquoise}{#AFEEEE} +&define{LightSteelBlue}{#B0C4DE} +&define{PowderBlue}{#B0E0E6} +&define{FireBrick}{#B22222} +&define{DarkGoldenRod}{#B8860B} +&define{MediumOrchid}{#BA55D3} +&define{RosyBrown}{#BC8F8F} +&define{DarkKhaki}{#BDB76B} +&define{Silver}{#C0C0C0} +&define{MediumVioletRed}{#C71585} +&define{IndianRed}{#CD5C5C} +&define{Peru}{#CD853F} +&define{Chocolate}{#D2691E} +&define{Tan}{#D2B48C} +&define{LightGray}{#D3D3D3} +&define{LightGrey}{#D3D3D3} +&define{Thistle}{#D8BFD8} +&define{Orchid}{#DA70D6} +&define{GoldenRod}{#DAA520} +&define{PaleVioletRed}{#DB7093} +&define{Crimson}{#DC143C} +&define{Gainsboro}{#DCDCDC} +&define{Plum}{#DDA0DD} +&define{BurlyWood}{#DEB887} +&define{LightCyan}{#E0FFFF} +&define{Lavender}{#E6E6FA} +&define{DarkSalmon}{#E9967A} +&define{Violet}{#EE82EE} +&define{PaleGoldenRod}{#EEE8AA} +&define{LightCoral}{#F08080} +&define{Khaki}{#F0E68C} +&define{AliceBlue}{#F0F8FF} +&define{HoneyDew}{#F0FFF0} +&define{Azure}{#F0FFFF} +&define{SandyBrown}{#F4A460} +&define{Wheat}{#F5DEB3} +&define{Beige}{#F5F5DC} +&define{WhiteSmoke}{#F5F5F5} +&define{MintCream}{#F5FFFA} +&define{GhostWhite}{#F8F8FF} +&define{Salmon}{#FA8072} +&define{AntiqueWhite}{#FAEBD7} +&define{Linen}{#FAF0E6} +&define{LightGoldenRodYellow}{#FAFAD2} +&define{OldLace}{#FDF5E6} +&define{Red}{#FF0000} +&define{Fuchsia}{#FF00FF} +&define{Magenta}{#FF00FF} +&define{DeepPink}{#FF1493} +&define{OrangeRed}{#FF4500} +&define{Tomato}{#FF6347} +&define{HotPink}{#FF69B4} +&define{Coral}{#FF7F50} +&define{DarkOrange}{#FF8C00} +&define{LightSalmon}{#FFA07A} +&define{Orange}{#FFA500} +&define{LightPink}{#FFB6C1} +&define{Pink}{#FFC0CB} +&define{Gold}{#FFD700} +&define{PeachPuff}{#FFDAB9} +&define{NavajoWhite}{#FFDEAD} +&define{Moccasin}{#FFE4B5} +&define{Bisque}{#FFE4C4} +&define{MistyRose}{#FFE4E1} +&define{BlanchedAlmond}{#FFEBCD} +&define{PapayaWhip}{#FFEFD5} +&define{LavenderBlush}{#FFF0F5} +&define{SeaShell}{#FFF5EE} +&define{Cornsilk}{#FFF8DC} +&define{LemonChiffon}{#FFFACD} +&define{FloralWhite}{#FFFAF0} +&define{Snow}{#FFFAFA} +&define{Yellow}{#FFFF00} +&define{LightYellow}{#FFFFE0} +&define{Ivory}{#FFFFF0} +&define{White}{#FFFFFF} +// vim:syntax=texfm diff --git a/docs/styles/github.css b/docs/styles/github.css index 69b47c4..a54ee29 100644 --- a/docs/styles/github.css +++ b/docs/styles/github.css @@ -41,7 +41,7 @@ pre code { } code { font-size:12px; - background-color:GhostWhite; + background-color:&GhostWhite; color:#444; padding:.3em .2em .0em; border:1px solid #dedede; @@ -77,7 +77,7 @@ dd{margin-left:2em;margin-bottom:1em;} pre code { display: block; padding: 0.5em; color: #333; - background: GhostWhite; + background: &GhostWhite; } pre .comment, diff --git a/docs/styles/jqt.css b/docs/styles/jqt.css index 3f09bbc..f00ae7e 100644 --- a/docs/styles/jqt.css +++ b/docs/styles/jqt.css @@ -2,10 +2,10 @@ * Web site styles **********************************************************************/ -&include "csscolors.m" +&include{csscolors.m} // GitHub style -&include "github.css" +&include{github.css} // // Menu bar @@ -34,7 +34,7 @@ font-weight: normal; font-size: 150%; text-decoration: none; - color: DarkCyan; + color: &DarkCyan; background-color: inherit; } @@ -54,12 +54,12 @@ #MENU a:hover { padding: 2px; - background-color: Gainsboro; + background-color: &Gainsboro; } #MENU a.current { padding: 2px; - background-color: Gainsboro; + background-color: &Gainsboro; } // diff --git a/tests/expand/expected/mpcss-01.css b/tests/expand/expected/mpcss-01.css new file mode 100644 index 0000000..9422de7 --- /dev/null +++ b/tests/expand/expected/mpcss-01.css @@ -0,0 +1,8 @@ + + + +body { + font: 100% Helvetica, sans_serif; + color: #333; +} + diff --git a/tests/expand/expected/mpcss-02.css b/tests/expand/expected/mpcss-02.css new file mode 100644 index 0000000..bd3ae5e --- /dev/null +++ b/tests/expand/expected/mpcss-02.css @@ -0,0 +1,8 @@ + + +.box { -webkit-border-radius: 10px; + -moz-border-radius: 10px; + -ms-border-radius: 10px; + border-radius: 10px; + } + diff --git a/tests/expand/expected/mpcss-03.css b/tests/expand/expected/mpcss-03.css new file mode 100644 index 0000000..06a6424 --- /dev/null +++ b/tests/expand/expected/mpcss-03.css @@ -0,0 +1,29 @@ + + +.message { + border: 1px solid #ccc; + padding: 10px; + color: #333; +} + +.success { + border: 1px solid #ccc; + padding: 10px; + color: #333; + border-color: green; +} + +.error { + border: 1px solid #ccc; + padding: 10px; + color: #333; + border-color: red; +} + +.warning { + border: 1px solid #ccc; + padding: 10px; + color: #333; + border-color: yellow; +} + diff --git a/tests/expand/expected/mpcss-04.css b/tests/expand/expected/mpcss-04.css new file mode 100644 index 0000000..c9236c4 --- /dev/null +++ b/tests/expand/expected/mpcss-04.css @@ -0,0 +1,12 @@ +.container { width: 100%; } + +article[role="main"] { + float: left; + width: 62%; +} + +aside[role="complementary"] { + float: right; + width: 31%; +} + diff --git a/tests/expand/expected/mpcss-05.css b/tests/expand/expected/mpcss-05.css new file mode 100644 index 0000000..2163f0b --- /dev/null +++ b/tests/expand/expected/mpcss-05.css @@ -0,0 +1,18 @@ + + +SEL { + a { + color: red; + } + a:visited { + color: green; + } + a:hover { + color: blue; + } + a:active { + color: yellow; + } + +} + diff --git a/tests/expand/expected/mpcss-06.css b/tests/expand/expected/mpcss-06.css new file mode 100644 index 0000000..d433453 --- /dev/null +++ b/tests/expand/expected/mpcss-06.css @@ -0,0 +1,9 @@ + + +div { + background-color: black; + color: white; + font-size: 12px; + font-style: italic; +} + diff --git a/tests/expand/generated/.gitignore b/tests/expand/generated/.gitignore new file mode 100644 index 0000000..39de8ab --- /dev/null +++ b/tests/expand/generated/.gitignore @@ -0,0 +1,5 @@ +*.md +*.css +*.jqt +*.md +*.json diff --git a/tests/expand/generated/mpjqt-00.jqt b/tests/expand/generated/mpjqt-00.jqt deleted file mode 100644 index 8b13789..0000000 --- a/tests/expand/generated/mpjqt-00.jqt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/expand/generated/mpjqt-01.jqt b/tests/expand/generated/mpjqt-01.jqt deleted file mode 100644 index 8b13789..0000000 --- a/tests/expand/generated/mpjqt-01.jqt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/expand/generated/mpjqt-02.jqt b/tests/expand/generated/mpjqt-02.jqt deleted file mode 100644 index 139597f..0000000 --- a/tests/expand/generated/mpjqt-02.jqt +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/expand/generated/mpjqt-03.jqt b/tests/expand/generated/mpjqt-03.jqt deleted file mode 100644 index 8b13789..0000000 --- a/tests/expand/generated/mpjqt-03.jqt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/expand/generated/mpjqt-04.jqt b/tests/expand/generated/mpjqt-04.jqt deleted file mode 100644 index 8b13789..0000000 --- a/tests/expand/generated/mpjqt-04.jqt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/expand/generated/mpjqt-05.jqt b/tests/expand/generated/mpjqt-05.jqt deleted file mode 100644 index 73112c2..0000000 --- a/tests/expand/generated/mpjqt-05.jqt +++ /dev/null @@ -1,4 +0,0 @@ -Title -Long Title -Long Title - diff --git a/tests/expand/generated/mpjqt-06.jqt b/tests/expand/generated/mpjqt-06.jqt deleted file mode 100644 index 51d6160..0000000 --- a/tests/expand/generated/mpjqt-06.jqt +++ /dev/null @@ -1,14 +0,0 @@ -ACA -AACAA -AACAA -AXDXA -BAXDXAB -APA -PYYP -PYYP -Q<%A C>R -A<%A X>A -BAX<%A X>XAB -Q<%R> -Q[<%A C>]R - diff --git a/tests/expand/generated/mpjqt-07.jqt b/tests/expand/generated/mpjqt-07.jqt deleted file mode 100644 index a624992..0000000 --- a/tests/expand/generated/mpjqt-07.jqt +++ /dev/null @@ -1,5 +0,0 @@ -{ - "json": "Give me 100\u20AC." -} - - diff --git a/tests/expand/generated/mpjqt-08.jqt b/tests/expand/generated/mpjqt-08.jqt deleted file mode 100644 index b1a48e6..0000000 --- a/tests/expand/generated/mpjqt-08.jqt +++ /dev/null @@ -1,12 +0,0 @@ -10... -9... -8... -7... -6... -5... -4... -3... -2... -1... -Done! - diff --git a/tests/expand/generated/mpjqt-09.jqt b/tests/expand/generated/mpjqt-09.jqt deleted file mode 100644 index b11cea9..0000000 --- a/tests/expand/generated/mpjqt-09.jqt +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/tests/expand/generated/mpjqt-10.jqt b/tests/expand/generated/mpjqt-10.jqt deleted file mode 100644 index b11cea9..0000000 --- a/tests/expand/generated/mpjqt-10.jqt +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/tests/expand/generated/mpjqt-11.jqt b/tests/expand/generated/mpjqt-11.jqt deleted file mode 100644 index b11cea9..0000000 --- a/tests/expand/generated/mpjqt-11.jqt +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/tests/expand/generated/mpjqt-12.jqt b/tests/expand/generated/mpjqt-12.jqt deleted file mode 100644 index b677f74..0000000 --- a/tests/expand/generated/mpjqt-12.jqt +++ /dev/null @@ -1,3 +0,0 @@ -Lorem Ipsum - - diff --git a/tests/expand/generated/mpjson-01.json b/tests/expand/generated/mpjson-01.json deleted file mode 100644 index 7f6e63d..0000000 --- a/tests/expand/generated/mpjson-01.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "firstName": "John", - "lastName": "Smith", - "age": 25, - "address": { - "streetAddress": "21 2nd Street", - "city": "New York", - "state": "NY", - "postalCode": "10021" - }, - "phoneNumber": [ - { - "type": "home", - "number": "212 555-1234" - }, - { - "type": "fax", - "number": "646 555-4567" - } - ], - "gender": { - "type": "male" - } -} - diff --git a/tests/expand/generated/mpjson-02.json b/tests/expand/generated/mpjson-02.json deleted file mode 100644 index e157f24..0000000 --- a/tests/expand/generated/mpjson-02.json +++ /dev/null @@ -1,26 +0,0 @@ - -{ - "firstName": "John", - "lastName": "Smith", - "age": 25, - "address": { - "streetAddress": "21 2nd Street", - "city": "New York", - "state": "NY", - "postalCode": "10021" - }, - "phoneNumber": [ - { - "type": "home", - "number": "212 555-1234" - }, - { - "type": "fax", - "number": "646 555-4567" - } - ], - "gender": { - "type": "male" - } -} - diff --git a/tests/expand/generated/mpjson-03.json b/tests/expand/generated/mpjson-03.json deleted file mode 100644 index 6f92569..0000000 --- a/tests/expand/generated/mpjson-03.json +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "line1": "// this is not a comment", - "line2": "this // is not a comment", - "line3": "this is not a comment //", - "str1": "this string has \" inside", - "str2": "this string has \n inside" -} - diff --git a/tests/expand/generated/mpjson-04.json b/tests/expand/generated/mpjson-04.json deleted file mode 100644 index 782e1b5..0000000 --- a/tests/expand/generated/mpjson-04.json +++ /dev/null @@ -1,9 +0,0 @@ - -{ - "comment1": "/* this is not a comment", - "comment2": "this is not a comment */", - "comment3": "/* this is not a comment */", - "comment4": "/* this /* not a comment */", - "comment5": "/* this */ not a comment */" -} - diff --git a/tests/expand/generated/mpjson-05.json b/tests/expand/generated/mpjson-05.json deleted file mode 100644 index b2bacd3..0000000 --- a/tests/expand/generated/mpjson-05.json +++ /dev/null @@ -1,26 +0,0 @@ - - -{ - "firstName": "John", - "lastName": "Smith", - "age": 25, - "address": { "streetAddress": "21 2nd Street", - "city": "New York", - "state": "NY", - "postalCode": "10021" - }, - "phoneNumber": [ - { - "type": "home", - "number": "212 555-1234" - }, - { - "type": "fax", - "number": "646 555-4567" - } - ], - "gender": { - "type": "male" - } -} - diff --git a/tests/expand/generated/mpjson-06.json b/tests/expand/generated/mpjson-06.json deleted file mode 100644 index fcddbfa..0000000 --- a/tests/expand/generated/mpjson-06.json +++ /dev/null @@ -1,32 +0,0 @@ - - -{ "husband": - { - "firstName": "John", - "lastName": "Smith", - "age": 25, - "address": { "streetAddress": "21 2nd Street", - "city": "New York", - "state": "NY", - "postalCode": "10021" - }, - "gender": { - "type": "male" - } - } - "spouse": - { - "firstName": "Mary", - "lastName": "Smith", - "age": 26, - "address": { "streetAddress": "21 2nd Street", - "city": "New York", - "state": "NY", - "postalCode": "10021" - }, - "gender": { - "type": "female" - } - } -} - diff --git a/tests/expand/generated/mpjson-07.json b/tests/expand/generated/mpjson-07.json deleted file mode 100644 index b8859f7..0000000 --- a/tests/expand/generated/mpjson-07.json +++ /dev/null @@ -1,24 +0,0 @@ - - -{ "husband": - { - "firstName": "John", - "lastName": "Smith", - "age": 25, - "address": {"streetAddress": "21 2nd Street","city": "New York","state": "NY","postalCode": "10021"}, - "gender": { - "type": "male" - } - } - "spouse": - { - "firstName": "Mary", - "lastName": "Smith", - "age": 26, - "address": {"streetAddress": "21 2nd Street","city": "New York","state": "NY","postalCode": "10021"}, - "gender": { - "type": "female" - } - } -} - diff --git a/tests/expand/generated/mpjson-08.json b/tests/expand/generated/mpjson-08.json deleted file mode 100644 index 4b09048..0000000 --- a/tests/expand/generated/mpjson-08.json +++ /dev/null @@ -1,9 +0,0 @@ - - -{ - "firstName": "John F.", - "lastName": "Kennedy", - "age": 25, - "gender": { "type": "male" } -} - diff --git a/tests/expand/generated/mpjson-09.json b/tests/expand/generated/mpjson-09.json deleted file mode 100644 index b6b4fa1..0000000 --- a/tests/expand/generated/mpjson-09.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "price": "to much \u20AC", - "basic": "\u003C\u003E\u0026\u0022\u0027", - "arrow": "\u2190\u2191\u2192\u2193\u2194\u21B5", - "Arrow": "\u21D0\u21D1\u21D2\u21D3\u21D4" -} - diff --git a/tests/expand/generated/mpjson-10.json b/tests/expand/generated/mpjson-10.json deleted file mode 100644 index 6517ab1..0000000 --- a/tests/expand/generated/mpjson-10.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "price, with discount, is": "88" -} - diff --git a/tests/expand/generated/mpjson-11.json b/tests/expand/generated/mpjson-11.json deleted file mode 100644 index 4535c98..0000000 --- a/tests/expand/generated/mpjson-11.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "price": "88" -} - diff --git a/tests/expand/generated/mpmd-01.md b/tests/expand/generated/mpmd-01.md deleted file mode 100644 index 8b13789..0000000 --- a/tests/expand/generated/mpmd-01.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/expand/generated/mpmd-02.md b/tests/expand/generated/mpmd-02.md deleted file mode 100644 index 8b13789..0000000 --- a/tests/expand/generated/mpmd-02.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/expand/generated/mpmd-03.md b/tests/expand/generated/mpmd-03.md deleted file mode 100644 index 139597f..0000000 --- a/tests/expand/generated/mpmd-03.md +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/tests/expand/generated/mpmd-04.md b/tests/expand/generated/mpmd-04.md deleted file mode 100644 index 8b13789..0000000 --- a/tests/expand/generated/mpmd-04.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/expand/generated/mpmd-05.md b/tests/expand/generated/mpmd-05.md deleted file mode 100644 index 8b13789..0000000 --- a/tests/expand/generated/mpmd-05.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/tests/expand/generated/mpmd-06.md b/tests/expand/generated/mpmd-06.md deleted file mode 100644 index 73112c2..0000000 --- a/tests/expand/generated/mpmd-06.md +++ /dev/null @@ -1,4 +0,0 @@ -Title -Long Title -Long Title - diff --git a/tests/expand/generated/mpmd-07.md b/tests/expand/generated/mpmd-07.md deleted file mode 100644 index 51d6160..0000000 --- a/tests/expand/generated/mpmd-07.md +++ /dev/null @@ -1,14 +0,0 @@ -ACA -AACAA -AACAA -AXDXA -BAXDXAB -APA -PYYP -PYYP -Q<%A C>R -A<%A X>A -BAX<%A X>XAB -Q<%R> -Q[<%A C>]R - diff --git a/tests/expand/generated/mpmd-08.md b/tests/expand/generated/mpmd-08.md deleted file mode 100644 index a624992..0000000 --- a/tests/expand/generated/mpmd-08.md +++ /dev/null @@ -1,5 +0,0 @@ -{ - "json": "Give me 100\u20AC." -} - - diff --git a/tests/expand/generated/mpmd-09.md b/tests/expand/generated/mpmd-09.md deleted file mode 100644 index b1a48e6..0000000 --- a/tests/expand/generated/mpmd-09.md +++ /dev/null @@ -1,12 +0,0 @@ -10... -9... -8... -7... -6... -5... -4... -3... -2... -1... -Done! - diff --git a/tests/expand/generated/mpmd-10.md b/tests/expand/generated/mpmd-10.md deleted file mode 100644 index b11cea9..0000000 --- a/tests/expand/generated/mpmd-10.md +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/tests/expand/generated/mpmd-11.md b/tests/expand/generated/mpmd-11.md deleted file mode 100644 index b11cea9..0000000 --- a/tests/expand/generated/mpmd-11.md +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/tests/expand/generated/mpmd-12.md b/tests/expand/generated/mpmd-12.md deleted file mode 100644 index b11cea9..0000000 --- a/tests/expand/generated/mpmd-12.md +++ /dev/null @@ -1,6 +0,0 @@ - - - diff --git a/tests/expand/generated/mpmd-13.md b/tests/expand/generated/mpmd-13.md deleted file mode 100644 index b677f74..0000000 --- a/tests/expand/generated/mpmd-13.md +++ /dev/null @@ -1,3 +0,0 @@ -Lorem Ipsum - - diff --git a/tests/expand/generated/mpmd-14.md b/tests/expand/generated/mpmd-14.md deleted file mode 100644 index a11f11a..0000000 --- a/tests/expand/generated/mpmd-14.md +++ /dev/null @@ -1,5 +0,0 @@ -Lorem Ipsum -``` -<%MACRO> -``` - diff --git a/tests/expand/generated/mpmd-15.md b/tests/expand/generated/mpmd-15.md deleted file mode 100644 index 9b98c77..0000000 --- a/tests/expand/generated/mpmd-15.md +++ /dev/null @@ -1,5 +0,0 @@ -Lorem Ipsum -~~~ -<%MACRO> -~~~ - diff --git a/tests/expand/mpcss-01.css b/tests/expand/mpcss-01.css new file mode 100644 index 0000000..eec8ad9 --- /dev/null +++ b/tests/expand/mpcss-01.css @@ -0,0 +1,8 @@ +&define{font_stack}{Helvetica, sans_serif} +&define{primary_color}{#333} + +// A rule +body { + font: 100% &font_stack; + color: &primary_color; +} diff --git a/tests/expand/mpcss-02.css b/tests/expand/mpcss-02.css new file mode 100644 index 0000000..7ae24fb --- /dev/null +++ b/tests/expand/mpcss-02.css @@ -0,0 +1,8 @@ +&define{&border_radius{radius}}{ + -webkit-border-radius: &radius; + -moz-border-radius: &radius; + -ms-border-radius: &radius; + border-radius: &radius; +} + +.box { &border_radius{10px} } diff --git a/tests/expand/mpcss-03.css b/tests/expand/mpcss-03.css new file mode 100644 index 0000000..326e72b --- /dev/null +++ b/tests/expand/mpcss-03.css @@ -0,0 +1,24 @@ +&define{message}{ + border: 1px solid #ccc; + padding: 10px; + color: #333& +} + +.message { + &message; +} + +.success { + &message; + border-color: green; +} + +.error { + &message; + border-color: red; +} + +.warning { + &message; + border-color: yellow; +} diff --git a/tests/expand/mpcss-04.css b/tests/expand/mpcss-04.css new file mode 100644 index 0000000..634fbb0 --- /dev/null +++ b/tests/expand/mpcss-04.css @@ -0,0 +1,11 @@ +.container { width: 100%; } + +article[role="main"] { + float: left; + width: &eval{(100 * 600) / 960}%; +} + +aside[role="complementary"] { + float: right; + width: &eval{(100 * 300) / 960}%; +} diff --git a/tests/expand/mpcss-05.css b/tests/expand/mpcss-05.css new file mode 100644 index 0000000..96b3bd4 --- /dev/null +++ b/tests/expand/mpcss-05.css @@ -0,0 +1,18 @@ +&define{&linx{link}{visit}{hover}{active}}{ + a { + color: &link; + } + a:visited { + color: &visit; + } + a:hover { + color: &hover; + } + a:active { + color: &active; + } +} + +SEL { + &linx{red}{green}{blue}{yellow} +} diff --git a/tests/expand/mpcss-06.css b/tests/expand/mpcss-06.css new file mode 100644 index 0000000..5ce2782 --- /dev/null +++ b/tests/expand/mpcss-06.css @@ -0,0 +1,12 @@ +&define{content}{ + background-color: black; + color: white; + &1& +} + +div { + &content{ + font-size: 12px; + font-style: italic;& + } +}