文件操作 - single-line.py
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/bluefish/plugins/zencoding/filters/single-line.py
编辑文件内容
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Output abbreviation on a single line (i.e. no line breaks) @author Sergey Chikuyonok (serge.che@gmail.com) @link http://chikuyonok.ru ''' import re import zencoding re_nl = re.compile(r'[\n\r]') re_pad = re.compile(r'^\s+') @zencoding.filter('s') def process(tree, profile): for item in tree.children: if item.type == 'tag': # remove padding from item item.start = re_pad.sub('', item.start) item.end = re_pad.sub('', item.end) # remove newlines item.start = re_nl.sub('', item.start) item.end = re_nl.sub('', item.end) item.content = re_nl.sub('', item.content) process(item, profile) return tree
修改文件时间
将文件时间修改为当前时间的前一年
删除文件