There are defined fonts in the large frame of the website, including font size and color, which may be copied from other websites when the user publishes the article, and the copying process retains the font description information. When the article is displayed on the page, the font defined in the article is used by default and the global font defined in the large frame is displayed if the font does not exist in the article. Therefore the content of the website will appear very messy, some article font is very big, some article font is very small, not beautiful. It's good to be unified!
I'm not familiar with HTML and CSS, and I don't know if I can set the font content defined in the article to expire.
Stupid people have stupid way, unified change the article, the user's definition of the font are all deleted! Ha ha! If done by hand, this is a very heavy task, to first preview the page, if not unified to modify the font, fortunately, the editor has a "clear format" option, select Text, click on OK, and then save ... And it's troublesome.
If only to modify the font, the most convenient way is to directly modify the database, from the database to extract the article, delete and font-related tags, and then write back to the database.
Specifically looked at the HTML reference manual, the definition of fonts there are two ways:
1. The label is used, for example:
The code is as follows:
This is a paragraph.
This is another paragraph.
This method is not recommended for use
2. Use the style definition, for example:
The code is as follows:
This was a paragraph with some text in it. This was a paragraph with some text in it. This was a paragraph with some text in it. This was a paragraph with some text in it.
As long as you delete the definition part of the font, you can replace it with Python's regular expression module, without pressure:
The code is as follows:
def format (data):
"' Delete all font tags and style tags '
p = re.compile (r ' | | Style=\ ". *?\" ')
ret = P.sub (", data)
IF RET! = data:
Return Retelse:
Return None
Python should be aware of updating data methods when dealing with database related operations, which can be referenced in this article: http://www.cnblogs.com/ma6174/archive/2013/02/21/2920126.html