Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the textery Reference Manual, version 0.2, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 05:58:34 2022 GMT+0.
Next: Systems, Previous: The textery Reference Manual, Up: The textery Reference Manual [Contents][Index]
implementation of tracery in lisp
$ git clone https://github.com/compufox/textery ~/common-lisp/textery
* (ql:quickload :textery)
Load a rule file (a normal tracery JSON file) using (load-grammar "rule.file")
If this is the first rule file loaded, it is set as the current grammar.
To expand text, use (expand "#expand# this!")
If you have multiple grammars loaded use the (with-grammar)
macro to select which grammar to use:
(with-grammar "grammar2"
(expand "#test#"))
You can pass arguments to the text to be expanded by using periods: (expand-text "#test.string-upcase#")
, these can be chained together by doing (expand-text "#test.string-upcase.reverse#")
Arguments are any lisp function that can handle at least one string parameter. You can even provide your own!
If you want to use functions that require more than one parameter do as follows:
(defun example-argument (text param param2)
(concatenate 'string
text
param
param2))
(expand "#test.example-argument(5,test)#")
(load-grammar file)
loads grammar from FILE
stores the contents internally under the FILE's name minus the extension
if this is the first grammar thats loaded, set our current grammar to it
(load-grammar-directory dir)
loads all grammars from directory DIR
(create-grammar name grammar)
manually creates a grammar using NAME and GRAMMAR
GRAMMAR is a tracery-formatted json string
(with-grammar grammar &body body)
executes BODY with GRAMMAR set to be the current grammar
GRAMMAR is the filename (minus extension) of the grammar file previous loaded
(list-grammars)
returns a list of all loaded grammars
(expand text)
expands TEXT using the current grammar
BSD 3-Clause
Next: Files, Previous: Introduction, Up: The textery Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
tracery lisp implementation
ava fox
BSD 3-Clause
0.2
Next: Packages, Previous: Systems, Up: The textery Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: textery/package.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
textery (system).
Next: textery/util.lisp, Previous: textery/textery.asd, Up: Lisp [Contents][Index]
textery (system).
Next: textery/eng-modifiers.lisp, Previous: textery/package.lisp, Up: Lisp [Contents][Index]
package.lisp (file).
textery (system).
Next: textery/textery.lisp, Previous: textery/util.lisp, Up: Lisp [Contents][Index]
Previous: textery/eng-modifiers.lisp, Up: Lisp [Contents][Index]
eng-modifiers.lisp (file).
textery (system).
Next: Definitions, Previous: Files, Up: The textery Reference Manual [Contents][Index]
Packages are listed by definition order.
common-lisp.
Next: Indexes, Previous: Packages, Up: The textery Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Public Interface, Up: Public Interface [Contents][Index]
executes BODY with current-grammar set to GRAMMAR
Previous: Macros, Up: Public Interface [Contents][Index]
creates a grammar from a string
NAME is a string that denotes what the grammar is to be called GRAMMAR is a string that contains tracery formatted json
expands TEXT
loads the json grammar referred to by FILE
loads all grammars from directory DIR
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
rules added by actions
very volatile, only used during evaluations
current grammar being used
all currently loaded grammar files
Previous: Special variables, Up: Internals [Contents][Index]
puts ’a’ or ’an’ in front of WORD
getf but for alists
applies all ARGUMENTS to TEXT
ARGUMENTS is a list of strings that refer to lisp functions
returns non-nil if CHAR is one of COMPARE characters
naively applies ’ed’ to the end of WORD
retrieves all actions from TEXT
retrieves all symbols from TEXT
returns a value from the current grammar using KEY
converts camelCase JSON-STRING to a symbol
if AS-STRING is non-nil, returns a string instead of a symbol if AS-KEYWORD is non-nil, returns a keyword
returns a list of loaded grammars
parses arguments passed into FUNCALL
returns a list of arguments, or nil
returns a function of name NAME
naively converts WORD into its possesive form
processes all ACTIONS, removing them from TEXT
processes all SYMBOLS, evaluating and replacing them in TEXT
returns a random element from LST
replaces the first occurance of OLD with NEW in S
if OLD isn’t found in S, returns S as-is
naively pluralizes WORD
Previous: Definitions, Up: The textery Reference Manual [Contents][Index]
Jump to: | A C E F G J L M P R S V W |
---|
Jump to: | A C E F G J L M P R S V W |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
S |
---|
Jump to: | *
S |
---|
Jump to: | E F P S T U |
---|
Jump to: | E F P S T U |
---|