Method and device for extracting cascading style sheet
A cascading style sheet and extraction method technology, applied in the computer field, can solve the problems of low extraction efficiency and long time consumption, and achieve the effect of realizing automation, improving extraction efficiency, and avoiding long extraction time
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0040] figure 1 It is a schematic flowchart of a method for extracting CSS provided in this application, and the method may be as follows.
[0041] Step 101: Convert the code data corresponding to the HTML file to be processed into JSON data.
[0042] Wherein, the JSON data includes at least one JSON node, and the JSON node corresponds to the subcode data used to realize the set logic function in the code data.
[0043]In step 101, for each website, the webpage contained in the website can correspond to one or more HTML files respectively, the HTML file mentioned here refers to the HTML file generated after the webpage code is compiled, and the HTML file contains the content of the webpage The corresponding code data and the code data corresponding to the web page display style, then the HTML file to be processed described in the embodiment of the present application may refer to the HTML file mentioned here.
[0044] Firstly, the HTML file to be processed is obtained, and t...
Embodiment 2
[0093] image 3 It is a schematic flowchart of a method for generating an HTML file provided by the embodiment of the present application. The method can be as follows.
[0094] Step 301: Convert the code data corresponding to the first HTML file to be processed into JSON data.
[0095] Wherein, the JSON data includes at least one JSON node, and the JSON node corresponds to the subcode data used to realize the set logic function in the code data.
[0096] In step 301, the method for converting the code data corresponding to the first HTML file to be processed into JSON data is the same as the method used in step 101 in Embodiment 1.
[0097] Step 302: traverse the JSON nodes included in the JSON data, extract subcode data corresponding to style logic functions included in the JSON nodes, and store the extracted subcode data in a Cascading Style Sheet CSS file.
[0098] In step 302, the method for traversing the JSON nodes contained in the JSON data is the same ...
Embodiment 3
[0105] Figure 4 It is a schematic structural diagram of a CSS extraction device provided in this application. The CSS extraction device includes: a conversion unit 401, a traversal unit 402, an extraction unit 403, and a storage unit 404, wherein:
[0106] A conversion unit 401, configured to convert the code data corresponding to the HTML file to be processed into JSON data, wherein the JSON data includes at least one JSON node, and the JSON node corresponds to the code data used to implement the setting logic in the code data function's subcode data;
[0107] A traversal unit 402, configured to traverse the JSON nodes contained in the JSON data;
[0108] An extracting unit 403, configured to extract the subcode data corresponding to the style logic function included in the JSON node;
[0109] The storage unit 404 is configured to store the extracted subcode data in a CSS file.
[0110] In another embodiment of the present application, the conversion unit 401...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


