feat: enhance tag formatting options
- Update formatting to replace spaces with underscores - Add functionality to replace hyphens with underscores - Clarify comments to reflect new formatting behavior These changes improve the flexibility of the tag formatting method by allowing both spaces and hyphens to be standardized as underscores, ensuring consistent tag representations.
This commit is contained in:
parent
9ff27cbe4d
commit
f4337240f7
@ -2,8 +2,9 @@ module TagHelper
|
||||
def format_as_tag(text)
|
||||
return nil if text.blank?
|
||||
|
||||
# 下划线方式 (选项1)
|
||||
# 空格改为下划线
|
||||
text.strip.gsub(/\s+/, "_")
|
||||
text.strip.gsub("-", "_")
|
||||
|
||||
# 或者删除空格 (选项2)
|
||||
# text.strip.gsub(/\s+/, '')
|
||||
|
Loading…
Reference in New Issue
Block a user