{"id":23343381,"url":"https://github.com/bndrmrtn/smarti","last_synced_at":"2025-04-07T16:20:32.905Z","repository":{"id":268918832,"uuid":"904261159","full_name":"bndrmrtn/smarti","owner":"bndrmrtn","description":"Smarti language interpreter written in Go ✨","archived":false,"fork":false,"pushed_at":"2025-01-23T17:49:38.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-02T19:04:58.189Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/bndrmrtn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-12-16T14:51:25.000Z","updated_at":"2025-01-23T17:49:42.000Z","dependencies_parsed_at":"2024-12-19T20:25:51.881Z","dependency_job_id":"8306e462-6823-4807-b712-2787064608b7","html_url":"https://github.com/bndrmrtn/smarti","commit_stats":null,"previous_names":["smlgh/smarti","bndrmrtn/smarti"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bndrmrtn%2Fsmarti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bndrmrtn%2Fsmarti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bndrmrtn%2Fsmarti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bndrmrtn%2Fsmarti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bndrmrtn","download_url":"https://codeload.github.com/bndrmrtn/smarti/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247685633,"owners_count":20979085,"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","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":[],"created_at":"2024-12-21T06:15:11.081Z","updated_at":"2025-04-07T16:20:32.889Z","avatar_url":"https://github.com/bndrmrtn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smarti - More than a simple templating engine\n\nSmarti is a templating engine that is designed to help backend developers deliver content to the frontend faster.\nSmarti is cross-platform language. It is designed to be used anywhere with anything.\nIt helps you to make html templates with a simple syntax without learning each templating engine's syntax.\n\n## Features\n\n- Simple syntax\n- Cross-platform\n- Easy to use\n- Fast\n- Lightweight\n- No dependencies\n\n## Installation\n\n```bash\ngo install github.com/bndrmrtn/smarti@latest\n```\n\n## Usage\n\n```bash\nsmarti run main.smt\n# Or\nsmarti server . # To start the server on port 3000 in the specified directory.\n```\n\n## Demo\n\n### Simple code example\n\n```smarti\nuse io;\n\nlet name = io.read(\"What is your name? \");\nname = capitalize(name);\n\nwritef(\"Hello, %s!\\n\", name);\n```\n\n### Our Goal\n\n```smarti\nnamespace testserver;\nuse request; // import the request module to get request data\nuse response as rw; // import the response module to send data to the client  (rw is an alias for response writer)\n\nif request.method != \"POST\" {\n  rw.status(405); // Set the status code to 405 and send the response\n  return;\n}\n\nfor let i = 0; i \u003c api.data.length; i++ {\n  let data = api.data[i];\n  rw.write(\u003c\u003e\n    \u003ch1\u003e{{ data.title }}\u003c/h1\u003e\n    \u003cp\u003e{{ data.content }}\u003c/p\u003e\n  \u003c/\u003e);\n}\n\nrw.status(200); // Set the status code to 200 and send the response\n```\n\nThis code is our goal. We want to make a simple template language that can be used in any project.\nWe're working on it. We're trying to make it as good as possible.\n\n## Error handling\n\nSmarti does not have try-catch blocks.\nIf you want to handle errors, you can use a special macro called `@err`.\nErr macro creates a temporary variable called `err` that contains the error message.\n\n```smarti\nnamespace main;\nuse json;\nuse io;\n\nlet data = json.from('{\"name\": \"John\"\"}') @err;\nif err != nil {\n  io.writef(\"Error: %v\\n\", err); // Will display a syntax error\n  return;\n}\n```\n\nYou can use the `@err` macro anywhere in the code.\nErrors can be omitted if you don't want to handle them.\nIn this case non-fatal operations can return non-initialized values.\nThis feature is still in development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbndrmrtn%2Fsmarti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbndrmrtn%2Fsmarti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbndrmrtn%2Fsmarti/lists"}