aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* deftag: return the keyword.HEADtl-who-masterKaz Kylheku2023-08-222-7/+13
| | | | | | | | * README.md: Document that deftag returns the keyword symbol that is being defined as the tag. * who.tl (deftag): Return the keyword parameter instead of the generated lambda.
* deftag: support destructuring of body.Kaz Kylheku2023-08-224-9/+61
| | | | | | | | | | | | | | | | | | | | | | | | The variable which captures the body part of the tag (material after attributes) is now a pattern. Thus the body can be destructured, allowing the custom to effectively have non-attribute parameters. * README.md: Documented. * specials (*cur-form*, *cur-env*): New special variables. * test/simple.tl: Test case for new deftag feature. * who.tl (with-html-output): Capture macro invocation's form and environment, binding them to *cur-form* and *cur-env*. This is a way of getting this information down to the custom tag expander, where destructuring errors can occur now. We would like them diagnosed against the right form. The body destructuring pattern can use :env too. (deftag): tag-body parameter renamed to body-pattern. This is not inserted into the lambda parameter list any more; a gensym is inserted into that position, and then that value is destructured using body-pattern.
* remove compile-file bug workaround.Kaz Kylheku2023-08-221-2/+0
| | | | packages.tl: remove dummy top-level form.
* README: compiling and cleaning instructions.Kaz Kylheku2023-06-111-0/+8
|
* README: mention deftag earlier.Kaz Kylheku2023-06-111-1/+3
|
* Use load-args-process.Kaz Kylheku2023-06-112-23/+2
| | | | | | | * tl-who.tl: Replace command processor with load-args-process, which is now in the language as of TXR 288. * README.md: Now requires 288 not 287.
* README: move section down.Kaz Kylheku2023-06-041-13/+13
| | | | | | * README.md: Move down the section which reveals that the whole CL-WHO arsenal of differently flavored HTML escaping functions is missing.
* README: put some code in code blocks.Kaz Kylheku2023-06-041-3/+4
| | | | | | * README.md: Some code snippets containing HTML escapes are not put in backticks and so those escapes are being rendered.
* Support compilation.Kaz Kylheku2023-06-042-4/+50
| | | | | | | | | * packages.tl: Add workaround for a newly discovered bug in compile-file. * tl.who.tl: Replace loads with a form that does different things based on *load-args*, the default being to load everything when *load-args* are empty.
* tests: stray tabs to spaces.Kaz Kylheku2023-06-031-1/+1
|
* README: stray tabs to spacesKaz Kylheku2023-06-031-14/+14
|
* README: fix sentence ending in comma rather than period.Kaz Kylheku2023-06-031-1/+1
|
* README: fix closing backtick without opening backtick.Kaz Kylheku2023-06-031-1/+1
|
* README: link to CL-WHO.Kaz Kylheku2023-06-031-1/+2
|
* bugfix: mistake in pattern.Kaz Kylheku2023-06-011-1/+1
| | | | | | | | | | * who.tl (tree-to-template): Run-on-dot in the pattern whch detects second level of keyword nesting. Actually, it's not clear what this nesting is for. When would we want a ((:p ..) ...) or whatever. I will review this; it might be CL-WHO cruft that has no purpose. No test case broke because of this bug, which means it's not tested.
* New feature: deftag macro.Kaz Kylheku2023-06-015-1/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The deftag macro targets the HTML markup syntax itself rather than Lisp forms within it. deftag macros masquerade as tag markup, but rewrite themselves into other markup. They can produce multiple elements using (progn ...) and can move element attribute material into the avlue position and vice versa. They can destructure attributes using keyword parameters, and easily default the values of required attributes and such. * packages.tl (tl-who): New symbol, deftag. * specials.tl (*tag-macro*): New special variable, holding a hash table of deftag definitions. * who.tl (process-tag): After a tag is parsed, we check whether there is a macro defined for it. If so we call its expander lambda. This is done here because this function has the parsed pieces of the tag. The higher level above this function doesn't, and after this function, everything is just a flat list of strings and other objects. Here we recognize whether the macro put out a progn shape, and iterate over the multiple items it contains. (scrub-kw-args): New function. This is a helper function used by deftag expanders to remove, from the attribute rest parameter, those keyword arguments which were captured by the named parameters. (deftag): New macro. * test/simple.tl: New test cases 50-54 targeting deftag. * README.md: Documented.
* README: rearrange.Kaz Kylheku2023-06-011-51/+51
| | | | | * README.mt: Move the sections on escaping earlier, since it's a very important difference.
* Fix lack of escaping for constant items.Kaz Kylheku2023-05-313-2/+64
| | | | | | | | | | | | * who.tl (tree-to-template): Recognize string elements and html-encode them at macro time before adding to list. Recognize (noesc ...) syntax to defeat this. Error if it isn't given one argument that is a constant. * test/simple.tl: New test cases 46 to 49. * README.md: Document new differences between CL-WHO and TL-WHO.
* Allow fmt and escj to be used to calculate attributes.Kaz Kylheku2023-05-313-7/+24
| | | | | | | | | | | | | | | | | | | | * who.tl (attr-warning-macrolet): Do not warn when fmt and escj are used on attributes. Instead, give them a useful definition so they do what the programmer wants: return a string. * test/simple.tl: Trim it to just the tags that should warn now. Also fix a bug that rendered this case invalid: unquote occurred with no backquote, and this produced an undefined variable warning on sym, which was treated by the test case's handler as a false positive that made it pass. New test case 45 testing fmt and escj in attributes. * README.md: Added to notes on differences between TL-WHO and CL-WHO.
* esc, escq: accept non-numeric arguments.Kaz Kylheku2023-05-313-2/+11
| | | | | | | | | * who.tl (with-html-output): Arrange for tostringp to be called on argument of esc and escq. * test/simple.tl: New test 44. * README.tl: mention as a difference from CL-WHO.
* Remove CL-WHO cruft we don't need.Kaz Kylheku2023-05-304-374/+0
| | | | | | | | | | | * CHANGELOG: File removed. Changelogs are not useful; they can be reconstructed from version control comments. I will create a RELNOTES file for release notes. * cl-who.asd: Removed; no ASDF in TXR Lisp. * test/packages.lisp, test/tests.lisp: Files removed; the test/simple.tl is self-contained.
* Add escq and escj local macros.Kaz Kylheku2023-05-304-2/+30
| | | | | | | | | | | | | | | | | | The escq macro provides HTML escaping for the apostrophe and double quote also, whereas esqj is for escaping material to be put into a Javascript literal. * packages.tl (tl-who): New symbols escq and escj. * who.tl (attr-warning-macrolet): Add escq and escq to list of WHO local macros that are not warned about if they occur in attributes. (with-html-output): Add escq and escj. * test/simple.tl: Test 41 updated to include escq and escj. New tests 42 and 43. * README.md: Mention escq and escj.
* README: mention different escaping for attributes.Kaz Kylheku2023-05-301-2/+5
| | | | | | * README.mt: Mention that html-encode* is used by esc and fmt, which leaves quotes alone. Attribute quoting uses html-escape which escapes quotes too.
* Refactor attribute warning macro.Kaz Kylheku2023-05-301-5/+2
| | | | | * who.tl (attr-warning-macrolet): Reduce repeated code by iterating over a list of symbols.
* Add warning when local macros used in attr expression.Kaz Kylheku2023-05-292-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | The with-html-output ("WHO") macro defines some local macrolets. Those are in scope of the entire thing, but they can only be meaningfully used in the imperative Lisp forms that are placed into the HTML tag body. If they are used in an attribute expression, it's probably a programming error; an output side effect doesn't belong there. We implement a diagnostic strategy which produces a warning in this situation. * who.tl (attr-warning-macrolet): New function, which wraps macrolet code around the expression passed in. These macrolets intercept the local macros and generate a warning. Then they decline to expand, deferring to the real macros. (convert-attributes): Wrap the warning macrolets around the run-time evaluation of the val expression. We don't do anything for the compile-time evaluation of a constant attribute expression, because the macro calls we want to intercept do not appear in a constant expression. * test/simple.tl: New test 41 validating that warnings are generated for all the local macros when they are called from an attr expression.
* New local macro noesc-fmt; fmt now escapes.Kaz Kylheku2023-05-294-2/+28
| | | | | | | | | | | | | * packages.tl (tl-who): Add noesc-fmt symbol. * who.tl (with-html-output): Add escaping to fmt, which is disabled under *cl-who-compat*. Add noesc-fmt macro that looks like former definition of fmt. * test/simple.tl: New test cases 38-40. * README.md: Mention that TL-WHO provides noesc-fmt.
* Fix CL-WHO attr bugs: no escaping, poor constant handling.Kaz Kylheku2023-05-295-20/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | CL-WHO tries to handle the case when attribute values are constant NIL and T values, but it bungles it; it applies the correct behavior only when the constants are literally these symbols, not when they are constant expressions which evaluate to these values. Secondly, CL-WHO neglects to HTML-escape attribute values. We fix this behavior and introduce a noesc operator to selectively revert it, as well as a *cl-who-compat* special to revert the behavior more pervasively, for the daredevils. * packages.tl (tl-who): New symbols *cl-who-compat* and noesc. * specials.tl (*cl-who-compat*): New special variable. * who.tl (convert-attributes): When treating a constant expression, evaluate it first, then check for nil or t. Escape interpolated text with html-encode. Check the original expression for (noesc ...) pattern, or the presence of *cl-who-compat*. In these cases, don't generate the escape call. * test/simple.tl: New tests 28 to 37 providing some coverage to all these changes. * README.md: Document.
* README: notes about interpolation.Kaz Kylheku2023-05-291-0/+9
| | | | | | | * README.md: Add a note about Lisp evaluation: Lisp expressions that give attribute values are interpolated into HTML; Lisp expressions in tag body are evaled for side effect only.
* Fix another attribute bug: all tests work.Kaz Kylheku2023-05-292-84/+138
| | | | | | | * simple.tl: Translate and enable all tests. * who.tl (process-tag): Fix double nreverse bug causing attr list to be truncated to one tag.
* tests: 9 through 14 working.Kaz Kylheku2023-05-291-89/+90
|
* README: mention *attribute-quote-char* difference.Kaz Kylheku2023-05-281-0/+7
| | | | | | Test case 8 had to be adjusted to bind *attribute-quote-char* using expander-let instead of let, so this is a difference worth mentioning.
* README: mention smooth syntax of TL-WHO.Kaz Kylheku2023-05-281-0/+24
|
* tests: 7 through 8 working.Kaz Kylheku2023-05-281-15/+14
| | | | * test/simple.tl: Port tests 7 through 8 and move (exit).
* Fix attribute bugs: tests 1 to 7 working.Kaz Kylheku2023-05-282-44/+46
| | | | | | | | | | | * who.tl (convert-attributes): In the run-time case, we must generate code to print the calculated string, not just to calculate it. (convert-tag-to-string-list): Test the original tag keyword against the *html-empty-tags*, not the transformed string. * test/simple.tl: Port and enable tests 1 to 7.
* Starting TL-WHO tests.Kaz Kylheku2023-05-281-14/+26
| | | | | | | * test/simple: renamed to simple.tl. Just a self-contained file we can run. The first test has been rewritten to TL. After that we (exit). The first test is failing; it is not rendering any attributes.
* Add markdown README.Kaz Kylheku2023-05-283-0/+168
| | | | | | * README.md, LICENSE: New files. * who.tl: Add copyright notice.
* Fix (htm ...) output resetting indentation to zero.Kaz Kylheku2023-05-281-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an issue present in the original Common Lisp implementation. When the (htm ...) inner macros are being expanded, they are not receiving the *indent* level. We address this by adding yet another unreleased feature to TXR Lisp that will appear in TXR 287: expander-let. * who.tl (tree-to-template): Here, instead of generating a ^(let ((*indent* , *indent*)) ...) which does nothing, we use expander-let. All the expansion of the structured code to HTML text fragments happens at macro-expansion time. But macro-expansion time will not execute a binding form like (let ((*indent* <value>)) ...). It will just expand it! The (htm ...) subforms get expanded in a context in which all the functions that expanded the outer macro have already terminated and undone their own local binding of *indent*. The expander-let construct causes the macro expander itself to do the binding. So it will pick up the indentation where the previous expansion pass left off. (with-html-output): The previous fix isn't enough, because the way the local html macro is defined also wrecks indentation. htm expands to an invocation of with-html-output which copies the :indent argument value from the surrouning with-html-output. If that is 0 or t, it will reset the indentation to zero. The htm macro should just leave the indentation alone; not pass that keyword argument so that the current *indent* value gets propagated.
* First cut at TXR Lisp translation.Kaz Kylheku2023-05-288-759/+455
| | | | | | This relies on an improvement in TXR Lisp that will be released in TXR 287: parameter macros like :key being expanded inside nested macro parameter lists.
* Fix keyword bloating in DEFPACKAGE clauses (#33)masterKilian M. Haemmerle2022-02-232-30/+30
| | | | | * Fix keyword bloating in DEFPACKAGE :EXPORT clauses * Fix keyword bloating in DEFPACKAGE :SHADOW clause
* downcase a tag only when it is in the same case (useful for some camel case ↵Manuel Giraud2019-06-073-6/+17
| | | | XML tags).
* Adapt defconstant for clasp (behaving like sbcl)Karsten Poeck2019-05-212-3/+3
|
* Update index.htmlStas Boukarev2019-01-121-1/+1
|
* Stop listing usersStas Boukarev2019-01-121-9/+6
| | | Can't keep up with them going away and listing new ones.
* moved doc/ to docs/Vityok2017-12-211-0/+0
|
* Add license information to the ASDF filePhilipp Marek2017-01-191-0/+1
|
* Fix a typo in the documentation.Stas Boukarev2016-10-041-1/+1
| | | | Reported by @gptix in #21
* Update documentation for *empty-attribute-syntax*Knut Olav Bøhmer2016-07-291-2/+17
|
* Special variable to enable empty attribute syntaxKnut Olav Bøhmer2016-07-293-12/+21
| | | | | See https://www.w3.org/TR/html-markup/syntax.html#syntax-attr-empty for spesification.
* release 1.1.4Hans Huebner2014-11-282-1/+5
|
* update support infoHans Huebner2014-11-281-11/+9
|