From b50dd208d54c501b80bd4862d0d3aa8b0864823f Mon Sep 17 00:00:00 2001 From: Linexus <153648356@qq.com> Date: Wed, 3 Jun 2026 16:12:12 +0800 Subject: [PATCH] import glow --- README.en.md | 36 -------------- README.md | 39 --------------- glow.spec | 116 +++++++++++++++++++++++++++++++++++++++++++ go-vendor-tools.toml | 27 ++++++++++ sources | 2 + 5 files changed, 145 insertions(+), 75 deletions(-) delete mode 100644 README.en.md delete mode 100644 README.md create mode 100644 glow.spec create mode 100644 go-vendor-tools.toml create mode 100644 sources diff --git a/README.en.md b/README.en.md deleted file mode 100644 index 35d568f..0000000 --- a/README.en.md +++ /dev/null @@ -1,36 +0,0 @@ -# glow - -#### Description -{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**} - -#### Software Architecture -Software architecture description - -#### Installation - -1. xxxx -2. xxxx -3. xxxx - -#### Instructions - -1. xxxx -2. xxxx -3. xxxx - -#### Contribution - -1. Fork the repository -2. Create Feat_xxx branch -3. Commit your code -4. Create Pull Request - - -#### Gitee Feature - -1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md -2. Gitee blog [blog.gitee.com](https://blog.gitee.com) -3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) -4. The most valuable open source project [GVP](https://gitee.com/gvp) -5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) -6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md deleted file mode 100644 index 007ede2..0000000 --- a/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# glow - -#### 介绍 -{**以下是 Gitee 平台说明,您可以替换此简介** -Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN)。专为开发者提供稳定、高效、安全的云端软件开发协作平台 -无论是个人、团队、或是企业,都能够用 Gitee 实现代码托管、项目管理、协作开发。企业项目请看 [https://gitee.com/enterprises](https://gitee.com/enterprises)} - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/glow.spec b/glow.spec new file mode 100644 index 0000000..d7b5601 --- /dev/null +++ b/glow.spec @@ -0,0 +1,116 @@ +%bcond_without check + +%global goipath github.com/charmbracelet/glow/v2 +%define go_use_new_versioning 1 +Name: glow +Version: 2.1.2 +%gometa + +Summary: Terminal based markdown reader + +Release: 1%{?dist} +License: MIT +URL: %{gourl} +Source0: %{gosource} +Source1: %{archivename}-vendor.tar.bz2 +Source2: go-vendor-tools.toml + +BuildRequires: go-rpm-macros +BuildRequires: git + +%description +Glow is a terminal based markdown reader designed from the ground up to bring +out the beauty and power of the CLI. Use it to discover markdown files, read +documentation directly on the command line. + +%prep +%goprep -A +%setup -q -T -D -a 1 %{forgesetupargs} + +%build +%global gomodulesmode GO111MODULE=on +export GOFLAGS="-mod=vendor" +export GO_LDFLAGS="-X main.Version=v%{version}" +%gobuild -o %{gobuilddir}/bin/glow %{goipath} + +%install +install -m 0755 -vd %{buildroot}%{_bindir} +install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/ +install -d -m 0755 %{buildroot}%{_mandir}/man1 +%{gobuilddir}/bin/glow man > %{buildroot}%{_mandir}/man1/glow.1 +%{gobuilddir}/bin/glow completion bash > glow.bash +%{gobuilddir}/bin/glow completion zsh > glow.zsh +%{gobuilddir}/bin/glow completion fish > glow.fish +install -Dpm 0644 glow.bash %{buildroot}%{bash_completions_dir}/%{name} +install -Dpm 0644 glow.zsh %{buildroot}%{zsh_completions_dir}/_%{name} +install -Dpm 0644 glow.fish %{buildroot}%{fish_completions_dir}/%{name}.fish + +%if %{with check} +%check +%global gomodulesmode GO111MODULE=on +export GOFLAGS="-mod=vendor" +%gocheck + +# --- Functional CLI tests against the freshly built binary (offline only) --- +# Network-fetch features (glow github.com/..., glow https://host.tld/file.md) +# are intentionally skipped: the build sandbox has no network access. +GLOW=%{gobuilddir}/bin/glow +sanitize() { sed -r 's/\x1b\[[0-9;]*[A-Za-z]//g'; } + +# --version / --help expose expected info and flags +$GLOW --version | grep -q 'v%{version}' +$GLOW --help | grep -q -- '--width' +$GLOW --help | grep -q -- '--style' + +# sample document exercising headings, bold, link, list, table, code block +cat > _glow_check.md <<'GLOWEOF' +# Heading One + +Some **bold** text and a [link](https://example.com). + +- item alpha +- item beta + +| C1 | C2 | +|----|----| +| x | y | + +```go +package main +``` +GLOWEOF + +# render via stdin (CLI mode) and assert key content survives rendering +$GLOW -s notty - < _glow_check.md | sanitize > _glow_out.txt +grep -q 'Heading One' _glow_out.txt +grep -q 'item alpha' _glow_out.txt +grep -q 'item beta' _glow_out.txt +grep -q 'C1' _glow_out.txt +grep -q 'C2' _glow_out.txt + +# word-wrap flag (-w) works +$GLOW -w 40 -s notty - < _glow_check.md > /dev/null + +# built-in dark/light styles render without error +$GLOW -s dark - < _glow_check.md > /dev/null +$GLOW -s light - < _glow_check.md > /dev/null + +# config file (glow.yml at the XDG path) is honored +mkdir -p _glowcfg/glow +printf 'style: notty\nwidth: 40\n' > _glowcfg/glow/glow.yml +XDG_CONFIG_HOME=$PWD/_glowcfg $GLOW - < _glow_check.md > /dev/null +%endif + +%files +%license vendor/modules.txt +%doc README.md +%{_bindir}/glow +%{_mandir}/man1/glow.1* +%{bash_completions_dir}/%{name} +%{zsh_completions_dir}/_%{name} +%{fish_completions_dir}/%{name}.fish + +%changelog +* Tue Jun 02 2026 kierankfli - 2.1.2-1 +- [Type] sync +- [DESC] Initial build diff --git a/go-vendor-tools.toml b/go-vendor-tools.toml new file mode 100644 index 0000000..8a9ec0d --- /dev/null +++ b/go-vendor-tools.toml @@ -0,0 +1,27 @@ +[archive] + +[archive.dependency_overrides] +# https://github.com/mattn/go-localereader/pull/1 +"github.com/mattn/go-localereader" = "2491eb6c1c75720122ef321ed7acc3a8d9de95b1" +# https://github.com/alecthomas/chroma/pull/1233 +"github.com/alecthomas/chroma/v2" = "fc18a483e6c89d611edccd82090faa05abbd49eb" +# CVE-2026-5160 +"github.com/yuin/goldmark" = "v1.7.17" + +[licensing] +detector = "askalono" + +[[licensing.licenses]] +path = "vendor/github.com/alecthomas/chroma/v2/COPYING" +sha256sum = "e7bf754e7153012a3a8ff697d21acd6c12e590d6a55f2aef8ee83616aa9a795f" +expression = "MIT AND OFL-1.1" + +[[licensing.licenses]] +path = "vendor/go.yaml.in/yaml/v3/LICENSE" +sha256sum = "d18f6323b71b0b768bb5e9616e36da390fbd39369a81807cca352de4e4e6aa0b" +expression = "Apache-2.0 AND MIT" + +[[licensing.licenses]] +path = "LICENSE" +sha256sum = "4e48affb643d6a920b82562a7bcb390ce19e04ee63fbeef22f3234bd0c410ef1" +expression = "MIT" diff --git a/sources b/sources new file mode 100644 index 0000000..824d1b0 --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (glow-2.1.2.tar.gz) = 0fc423212a59f95dbd946d8c39329fcebdbe59eba4eaf5efee426615c25f2eac4d22dbc1a4793952fa8ca93a48b81189259417bc17bd94220dca7a970592de79 +SHA512 (glow-2.1.2-vendor.tar.bz2) = 5073139cd9cccd726355a5001d561f304afa6f2fda687362d5147a03f145afb53ed40ef48b4a95b222abbf773e64743af5f2508377bf79ac875e31320eb1dff1 -- Gitee