{"id":51815356,"url":"https://github.com/hellmrf/pygments-portugol","last_synced_at":"2026-07-21T23:39:12.908Z","repository":{"id":52518016,"uuid":"361850498","full_name":"hellmrf/pygments-portugol","owner":"hellmrf","description":"Pygments / minted lexer for Portugol Studio.","archived":false,"fork":false,"pushed_at":"2022-01-29T02:12:08.000Z","size":122,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-07-21T23:39:02.341Z","etag":null,"topics":["minted","portugol-studio","pygments"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hellmrf.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}},"created_at":"2021-04-26T18:16:12.000Z","updated_at":"2022-01-29T02:07:05.000Z","dependencies_parsed_at":"2022-09-12T05:00:28.783Z","dependency_job_id":null,"html_url":"https://github.com/hellmrf/pygments-portugol","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/hellmrf/pygments-portugol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellmrf%2Fpygments-portugol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellmrf%2Fpygments-portugol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellmrf%2Fpygments-portugol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellmrf%2Fpygments-portugol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellmrf","download_url":"https://codeload.github.com/hellmrf/pygments-portugol/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellmrf%2Fpygments-portugol/sbom","scorecard":{"id":460256,"data":{"date":"2025-08-11","repo":{"name":"github.com/hellmrf/pygments-portugol","commit":"f90684831b394a0cd8570fa45e108d311cce1828"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/12 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/python-publish.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/hellmrf/pygments-portugol/python-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/hellmrf/pygments-portugol/python-publish.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:23","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:24","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-19T10:55:55.060Z","repository_id":52518016,"created_at":"2025-08-19T10:55:55.060Z","updated_at":"2025-08-19T10:55:55.060Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35741142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-21T02:00:06.728Z","response_time":109,"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":["minted","portugol-studio","pygments"],"created_at":"2026-07-21T23:39:12.084Z","updated_at":"2026-07-21T23:39:12.903Z","avatar_url":"https://github.com/hellmrf.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pygments_Portugol\n\n[Pygments](https://pygments.org/) é um excelente pacote em Python destinado à coloração de sintaxe (_syntax highlighting_), sendo possível utilizá-lo, inclusive, em documentos LaTeX. Este pacote fornece um _lexer_ para a linguagem [Portugol Studio](http://lite.acad.univali.br/portugol/).\n\n## Instalação\n\nApós a instalação do Python 3, você provavelmente poderá executar o comando a seguir a fim de instalar o Pygments:\n\n```sh\n$ pip install pygments\n```\n\n\u003e Note que `$` indica o _prompt_ do _shell_, você não deve digitar isso.\n\nAlgumas variações desse comando podem aparecer a depender da plataforma, por exemplo:\n\n```sh\n$ pip3 install pygments\n$ python3 -m pip install pygments\n$ python -m pip install pygments\n```\n\nApós instalar com sucesso o Pygments, você pode instalar o _lexer_ para Portugol Studio:\n\n```sh\n$ pip install pygments-portugol\n```\n\n## Utilização\n\nPara utilizar o _lexer_, o procedimento é equivalente a qualquer outra linguagem suportada pelo Pygments. Utilize `portugol` ou `portugolstudio` como nome da linguagem. Por exemplo, o código em Python a seguir ilustra como ler um arquivo [`code.por`](https://github.com/hellmrf/pygments-portugol/blob/main/examples/code.por) e salvar em HTML no arquivo [`formatted.html`](https://github.com/hellmrf/pygments-portugol/blob/main/examples/formatted.html).\n\n```python\nfrom pygments import highlight\nfrom pygments.lexers import get_lexer_by_name\nfrom pygments.formatters import HtmlFormatter\n\nwith open(\"./code.por\", \"r\") as fl:\n    code = fl.read()\n\nlexer = get_lexer_by_name(\"portugol\", stripall=True)\nformatter = HtmlFormatter(linenos=True, noclasses=True)\nresult = highlight(code, lexer, formatter)\n\nwith open(\"./formatted.html\", \"w\") as fl:\n    fl.write(result)\n```\n\n[Clique aqui para ver o resultado](https://htmlpreview.github.io/?https://github.com/hellmrf/pygments-portugol/blob/main/examples/formatted.html).\n\n### Utilização com LaTeX\n\nPara tipografar um código em LaTeX com o Pygments, pode-se utilizar o pacote [`minted`](https://www.ctan.org/pkg/minted). O código a seguir é um exemplo. A fonte DejaVuSansMono foi utilizada apenas por questões estéticas. As duas linhas referentes à fonte podem ser removidas ou substituídas. Caso queira usar pdfLaTeX, remova-as.\n\n```latex\n% !TeX program = xelatex\n\\documentclass{article}\n\\usepackage{fontspec} % remover caso esteja usando pdfLaTeX\n\\usepackage{DejaVuSansMono} % remover caso esteja usando pdfLaTeX\n\\setmonofont[Scale=MatchLowercase]{DejaVuSansMono} % remover caso esteja usando pdfLaTeX\n\n\\usepackage{minted} % importa o pacote para que possamos usar\n\\begin{document}\nO código a seguir ilustra um fatorial recursivo no Portugol Studio.\n\n\\begin{minted}[autogobble, linenos]{portugol}\n    programa\n    {\n        funcao inicio()\n        {\n            inteiro numero\n\n            escreva(\"Digite um número: \")\n            leia(numero)\n\n            limpa()\n            escreva(\"O fatorial de \", numero, \" é: \", fatorial(numero), \"\\n\")\n        }\n\n        // Função recursiva que calcula o fatorial do número passado\n\n        funcao inteiro fatorial(inteiro numero)\n        {\n            se (numero == 1 ou numero == 0)\n            {\n                retorne 1\n            }\n\n            retorne numero * fatorial(numero - 1)\n        }\n    }\n\\end{minted}\n\\end{document}\n```\n\nResultado:\n[![](https://github.com/hellmrf/pygments-portugol/blob/main/examples/latex.png)](https://github.com/hellmrf/pygments-portugol/blob/main/examples/latex.png)\n\nVeja [este tutorial](https://www.overleaf.com/learn/latex/Code_Highlighting_with_minted) se quiser ver outras possibilidades, como escolher cores diferentes ou importar de um arquivo externo.\n\n### Utilização em LaTeX no Overleaf\n\nCaso você tenha o costume de usar Overleaf, pode ter lido a seção anterior e pensado que é impossível instalar um pacote Python no Overleaf. Sim, é verdade. Felizmente, é possível utilizar um _lexer_ sem instalação obrigatória.\n\n1. Copie o arquivo do _lexer_ ([este](https://github.com/hellmrf/pygments-portugol/blob/main/pygments_portugol/__init__.py)) e salve como, por exemplo, `PortugolStudioLexer.py`.\n\n2. Coloque no mesmo diretório do seu arquivo `.tex`;\n\n3. Substitua o nome da linguagem por `PortugolStudioLexer.py:PortugolStudioLexer -x`.\n\n4. O código deve ser assim (veja o exemplo completo na seção anterior):\n\n```latex\n% ...\n\\begin{minted}[autogobble, linenos]{PortugolStudioLexer.py:PortugolStudioLexer -x}\n    // seu código\n\\end{minted}\n% ...\n```\n\nIsto pode ser recomendado para projetos maiores, para reduzir a quantidade de dependências que outros colaboradores precisarão instalar (o mesmo vale para fontes personalizadas). Para projetos menores, entretanto, é mais prático instalar e apenas utilizar o nome da linguagem.\n\n## Contribuição\n\nCaso note algo de errado, fique à vontade para abrir uma _issue_ ou, ainda melhor, enviar o seu Pull Request.\n\n## Autor\n\nDesenvolvido por [Héliton Martins](mailto:helitonmrf@gmail.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellmrf%2Fpygments-portugol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellmrf%2Fpygments-portugol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellmrf%2Fpygments-portugol/lists"}