Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v0.1.0 #2

Merged
merged 2 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
name: Release-Nightly
name: Attach Release Asset

on:
push:
branches:
- main

tags:
- 'v*.*.*'
jobs:
build:
name: Build and Release
Expand Down Expand Up @@ -46,7 +47,7 @@ jobs:
with:
name: macos-latest-binary

- name: Create Release
- name: Create Release (nightly)
uses: softprops/action-gh-release@v1
with:
tag_name: nightly
Expand All @@ -55,3 +56,12 @@ jobs:
files: |
ubuntu-latest.tar.gz
macos-latest.tar.gz

- name: Create Release(Release)
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/v')
with:
tag_name: ${{ github.ref }}
files: |
ubuntu-latest.tar.gz
macos-latest.tar.gz
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.1.0

Initial Release
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright 2024 piyoppi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
## Usage

```
chiritori --filename=./sample-code.html
chiritori --filename=./samples/sample-code.html
```

This command will remove the parts of the following source code bounded by the "time-limited" element.
Expand All @@ -16,7 +16,10 @@ This command will remove the parts of the following source code bounded by the "
<body>
<h1>Hello World</h1>
<!-- time-limited to="2024/02/15 12:00:00" -->
<h2>Campaign until 2024/02/15 12:00</h2>
<h2>Campaign until 2024/02/15 12:00</h2>
<!-- /time-limited -->
<!-- time-limited to="9999/12/31 23:59:59" -->
<h2>Campaign until 9999/12/31</h2>
<!-- /time-limited -->
</body>
</html>
Expand All @@ -27,22 +30,34 @@ This command will remove the parts of the following source code bounded by the "
<html>
<body>
<h1>Hello World</h1>
<!-- time-limited to="9999/12/31 23:59:59" -->
<h2>Campaign until 9999/12/31</h2>
<!-- /time-limited -->
</body>
</html>
```

For more options, run the following commands.

```
chiritori --help
```

The delimiter for representing an element can be changed via command line arguments.
This allows any programming language to be used.

```
chiritori \
--filename=./sample-code.js \
--time-limited-delimiter-start="// --" \
--time-limited-delimiter-end="-- //"
--filename=./samples/sample-code.js \
--delimiter-start="// --" \
--delimiter-end="-- //" \
--time-limited-tag-name="time-limited-code"
```

### Supported character code

Only UTF-8 character encoding is supported. If you want to enter other character codes, you need to convert it.

```
iconv -f euc-jp -t utf-8 ./sample-code.php | chiritori
```
iconv -f euc-jp -t utf-8 ./sample-code.php | chiritori | iconv -f utf-8 -t euc-jp
```
10 changes: 8 additions & 2 deletions samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

Run Chiritori with the sample code in this directory to experience how it works.

## HTML

```
chiritori --filename=./samples/sample-code.html
```

## JavaScript

```
chiritori --filename=sample-code.js --time-limited-delimiter-start="// --" --time-limited-delimiter-end="-- //"
chiritori --filename=./samples/sample-code.js --delimiter-start="// --" --delimiter-end="-- //" --time-limited-tag-name="time-limited-code"
```

## PHP (EUC-JP encoding)

```
iconv -f euc-jp -t utf-8 sample-code.eucjp.php | chiritori --time-limited-delimiter-start="# <" --time-limited-delimiter-end="> #"
```
```
27 changes: 27 additions & 0 deletions samples/sample-code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<title>Sample Code</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Hello World</h1>
<p>This is a sample page with some code.</p>
<!-- time-limited to="2019-12-31 23:59:59" -->
<p>This content is only available until the end of the year.</p>
<p>After that, it will be removed from the page.</p>
<!-- /time-limited -->
<!-- time-limited to="2999-12-31 23:59:59" -->
Campaign!
<!-- time-limited to="2001-12-31 23:59:59" -->
40% off! Only until the 2001/12/31!
<!-- /time-limited -->
<!-- /time-limited -->
<!-- time-limited to="2001-12-31 23:59:59" -->
<!-- time-limited to="2999-12-31 23:59:59" -->
Campaign!
<!-- /time-limited -->
until the 2001/12/31!
<!-- /time-limited -->
</body>
</html>
12 changes: 6 additions & 6 deletions samples/sample-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

function main() {
console.log('Hello, World! 1');
// -- time-limited code to="2020-12-31 23:59:59" -- //
// -- time-limited-code to="2020-12-31 23:59:59" -- //
console.log('🧹This code will be removed after 2020-12-31T23:59:59.999Z');
// -- /time-limited -- //
// -- /time-limited-code -- //

// -- time-limited code to="2099-12-31 23:59:59" -- //
// -- time-limited-code to="2099-12-31 23:59:59" -- //
console.log('📌This code will be removed after 2099-12-31T23:59:59.999Z');
// -- /time-limited -- //
// -- /time-limited-code -- //

// -- time-limited code to="2020-12-31 23:59:59" -- //
// -- time-limited-code to="2020-12-31 23:59:59" -- //
console.log('🧹This code will be removed after 2020-12-31T23:59:59.999Z');
// -- /time-limited -- //
// -- /time-limited-code -- //
console.log('Hello, World! 2');
}
5 changes: 5 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,23 @@ struct Args {
#[arg(short, long)]
output: Option<String>,

/// The tag name for time-limited content
#[arg(long, default_value = "time-limited")]
time_limited_tag_name: String,

/// The time offset for time-limited content
#[arg(long, default_value = "+00:00")]
time_limited_time_offset: String,

/// The current time for time-limited content
#[arg(long, default_value = "")]
time_limited_current: String,

/// The delimiter start
#[arg(long, default_value = "<!--")]
delimiter_start: String,

/// The delimiter end
#[arg(long, default_value = "-->")]
delimiter_end: String,
}
Expand Down
Loading