{"id":15288121,"url":"https://github.com/hslua/hslua-module-doclayout","last_synced_at":"2025-08-10T06:39:42.975Z","repository":{"id":42488802,"uuid":"253321892","full_name":"hslua/hslua-module-doclayout","owner":"hslua","description":"Lua module wrapping Text.DocLayout.","archived":false,"fork":false,"pushed_at":"2025-06-23T10:58:48.000Z","size":92,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-25T13:38:14.213Z","etag":null,"topics":["haskell","lua-bindings","templating"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hslua.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"tarleb"}},"created_at":"2020-04-05T20:05:27.000Z","updated_at":"2025-06-23T10:58:45.000Z","dependencies_parsed_at":"2025-07-25T09:33:19.557Z","dependency_job_id":"f70ff53c-b98d-4113-beb1-aa80e565806e","html_url":"https://github.com/hslua/hslua-module-doclayout","commit_stats":{"total_commits":67,"total_committers":2,"mean_commits":33.5,"dds":"0.014925373134328401","last_synced_commit":"548bb42665ff67709a3c8aadf695bbfa1fc264b8"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/hslua/hslua-module-doclayout","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslua%2Fhslua-module-doclayout","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslua%2Fhslua-module-doclayout/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslua%2Fhslua-module-doclayout/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslua%2Fhslua-module-doclayout/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hslua","download_url":"https://codeload.github.com/hslua/hslua-module-doclayout/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hslua%2Fhslua-module-doclayout/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269687950,"owners_count":24459394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","lua-bindings","templating"],"created_at":"2024-09-30T15:44:10.740Z","updated_at":"2025-08-10T06:39:42.957Z","avatar_url":"https://github.com/hslua.png","language":"Haskell","readme":"# hslua-module-doclayout\n\n[![GitHub CI][CI badge]](https://github.com/hslua/hslua-module-doclayout/actions)\n[![Hackage][Hackage badge]](https://hackage.haskell.org/package/hslua-module-doclayout)\n[![Stackage Lts][Stackage Lts badge]](http://stackage.org/lts/package/hslua-module-doclayout)\n[![Stackage Nightly][Stackage Nightly badge]](http://stackage.org/nightly/package/hslua-module-doclayout)\n[![MIT license][License badge]](LICENSE)\n\nLua module wrapping the [doclayout] Haskell package.\n\n[doclayout]: https://hackage.haskell.org/package/doclayout\n[CI badge]: https://github.com/hslua/hslua-module-doclayout/workflows/CI/badge.svg\n[Hackage badge]: https://img.shields.io/hackage/v/hslua-module-doclayout.svg?logo=haskell\n[Stackage Lts badge]: http://stackage.org/package/hslua-module-doclayout/badge/lts\n[Stackage Nightly badge]: http://stackage.org/package/hslua-module-doclayout/badge/nightly\n[License badge]: https://img.shields.io/badge/license-MIT-blue.svg\n\n\nExample\n-------\n\n``` haskell\nloadProg :: Lua Status\nloadProg = do\n  openlibs\n  preloadModule \"doclayout\"\n  dostring $ unlines\n    [ \"doc = require 'doclayout'\"\n    , \"local example_doc = (doc.literal 'Line' + 'One')\"\n    , \"                 // (doc.literal 'Line' + 'Two')\"\n    , \"-- prints:\"\n    , \"-- Line One\"\n    , \"--\"\n    , \"-- Line Two\"\n    , \"print(doc.render(example_doc))\"\n    , \"\"\n    , \"-- prints:\"\n    , \"-- Line\"\n    , \"-- One\"\n    , \"--\"\n    , \"-- Line\"\n    , \"-- Two\"\n    , \"local columns = 5\"\n    , \"print(doc.render(example_doc, columns))\"\n    ]\n```\n\n\nDocumentation\n-------------\n\n### Functions\n\n#### render\n\n`render (doc[, colwidth[, style]])`\n\nRender the `Doc` using the given column width.\n\nParameters:\n\n`doc`\n:   Doc to render\n\n`colwidth`\n:   Maximum number of characters per line\n\n`style`\n:   Whether to generate 'plain' or 'ANSI' terminal output. Must be\n    either `'plain'` or `'ansi'`. Defaults to `'plain'`. (string)\n\n### Doc construction\n\nAll functions return a fresh `Doc` element.\n\n#### after_break\n\n`after_break`\n\nCreates a `Doc` which is conditionally included only if it\ncomes at the beginning of a line.\n\n#### before_non_blank\n\n`before_non_blank (doc)`\n\nConditionally includes the given `Doc` unless it is followed by\na blank space.\n\n#### blankline\n\n`blankline`\n\nInserts a blank line unless one exists already.\n\n#### blanklines\n\n`blanklines (n)`\n\nInsert blank lines unless they exist already.\n\nParameters:\n\n`n`\n:   Number of blank lines to insert.\n\n#### braces\n\n`braces (doc)`\n\nPuts a `Doc` in curly braces.\n\n#### brackets\n\n`brackets (doc)`\n\nPuts a `Doc` in square brackets.\n\n#### cblock\n\n`cblock (width, doc)`\n\nLike `lblock` but aligned centered.\n\nParameters:\n\n`width`\n:   Width of the created block, in characters\n\n`doc`\n:   Contents of the block ([Doc])\n\n#### chomp\n\n`chomp (doc)`\n\nChomps trailing blank space off of a `Doc`.\n\n#### concat\n\n`concat (docs[, sep])`\n\nConcatenate the given `Doc`s, interspersing `sep` if specified.\n\nParameters:\n\n`docs`\n:   List of `Doc`s\n\n`sep`\n:   Separator `Doc`\n\n#### cr\n\nA carriage return. Does nothing if we're at the beginning of a\nline; otherwise inserts a newline.\n\n#### double_quotes\n\n`double_quotes (doc)`\n\nWraps a `Doc` in double quotes\n\n#### empty\n\nThe empty document.\n\n#### flush\n\n`flush (doc)`\n\nMakes a `Doc` flush against the left margin.\n\n#### hang\n\n`hang (indent, start, doc)`\n\nCreates a hanging indent.\n\nParameters:\n\n`indent`\n:   Indentation width in characters\n\n`start`\n:   Start, printed unindented\n\n`doc`\n:   Doc which is indented by `indent` spaces on every line.\n\n#### inside\n\n`inside (start, end, contents)`\n\nEncloses a `Doc` inside a start and end `Doc`.\n\nParameters:\n\n`start`\n:   Doc before contents\n\n`end`\n:   Doc after contents\n\n`contents`\n:   Contents Doc\n\n#### lblock\n\n`lblock (width, doc)`\n\nCreates a block with the given width and content, aligned to the left.\n\nParameters:\n\n`width`\n:   Width of the created block, in characters\n\n`doc`\n:   Contents of the block ([Doc])\n\n\n#### literal\n\n`literal (string)`\n\nCreates a `Doc` from a string.\n\n#### nest\n\n`nest (indent)`\n\nIndents a `Doc` by the specified number of spaces.\n\nParameters:\n\n`indent`\n:   Indentation width.\n\n#### nestle\n\n`nestle (doc)`\n\nRemoves leading blank lines from a `Doc`.\n\n#### nowrap\n\n`nowrap (doc)`\n\nMakes a `Doc` non-reflowable.\n\n#### parens\n\n`parens (doc)`\n\nPuts a `Doc` in parentheses.\n\n#### prefixed\n\n`prefixed (prefix, doc)`\n\nUses the specified string as a prefix for every line of the\ninside document (except the first, if not at the beginning of the\nline).\n\nParameters:\n\n`prefix`\n:   Prefix to prepend to each line\n\n`doc`\n:   Inside Doc.\n\n#### quotes\n\n`quotes (doc)`\n\nWraps a `Doc` in single quotes.\n\n#### rblock\n\n`rblock (indent, doc)`\n\nLike `lblock` but aligned to the right.\n\nParameters:\n\n`width`\n:   Width of the created block, in characters\n\n`doc`\n:   Contents of the block ([Doc])\n\n#### space\n\nA breaking (reflowable) space.\n\n#### vfill\n\n`vfill`\n\nCreates an expandable border that, when placed next to a box,\nexpands to the height of the box.\n\nParameters:\n\n`text`\n:   Border text\n\n### Operators\n\n#### `..`\n\nConcatenate two `Doc` elements.\n\n#### `+`\n\nConcatenate two `Doc`s, inserting a reflowable space between them.\n\n#### `/`\n\nIf `a` and `b` are `Doc` elements, then `a / b` puts `a` above `b`.\n\n#### `//`\n\nIf `a` and `b` are `Doc` elements, then `a // b` puts `a` above\n`b`, inserting a blank line between them.\n\n### Document Querying\n\n#### is_empty\n\n`is_empty (doc)`\n\nReturns `true` iff `doc` is the empty document, `false` otherwise.\n\n#### min_offset\n\n`min_offset (doc)`\n\nReturns the minimal width of a @'Doc'@ when reflowed at breakable\nspaces.\n\n#### update_column\n\n`update_column (doc, i)`\n\nReturns the column that would be occupied by the last laid out character.\n\n#### height\n\n`height (doc)`\n\nReturns the height of a block or other Doc.\n\n#### real_length\n\n`real_length (str)`\n\nReturns the real length of a string in a monospace font: 0 for a\ncombining character, 1, for a regular character, 2 for an East\nAsian wide character.\n\n#### offset\n\n`offset (doc)`\n\nReturns the width of a `Doc` (as number of characters).\n\n\nLicense\n-------\n\nThis package is made available under the MIT license. See [`LICENSE`](LICENSE)\nfor details.\n","funding_links":["https://github.com/sponsors/tarleb"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslua%2Fhslua-module-doclayout","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhslua%2Fhslua-module-doclayout","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhslua%2Fhslua-module-doclayout/lists"}