Virastar Library

Cleaning-up Persian Texts!

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/527228/1538801/Virastar%20Library.js

作者
Amm1rr
版本
0.21.0
创建于
2025-02-17
更新于
2025-02-17
大小
33.4 KB
许可证
MIT

Virastar is a JavaScript library designed to process and standardize Persian text, enhancing its readability and ensuring compatibility across various platforms. It offers a comprehensive suite of functions that address common typographical and formatting issues in Persian writing.

Key Features:

  • Normalization of End-of-Line Characters: Converts Windows-style line breaks to Unix-style, ensuring consistent text formatting.

  • HTML Entity Decoding: Transforms numeric and selected HTML character entities into their corresponding characters, preserving the integrity of the text.

  • Dash Correction: Replaces triple dashes with an em dash and double dashes with an en dash, adhering to proper punctuation standards.

  • Ellipsis Standardization: Removes spaces between dots and replaces multiple dots with a single ellipsis character, maintaining typographical accuracy.

  • Date Formatting: Reorders date components and replaces delimiters with slashes, aligning with standard Persian date conventions.

  • Quotation Mark Replacement: Substitutes English quotation marks with their Persian equivalents, ensuring consistency in punctuation.

  • Hamzeh Correction: Addresses common issues with the Persian letter 'ه' followed by 'ی' or 'ء', replacing them with the standard 'هٔ'.

  • Arabic Character Conversion: Converts Arabic characters to their Persian counterparts, standardizing the script.

  • Zero-Width Non-Joiner (ZWNJ) Management: Cleans unnecessary ZWNJ characters, particularly around numbers, English words, spaces, and punctuation marks, to prevent unwanted word breaks.

  • Number Conversion: Replaces Arabic and English numerals with their Persian equivalents, ensuring numerical consistency.

  • Punctuation Standardization: Replaces English punctuation marks with their Persian counterparts, maintaining typographical consistency.

  • Spacing Adjustments: Removes unnecessary spaces before and after punctuation marks, parentheses, and braces, adhering to proper spacing conventions.

  • Diacritic Management: Cleans up diacritic characters, ensuring they are correctly placed and do not interfere with text readability.

  • Preservation Options: Allows for the preservation of frontmatter, HTML tags, comments, entities, URIs, and specific brackets or braces, providing flexibility in text processing.

By integrating Virastar into your projects, you can automate the cleaning and standardization of Persian text, leading to improved readability and consistency across your applications.