1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-12 11:10:29 +00:00

Add citation to cc.pretty

ust to look extra pretentious.
This commit is contained in:
Jonathan Coates 2021-04-11 18:43:24 +01:00
parent 17b5bca443
commit 058d63e77f

View File

@ -1,23 +1,28 @@
--- Provides a "pretty printer", for rendering data structures in an --[[- Provides a "pretty printer", for rendering data structures in an
-- aesthetically pleasing manner. aesthetically pleasing manner.
--
-- In order to display something using @{cc.pretty}, you build up a series of In order to display something using @{cc.pretty}, you build up a series of
-- @{Doc|documents}. These behave a little bit like strings; you can concatenate @{Doc|documents}. These behave a little bit like strings; you can concatenate
-- them together and then print them to the screen. them together and then print them to the screen.
--
-- However, documents also allow you to control how they should be printed. There However, documents also allow you to control how they should be printed. There
-- are several functions (such as @{nest} and @{group}) which allow you to control are several functions (such as @{nest} and @{group}) which allow you to control
-- the "layout" of the document. When you come to display the document, the 'best' the "layout" of the document. When you come to display the document, the 'best'
-- (most compact) layout is used. (most compact) layout is used.
--
-- @module cc.pretty The structure of this module is based on [A Prettier Printer][prettier].
-- @usage Print a table to the terminal
-- local pretty = require "cc.pretty" [prettier]: https://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf "A Prettier Printer"
-- pretty.print(pretty.pretty({ 1, 2, 3 }))
-- @module cc.pretty
-- @usage Build a custom document and display it @usage Print a table to the terminal
-- local pretty = require "cc.pretty" local pretty = require "cc.pretty"
-- pretty.print(pretty.group(pretty.text("hello") .. pretty.space_line .. pretty.text("world"))) pretty.print(pretty.pretty({ 1, 2, 3 }))
@usage Build a custom document and display it
local pretty = require "cc.pretty"
pretty.print(pretty.group(pretty.text("hello") .. pretty.space_line .. pretty.text("world")))
]]
local expect = require "cc.expect" local expect = require "cc.expect"
local expect, field = expect.expect, expect.field local expect, field = expect.expect, expect.field