Skip to content

Commit

Permalink
chore: rename to typstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Enter-tainer committed Mar 16, 2024
1 parent 3773147 commit 37bed26
Show file tree
Hide file tree
Showing 36 changed files with 81 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- run: |
cd web
yarn
yarn build --base=/typst-geshihua
yarn build --base=/typstyle
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
Expand Down
48 changes: 24 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: Enter-tainer/typst-geshihua
slug: Enter-tainer/typstyle

build:
needs: [pre_build, test]
Expand Down Expand Up @@ -117,54 +117,54 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install gcc-arm-linux-gnueabihf
- name: Build typst-geshihua binary
- name: Build typstyle binary
shell: pwsh
run: |
cargo build --release --target ${{ matrix.rust-target }}
- name: Rename debug symbols for windows
if: matrix.platform == 'win32'
run: |
cd target/${{ matrix.rust-target }}/release
cp typst_geshihua.pdb typst_geshihua-${{ env.target }}.pdb
cp typstyle.pdb typstyle-${{ env.target }}.pdb
- name: Upload split debug symbols for windows
if: matrix.platform == 'win32'
uses: actions/upload-artifact@v4
with:
name: typst_geshihua-${{ env.target }}.pdb
path: target/${{ matrix.rust-target }}/release/typst_geshihua-${{ env.target }}.pdb
name: typstyle-${{ env.target }}.pdb
path: target/${{ matrix.rust-target }}/release/typstyle-${{ env.target }}.pdb
- name: Split debug symbols for linux
if: matrix.platform == 'linux'
run: |
cd target/${{ matrix.rust-target }}/release
llvm-objcopy --compress-debug-sections --only-keep-debug "typst-geshihua" "typst-geshihua-${{ env.target }}.debug"
llvm-objcopy --strip-debug --add-gnu-debuglink="typst-geshihua-${{ env.target }}.debug" "typst-geshihua"
llvm-objcopy --compress-debug-sections --only-keep-debug "typstyle" "typstyle-${{ env.target }}.debug"
llvm-objcopy --strip-debug --add-gnu-debuglink="typstyle-${{ env.target }}.debug" "typstyle"
- name: Upload split debug symbols for linux
if: matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: typst-geshihua-${{ env.target }}.debug
path: target/${{ matrix.rust-target }}/release/typst-geshihua-${{ env.target }}.debug
name: typstyle-${{ env.target }}.debug
path: target/${{ matrix.rust-target }}/release/typstyle-${{ env.target }}.debug
compression-level: 0
- name: Collect debug symbols for mac
if: matrix.platform == 'darwin'
run: |
dsymutil -f "target/${{ matrix.rust-target }}/release/typst-geshihua"
mv "target/${{ matrix.rust-target }}/release/typst-geshihua.dwarf" "target/${{ matrix.rust-target }}/release/typst-geshihua-${{ env.target }}.dwarf"
dsymutil -f "target/${{ matrix.rust-target }}/release/typstyle"
mv "target/${{ matrix.rust-target }}/release/typstyle.dwarf" "target/${{ matrix.rust-target }}/release/typstyle-${{ env.target }}.dwarf"
- name: Upload split debug symbols for mac
if: matrix.platform == 'darwin'
uses: actions/upload-artifact@v4
with:
name: typst-geshihua-${{ env.target }}.dwarf
path: target/${{ matrix.rust-target }}/release/typst-geshihua-${{ env.target }}.dwarf
name: typstyle-${{ env.target }}.dwarf
path: target/${{ matrix.rust-target }}/release/typstyle-${{ env.target }}.dwarf
- name: Copy binary to output directory
shell: pwsh
run: |
cp "target/${{ matrix.rust-target }}/release/typst-geshihua$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "typst-geshihua-${{ env.target }}$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )"
cp "target/${{ matrix.rust-target }}/release/typstyle$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )" "typstyle-${{ env.target }}$(If ('${{ matrix.platform }}' -eq 'win32') { '.exe' } else { '' } )"
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: typst-geshihua-${{ env.target }}
path: typst-geshihua-${{ env.target }}${{ fromJSON('["", ".exe"]')[matrix.platform == 'win32'] }}
name: typstyle-${{ env.target }}
path: typstyle-${{ env.target }}${{ fromJSON('["", ".exe"]')[matrix.platform == 'win32'] }}

build_alpine:
needs: [pre_build, test]
Expand All @@ -187,27 +187,27 @@ jobs:
submodules: recursive
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Build typst-geshihua binary
- name: Build typstyle binary
run: |
cargo build --release --target $RUST_TARGET
- name: Split debug symbols
run: |
cd target/$RUST_TARGET/release
objcopy --compress-debug-sections --only-keep-debug "typst-geshihua" "typst-geshihua-${{ env.target }}.debug"
objcopy --strip-debug --add-gnu-debuglink="typst-geshihua-${{ env.target }}.debug" "typst-geshihua"
objcopy --compress-debug-sections --only-keep-debug "typstyle" "typstyle-${{ env.target }}.debug"
objcopy --strip-debug --add-gnu-debuglink="typstyle-${{ env.target }}.debug" "typstyle"
- name: Upload split debug symbols
uses: actions/upload-artifact@v4
with:
name: typst-geshihua-${{ env.target }}.debug
path: target/${{ env.RUST_TARGET }}/release/typst-geshihua-${{ env.target }}.debug
name: typstyle-${{ env.target }}.debug
path: target/${{ env.RUST_TARGET }}/release/typstyle-${{ env.target }}.debug
- name: Copy binary to output directory
run: |
cp "target/${{ env.RUST_TARGET }}/release/typst-geshihua" "typst-geshihua-${{ env.target }}"
cp "target/${{ env.RUST_TARGET }}/release/typstyle" "typstyle-${{ env.target }}"
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: typst-geshihua-${{ env.target }}
path: typst-geshihua-${{ env.target }}
name: typstyle-${{ env.target }}
path: typstyle-${{ env.target }}

release:
runs-on: ubuntu-latest
Expand Down
36 changes: 18 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "typst-geshihua"
name = "typstyle"
version = "0.11.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[[bin]]
name = "typst-geshihua"
name = "typstyle"
path = "src/main.rs"

[lib]
name = "typst_geshihua"
name = "typstyle"
path = "src/lib.rs"
crate-type = ["cdylib", "lib"]

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# typst-geshihua
# typstyle

[![codecov](https://codecov.io/gh/Enter-tainer/typst-geshihua/graph/badge.svg?token=Y2SuYfwd7y)](https://codecov.io/gh/Enter-tainer/typst-geshihua)
[![codecov](https://codecov.io/gh/Enter-tainer/typstyle/graph/badge.svg?token=Y2SuYfwd7y)](https://codecov.io/gh/Enter-tainer/typstyle)

Usage:
```
Usage: typst-geshihua [OPTIONS] <INPUT>
Usage: typstyle [OPTIONS] <INPUT>
Arguments:
<INPUT> Path to the input file
Expand All @@ -20,9 +20,9 @@ Options:

## Escape Route

If you find typst-geshihua is not working as expected, you can use `// @geshihua off` or `/* @geshihua off */` to disable the formatter on the next node of code.
If you find typstyle is not working as expected, you can use `// @typstyle off` or `/* @typstyle off */` to disable the formatter on the next node of code.

And please let us know the issue by creating an issue on the [GitHub repository](https://github.com/Enter-tainer/typst-geshihua)
And please let us know the issue by creating an issue on the [GitHub repository](https://github.com/Enter-tainer/typstyle)

## Test

Expand Down
4 changes: 2 additions & 2 deletions examples/pretty_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use pretty::BoxDoc;
use typst_geshihua::util::pretty_items;
use typstyle::util::pretty_items;

fn main() {
let strs = ["123", "12345", "1234", "1234567"];
Expand All @@ -11,7 +11,7 @@ fn main() {
BoxDoc::text(","),
(BoxDoc::text("["), BoxDoc::text("]")),
false,
typst_geshihua::util::FoldStyle::Fit,
typstyle::util::FoldStyle::Fit,
);

let res_10 = outer.pretty(10).to_string();
Expand Down
2 changes: 1 addition & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clap::Parser;
use once_cell::sync::Lazy;

#[derive(Debug, Clone, Parser)]
#[clap(name = "typst-geshihua", author, version, about, long_version(LONG_VERSION.as_str()))]
#[clap(name = "typstyle", author, version, about, long_version(LONG_VERSION.as_str()))]
pub struct CliArguments {
/// Path to the input file
pub input: PathBuf,
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use clap::Parser;
use typst_geshihua::{prop::get_no_format_nodes, PrettyPrinter};
use typstyle::{prop::get_no_format_nodes, PrettyPrinter};
use typst_syntax::parse;

use crate::cli::CliArguments;
Expand Down
2 changes: 1 addition & 1 deletion src/prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn get_no_format_nodes_impl(node: SyntaxNode, map: &mut HashSet<SyntaxNode>) {
let mut no_format = false;
for child in node.children() {
if child.kind() == SyntaxKind::LineComment || child.kind() == SyntaxKind::BlockComment {
if child.text().contains("@geshihua off") {
if child.text().contains("@typstyle off") {
no_format = true;
map.insert(child.clone());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/assets.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extern crate libtest_mimic;

use libtest_mimic::{Arguments, Failed, Trial};
use typst_geshihua::pretty_print;
use typstyle::pretty_print;

use std::{env, error::Error, ffi::OsStr, fs, path::Path};

Expand Down
4 changes: 2 additions & 2 deletions tests/assets/unit/off/code-block.typ
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#let alert(body, fill: red) = {
set text(white)
set align(center)
// @geshihua off
// @typstyle off
rect(
fill: fill,
inset: 8pt,
radius: 4pt, [*Warning:\ #body*],
)
}

// @geshihua off
// @typstyle off
#alert[
Danger is imminent!]
4 changes: 2 additions & 2 deletions tests/assets/unit/off/content-func-call.typ
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

#table(
columns: /* @geshihua off */ (1fr,
columns: /* @typstyle off */ (1fr,
auto, auto),
inset: 10pt, align: horizon,[],
[*Area*],
[*Parameters*],
[Some image],
$ pi h (D^2 - d^2) / 4 $,
/* @geshihua off */ [
/* @typstyle off */ [
$h$: height \
$D$: outer radius \
$d$: inner radius
Expand Down
4 changes: 2 additions & 2 deletions tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ input_file: tests/assets/unit/off/code-block.typ
#let alert(body, fill: red) = {
set text(white)
set align(center)
// @geshihua off
// @typstyle off
rect(
fill: fill,
inset: 8pt,
radius: 4pt, [*Warning:\ #body*],
)
}

// @geshihua off
// @typstyle off
#alert[
Danger is imminent!]
4 changes: 2 additions & 2 deletions tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ input_file: tests/assets/unit/off/code-block.typ
#let alert(body, fill: red) = {
set text(white)
set align(center)
// @geshihua off
// @typstyle off
rect(
fill: fill,
inset: 8pt,
radius: 4pt, [*Warning:\ #body*],
)
}

// @geshihua off
// @typstyle off
#alert[
Danger is imminent!]
4 changes: 2 additions & 2 deletions tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ input_file: tests/assets/unit/off/code-block.typ
#let alert(body, fill: red) = {
set text(white)
set align(center)
// @geshihua off
// @typstyle off
rect(
fill: fill,
inset: 8pt,
radius: 4pt, [*Warning:\ #body*],
)
}

// @geshihua off
// @typstyle off
#alert[
Danger is imminent!]
4 changes: 2 additions & 2 deletions tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ expression: doc_string
input_file: tests/assets/unit/off/content-func-call.typ
---
#table(
columns: /* @geshihua off */ (1fr,
columns: /* @typstyle off */ (1fr,
auto, auto),
inset: 10pt, align: horizon,[],
[*Area*],
[*Parameters*],
[Some image],
$ pi h (D^2 - d^2) / 4 $,
/* @geshihua off */ [
/* @typstyle off */ [
$h$: height \
$D$: outer radius \
$d$: inner radius
Expand Down
4 changes: 2 additions & 2 deletions tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ expression: doc_string
input_file: tests/assets/unit/off/content-func-call.typ
---
#table(
columns: /* @geshihua off */ (1fr,
columns: /* @typstyle off */ (1fr,
auto, auto),
inset: 10pt, align: horizon,[],
[*Area*],
[*Parameters*],
[Some image],
$ pi h (D^2 - d^2) / 4 $,
/* @geshihua off */ [
/* @typstyle off */ [
$h$: height \
$D$: outer radius \
$d$: inner radius
Expand Down
Loading

0 comments on commit 37bed26

Please sign in to comment.