Cascading style sheet data generation method, system, computer equipment and storage medium

By identifying and parsing multiple data types to generate CSS codes in multiple formats, it solves the problems of single style and poor reusability of CSS code generation tools in the existing technology, and achieves more efficient CSS code generation and reuse.

CN112966198BActive Publication Date: 2024-08-27PINGAN YIQIANBAO E COMMERCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110214656.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-25
Publication Date
2024-08-27
Estimated Expiration
2041-02-25

AI Technical Summary

Technical Problem

Existing CSS code generation tools have a single style selection, few self-generated styles, and only support CSS formats, resulting in low code reuse efficiency and poor applicability.

Method used

By receiving client data, the data type is identified and the corresponding parsing strategy is used to generate the target cascading style sheet CSS code, the syntax tree of the CSS code is extracted, the syntax tree is traversed to generate the target results, and multiple data types such as preset control collections and pictures are supported. and edit text independently to generate CSS codes in multiple formats.

Benefits of technology

It improves the diversity and reusability of CSS code generation, supports code generation in multiple formats, meets different needs, and improves the applicability and efficiency of the code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112966198B
    Figure CN112966198B
Patent Text Reader

Abstract

The present invention discloses a cascading style sheet data generation method, system, computer equipment and storage medium, and relates to the technical field of data processing, including: receiving a data generation signal sent by a client, obtaining data to be processed and target template data; identifying the data type of the data to be processed, parsing the data to be processed using a parsing strategy corresponding to the data type, and generating a target cascading style sheet CSS code; extracting based on the target cascading style sheet CSS code, and obtaining a syntax tree corresponding to the target cascading style sheet CSS code; traversing the syntax tree corresponding to the target cascading style sheet CSS code based on the target template data, obtaining a target result and sending the target result to a client, thereby solving the problem that the existing current code generation tool has a relatively single style selection, and the generated style file only supports the CSS format, so the code reuse efficiency is low and the applicability is poor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a cascading style sheet data generation method, system, computer equipment and readable storage medium. Background Art

[0002] CSS (Cascading Style Sheets) is a style design language that can precisely control the position and layout of objects in a web page at the pixel level, so as to separate the web page presentation from the content. However, CSS styles are very rich, and in the development process, you need to not only remember many CSS style attributes and functions, but also control fonts, text, colors, backgrounds, etc. conveniently and precisely in the development process to make the web page content more colorful, which is a lot of work.

[0003] The inventors of the present invention have found in their research that there are already some online CSS code generation tools, but the current code generation tools have relatively simple style selections, fewer styles that can be generated independently, and the generated style files only support CSS format, so the code reuse efficiency is low and the applicability is poor. Summary of the invention

[0004] The purpose of the present invention is to provide a cascading style sheet data generation method, system, computer device and readable storage medium, which are used to solve the problems that the existing current code generation tools have relatively single style selection, few styles that can be generated independently, and the generated style files only support CSS format, so the code reuse efficiency is low and the applicability is poor.

[0005] To achieve the above object, the present invention provides a cascading style sheet data generation method, which is applied to a CSS platform server, and includes the following:

[0006] Receive the data generation signal sent by the client, and obtain the data to be processed and the target template data;

[0007] Identify the data type of the data to be processed, parse the data to be processed using a parsing strategy corresponding to the data type, and generate a target cascading style sheet CSS code;

[0008] Extracting based on the target cascading style sheet CSS code to obtain a syntax tree corresponding to the target cascading style sheet CSS code;

[0009] The syntax tree corresponding to the target cascading style sheet CSS code is traversed based on the target template data to obtain a target result and send the target result to the client.

[0010] Further, the identifying the data type of the data to be processed, parsing the data to be processed using a parsing strategy corresponding to the data type, and generating a target cascading style sheet CSS code includes the following:

[0011] Determine the data type of the data to be processed;

[0012] When the data type of the to-be-processed data is a preset control set, a target cascading style sheet CSS code is generated according to a preset code template and the preset space set;

[0013] When the data type of the data to be processed is a picture, image recognition is performed on the data to be processed, and a target cascading style sheet CSS code is generated according to the recognition result and a preset compilation rule;

[0014] When the data type of the data to be processed is self-editable text, the data to be processed is extracted based on a preset mapping rule to generate a target cascading style sheet CSS code.

[0015] Furthermore, the image recognition is performed on the data to be processed, and a target cascading style sheet CSS code is generated according to the recognition result and a preset compilation rule, including the following:

[0016] A graphical user interface can be used to distinguish the compiler to process the data to be processed, and obtain HTML+CSS code data as a recognition result;

[0017] Extracting forward rules based on the recognition result and preset CSS data to generate target cascading style sheet CSS code;

[0018] The data to be processed and its corresponding target cascading style sheet CSS code are stored in a preset image database.

[0019] Furthermore, before the graphical user interface can distinguish the compiler to process the data to be processed, the method further includes the following:

[0020] Acquire the data to be processed, and use a preset algorithm to process the data to be processed to obtain a picture hash value corresponding to the data to be processed;

[0021] Verify, based on the hash value of the image, whether there is image data in a preset image database that is consistent with the data to be processed;

[0022] If yes, then obtaining the target cascading style sheet CSS code from the image database;

[0023] If not, a graphical user interface can be used to distinguish the compiler to process the data to be processed.

[0024] Furthermore, after sending the target result to the client, the following is also included:

[0025] Receive adjustment data sent by a client, wherein the adjustment data includes a variable identifier and a variable parameter.

[0026] The target result is updated based on the adjustment data.

[0027] The present invention also provides a cascading style sheet data generation method, which is applied to a CSS platform client and includes the following:

[0028] Monitoring a first operation of a user on a front-end page, and generating a data generation signal, data to be processed, and target template data according to the first operation;

[0029] Sending the data generation signal, the data to be processed and the target template data to the server side;

[0030] Receive the target result generated according to the data to be processed and the target template data sent by the server, and display the target result on the front-end page.

[0031] Furthermore, after displaying the target result on the front-end page, the following is also included:

[0032] Monitor the second operation of the user on the front-end page in real time, and generate adjustment data based on the second operation and send it to the server;

[0033] Receive the target result sent by the server after being updated according to the adjustment data, and display the updated target result on the front-end page.

[0034] To achieve the above object, the present invention also provides a cascading style sheet data generation system, including a server and a client:

[0035] The server includes the following: an acquisition module, which is used to receive a data generation signal sent by a client and acquire the data to be processed and the target template data;

[0036] A parsing module, used for identifying the data type of the data to be processed, parsing the data to be processed using a parsing strategy corresponding to the data type, and generating a target cascading style sheet CSS code;

[0037] An extraction module, configured to extract based on the target cascading style sheet CSS code and obtain a syntax tree corresponding to the target cascading style sheet CSS code;

[0038] A generating module, configured to traverse a syntax tree corresponding to the target cascading style sheet CSS code based on the target template data, obtain a target result and send the target result to the client;

[0039] The client includes the following: a monitoring module, which is used to monitor a first operation of a user on a front-end page, and generate a data generation signal, data to be processed, and target template data according to the first operation;

[0040] A sending module, used for sending the data generation signal, the data to be processed and the target template data to the server end;

[0041] The receiving module is used to receive the target result generated according to the data to be processed and the target template data sent by the server, and display the target result on the front-end page.

[0042] To achieve the above object, the present invention also provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the above cascading style sheet data generation method when executing the computer program.

[0043] To achieve the above objectives, the present invention also provides a computer-readable storage medium, which includes multiple storage media, each of which stores a computer program. When the computer programs stored in the multiple storage media are executed by a processor, they jointly implement the steps of the above cascading style sheet data generation method.

[0044] The present invention provides a cascading style sheet data generation method, device, computer equipment and readable storage medium. The present invention receives a data generation signal, data to be processed and target template data sent by a client to monitor user operations through an acquisition module, selects a corresponding parsing strategy according to the type of data to be processed, extracts a syntax tree corresponding to the CSS code after the parsing of the data to be processed is completed, and finally traverses the syntax tree to generate a target result consistent with the target template data format and sends it to the client. By cooperating with the client and establishing and traversing the syntax tree, the problem of a single style of style files generated by a CSS platform in the prior art and only supporting the CSS format, thereby having low code reuse efficiency and poor applicability, is solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 A system hardware diagram of an embodiment of the method for generating cascading style sheet data according to the present invention;

[0046] Figure 2 This is a flow chart of Embodiment 1 of the method for generating cascading style sheet data according to the present invention;

[0047] Figure 3 A flowchart of identifying the data type of the data to be processed, parsing the data to be processed using a parsing strategy corresponding to the data type, and generating a target cascading style sheet CSS code in the first embodiment of the cascading style sheet data generation method of the present invention;

[0048] Figure 4 The flowchart is a method for performing image recognition on the data to be processed and generating a target cascading style sheet CSS code according to the recognition result and preset compilation rules in the first embodiment of the cascading style sheet data generation method of the present invention;

[0049] Figure 5 This is a flow chart after sending the target result to the client in the first embodiment of the cascading style sheet data generating method of the present invention;

[0050] Figure 6 This is a flow chart of Embodiment 2 of the method for generating cascading style sheet data according to the present invention;

[0051] Figure 7 This is a flow chart after the target result is displayed on the front-end page in the second embodiment of the cascading style sheet data generation method of the present invention;

[0052] Figure 8 This is a flow chart of Embodiment 3 of the method for generating cascading style sheet data according to the present invention;

[0053] Fig. 9 This is a schematic diagram of program modules of a fourth embodiment of the cascading style sheet data generating device of the present invention;

[0054] Fig.10 Schematic diagram of the hardware structure of the computer device in the fifth embodiment of the computer device of the present invention.

[0055] Reference numerals:

[0056] 7. Cascading style sheet data generation system 711. Acquisition module 712. Parsing module

[0057] 713, extraction module 714, generation module 715, first update module

[0058] 721, monitoring module 722, sending module 723, receiving module

[0059] 724, second update module 8, computer device 81, memory

[0060] 82. Processor 83. Network interface DETAILED DESCRIPTION

[0061] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0062] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.

[0063] The cascading style sheet data generation method, device, computer equipment and readable storage medium provided by the present invention are applicable to the field of data processing and provide a cascading style sheet data generation method based on an acquisition module, a parsing module, an extraction module and a generation module. Figure 1 The hardware diagram of the CSS system provided by the present invention, wherein A is the server end, B and C are different clients, and the server end of the present invention (such as Figure 1 A) Receive the client through the acquisition module (such as Figure 1 B or C) generates a signal, data to be processed and target template data according to the data generated by the user operation, and adopts a parsing module to select a corresponding parsing strategy according to the type of data to be processed (for example, when the data type of the data to be processed is a preset control set, a target cascading style sheet CSS code is generated according to a preset code template and the preset control set; when the data type of the data to be processed is a picture, image recognition is performed on the data to be processed, and a target cascading style sheet CSS code is generated according to the recognition result and a preset compilation rule; when the data type of the data to be processed is an autonomously edited text, the data to be processed is extracted based on a preset mapping rule to generate a target cascading style sheet C SS code), after the parsing of the data to be processed is completed, the extraction module is used to extract the syntax tree corresponding to the CSS code, and finally the generation module traverses the syntax tree to generate the target result consistent with the target template data format, and sends it to the client so that the user can download, paste and perform other operations on the client. The above process solves the problem that the style file generated by the CSS platform in the prior art has a single style and only supports the CSS format, so the code reuse efficiency is low and the applicability is poor. In addition, after the client receives the target result and displays it on the front-end page, it is also monitored in real time by the second update module for operation, and cooperates with the first update module on the server to achieve real-time update of the target to meet user needs.

[0064] Embodiment 1

[0065] See also Figure 2 This embodiment provides a method for generating cascading style sheet data, which is applied to a CSS platform server and includes the following steps:

[0066] S100: receiving a data generation signal sent by the client, and obtaining the data to be processed and the target template data;

[0067] The above-mentioned data to be processed and target template data are obtained according to user operations. Specifically, as an example, the data to be processed is generated according to the CSS style selected by the user, and the target template data is matched from the preset template database according to the target file format to be generated selected by the user.

[0068] S200: Identify the data type of the data to be processed, parse the data to be processed using a parsing strategy corresponding to the data type, and generate a target cascading style sheet CSS code;

[0069] In this solution, the data types to be processed include preset control sets, pictures, and self-edited text. The preset control set is all preset controls selected by the user on the front-end page, and the control parameters selected by the user are matched in the preset style database, including but not limited to: common two-dimensional graphics, three-dimensional graphics, shadow effects, blur effects, theme colors, common fonts and other style CSS codes; pictures are uploaded by users, and users can upload pictures to be identified or design draft files containing layers; self-edited text is embedded in the online CSS code editor, and users can directly write code that conforms to the CSS syntax specifications to generate self-edited text. When the basic style cannot meet the needs, users can complete the corresponding style generation through custom editing. Users can generate CSS code from scratch according to the control interface provided on the page, or edit it according to the basic style provided by the platform as basic data.

[0070] Specifically, the data type of the data to be processed is identified, and the data to be processed is parsed using a parsing strategy corresponding to the data type to generate a target cascading style sheet CSS code. Figure 3 , including the following steps:

[0071] S210: Determine whether the data type of the data to be processed is a preset control set;

[0072] The data types included in this solution are as described above, and other substantially identical data types may also be added. The data type of the data to be processed can be determined by the file suffix code or by the interface source. For example, pictures require calling the user upload interface, etc.

[0073] S220-a: When the data type of the to-be-processed data is a preset control set, generating a target cascading style sheet CSS code according to a preset code template and the preset control set;

[0074] In this solution, multiple controls are preset on the client front-end page, and each control is associated with a unique parameter file stored in the preset style template database. When a control is selected, the corresponding parameter file can be directly obtained, and then the parameter file is written into the preset code template to generate CSS code.

[0075] S220-b: If not, determining again whether the data type of the to-be-processed data is a picture;

[0076] S230: If yes, perform image recognition on the data to be processed, and generate a target cascading style sheet CSS code according to the recognition result and preset compilation rules;

[0077] In the above steps, when a user uploads an image, the image needs to be identified to extract the corresponding code or relationship structure, and then compiled to obtain the CSS code. Therefore, the above image recognition is performed on the data to be processed, and the target cascading style sheet CSS code is generated according to the recognition result and the preset compilation rules. Figure 4 , including the following steps:

[0078] S231: Processing the data to be processed by using a graphical user interface distinguishable compiler to obtain HTML+CSS code data as a recognition result;

[0079] In the above steps, the Pix2Code tool is used to complete image recognition and generate the corresponding html+CSS code. The Pix2Code tool is a picture-to-code direct output tool. The image recognition is automatically realized through this tool. Other existing image recognition tools can recognize and be applied here, and can also be combined with deep learning networks to realize code recognition.

[0080] S232: extracting forward rules based on the recognition result and preset CSS data to generate target cascading style sheet CSS code;

[0081] In the above steps, the CSS data extraction forward rule is a predefined rule. The code in the image is obtained after identification by the above tool, and data is extracted from the code to generate the target cascading style sheet CSS code. Specifically, the extraction can be performed through function call extraction, etc.

[0082] S233: storing the data to be processed and its corresponding target cascading style sheet CSS code in a preset image database.

[0083] In the above steps, in order to facilitate subsequent viewing and reduce subsequent repeated recognition, the CSS code generated after recognition is stored to overcome the existing problem of being unable to query the generated records. In order to reduce the situation of repeated recognition of the same image, before using a graphical user interface to distinguish the compiler to process the data to be processed, the following steps are also included:

[0084] S230-1: Acquire the data to be processed, and use a preset algorithm to process the data to be processed to obtain a picture hash value corresponding to the data to be processed;

[0085] In the above steps, the above preset algorithms include but are not limited to the mean hash algorithm, the perceptual hash algorithm, etc. The hash value is the unique identifier of the image. Therefore, the number of times the image is recognized is determined by calculating the image hash value to avoid repeated recognition.

[0086] S230-2: Verify, according to the hash value of the image, whether there is image data consistent with the data to be processed in a preset image database;

[0087] Through step S233, each image and its corresponding target cascading style sheet CSS code are associated and stored in the preset image database, and then a search is performed to determine whether there is consistent image data. If so, the image has been identified; if not, the image has not been identified. The preset image database can also be continuously updated through the above step S233.

[0088] S230-3: If yes, obtain the target cascading style sheet CSS code from the above-mentioned preset image database;

[0089] In the above steps, if the preset image database contains image data consistent with the hash value of the image, the historically generated CSS code can be directly obtained to greatly shorten the generation process, thereby reducing the time of the generation process and improving work efficiency.

[0090] S230 - 4 : If not, executing the above S231 using a graphical user interface to distinguish the compiler to process the data to be processed.

[0091] In the above steps, if the preset image database does not contain image data consistent with the hash value of the image, the image is not recognized for the first time and needs to be processed based on the above steps S231 to S233.

[0092] S240: If not, the data type of the data to be processed is self-editable text, and the data to be processed is extracted based on a preset mapping rule to generate a target cascading style sheet CSS code.

[0093] In this solution, the self-edited text is the code that complies with the CSS syntax specifications and is written by the user through the online CSS code editor integrated in the platform, or the user can generate the CSS code after editing according to the control interface provided on the page. After receiving the self-edited text, the server will perform reverse mapping to extract the data and then feed it back to the browser, which will generate the final CSS code.

[0094] S300: extracting based on the target cascading style sheet CSS code to obtain a syntax tree corresponding to the target cascading style sheet CSS code;

[0095] In this solution, the CSS code is extracted and the syntax tree is generated by the css-tree (CSS tree) tool. The CSS tree (Cache-Sensitive Search Trees) is a cache-sensitive main memory database index. The implementation of the CSS tree includes: based on the existing ordered data a, an index array b is generated. This array b represents a complete m+1 tree (just like a complete binary tree can be stored in a one-dimensional array). m is the number of index items in each non-leaf node. The m index items naturally generate m+1 gaps (including both sides). The value of each index item is the maximum value of the data items in the left subtree of the index item. A loop is used to continuously obtain the rightmost node in the left subtree. When the leaf node is reached, the rightmost node is the maximum value. The construction order of the index tree starts from the last index item and builds forward to the root node. The last index item is located in the last internal node (pre-calculated). By constructing the CSS tree in the above manner, a syntax tree corresponding to the data to be processed can be generated, and the syntax tree can be used to convert CSS format data into other format data (including but not limited to template data in stylus / scss / sass / less / wxss formats).

[0096] Since the abstracted data does not contain special symbols (such as .#), it is extremely easy to reuse, compress, format and store after compression. It also has a clear nesting hierarchy, which is extremely convenient for generating pre-processing formats such as less, sass, and stylus that naturally support nesting. At the same time, in order to reduce the storage volume, the names of various style variables can be simplified by using a preset dictionary table. When it is necessary to restore to the corresponding style, you only need to find the corresponding variable name by looking up the corresponding dictionary table. As an example, [{"id":"fullContainer","props":{"c":"f00","fz":12,"h":20}}].

[0097] S400: Traverse the syntax tree corresponding to the target cascading style sheet CSS code based on the target template data, obtain a target result and send the target result to the client.

[0098] In the above steps, the traversal of the syntax tree is similar to the binary traversal. In each internal node of the tree, the index items in the node are binary traversed (searched) to find the next branch to go to. When it reaches the leaf node, the binary search is used to look at the data in the leaf node. If data duplication occurs during the search or traversal process, the CSS tree guide is the leftmost. The syntax tree is traversed in combination with the target template data to obtain the target result consistent with the target template data format.

[0099] In order to solve the existing problem that the target result is sent to the client, the user can only view it but cannot adjust it independently. Therefore, after the target result is sent to the client, refer to Figure 5 , and also includes the following:

[0100] S410: Receive adjustment data sent by a client, wherein the adjustment data includes a variable identifier and a variable parameter.

[0101] Specifically, the above adjustment data includes but is not limited to modifying theme colors, commonly used fonts and other styles.

[0102] S420: Update the target result based on the adjustment data.

[0103] In the above steps, as an example, for example, to modify the color color:#ff0000; color is the variable name, and the variable parameter is #ff0000, then the corresponding variable parameter is found according to the variable name, and the new variable parameter is used to replace it to achieve the update of the target result.

[0104] In the above step S300, in order to reduce the storage volume, each style variable name can be simplified by using a preset dictionary table. In the above step, the variable identifier can be matched with reference to the preset dictionary table to ensure the accuracy of the update result.

[0105] The above-mentioned data to be processed and the corresponding target data can be uploaded to the blockchain for subsequent use as reference samples or training samples. Uploading to the blockchain can ensure its security and fairness and transparency to users. The user device can download the summary information from the blockchain to verify whether the priority list has been tampered with. The corresponding target data can also be downloaded from the blockchain for sending to the client for display on the front-end page. There is no need for a generation process, which effectively improves the efficiency of voice processing.

[0106] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0107] This solution adopts different processing strategies for different types of data to be processed (preset components, images, self-edited text), generates the target cascading style sheet CSS code, and then extracts the syntax tree based on the CSS code to obtain the corresponding syntax tree. Finally, the preset template data is collected to traverse the syntax tree to obtain the target result consistent with the preset template data format, which solves the problem of not supporting other types of codes in the prior art. The generated record does not need to be edited again when the style is reused, and can be directly found in the record, which is convenient for operation and use.

[0108] Embodiment 2: This embodiment also provides a cascading style sheet data generation method, which is applied to the CSS platform service client, see Figure 6 , including the following steps:

[0109] S510: monitoring a first operation of a user on a front-end page, and generating a data generation signal, data to be processed, and target template data according to the first operation;

[0110] In the above steps, the first operation includes selecting a threshold style sheet. The CSS platform has pre-built-in commonly used CSS components, such as simple pure CSS+HTML components such as marquees, 2D carousels, 3D carousels, and switch components, and exposes a parameter customization interface, which can make specific parameter modifications as needed, and generate data to be processed and target template data based on user selections and parameter modifications.

[0111] S520: Sending the data generation signal, the data to be processed and the target template data to the server;

[0112] In this solution, during the process of monitoring the user's first operation, permission verification can also be set. As an example and not limitation, users with visitor identity can use all the above functions in full, and users with registered identity can save and submit their own CSS components, commonly used basic CSS styles, and created CSS styles, and support operations such as querying, editing, and deleting historical records.

[0113] S530: Receive a target result generated according to the data to be processed and the target template data and sent by the server, and display the target result on a front-end page.

[0114] In the above steps, the target result generated by the server according to the data to be processed and the target template data is the target data generated by executing the above S100 to S400, and the user can download and copy the target result according to the display on the front-end page.

[0115] After displaying the target results on the front-end page, refer to Figure 7 , further comprising the following steps:

[0116] S531: monitoring the second operation of the user on the front-end page in real time, and generating adjustment data based on the second operation and sending it to the server;

[0117] In the above steps, after viewing the target results displayed on the front-end page, the user can modify the theme color, common fonts, shadow effects, blur effects, etc. The user can perform a second operation on the front-end page to modify it directly, overcoming the existing situation where most codes cannot be modified after generation.

[0118] S532: receiving the target result sent by the server after being updated according to the adjustment data, and displaying the updated target result on the front-end page.

[0119] In the above steps, the updated target result is displayed on the front-end page using the preset mapping rules consistent with the above process.

[0120] Embodiment 3: This embodiment also provides a cascading style sheet data generation method, which is applied to the CSS platform, including the server side and the client side. For details, refer to Figure 8 , including the following steps:

[0121] S610: The client monitors a first operation of a user on a front-end page, generates a data generation signal, data to be processed, and target template data according to the first operation, and sends the data generation signal, data to be processed, and target template data to the server;

[0122] In the above steps, as in the above embodiment 2, the first operation is the various operations performed by the user on the front-end page, including but not limited to selecting preset components and editing parameters, uploading files and pictures, or independently editing text, etc. After the user selects the target template type and triggers the data generation signal, the data to be processed is generated according to the user operation to automatically generate the target result.

[0123] S620: The server receives a data generation signal sent by the client, and obtains the data to be processed and the target template data from the client;

[0124] In the above steps, the data to be processed obtained by the server from the client is used for subsequent parsing and extraction to generate target data.

[0125] S630: The server side identifies the data type of the data to be processed, and parses the data to be processed using a parsing strategy corresponding to the data type to generate a target cascading style sheet CSS code;

[0126] In the above steps, the data types of the data to be processed include preset control sets, pictures, and self-edited texts, and different parsing strategies are used for different types of data to be processed, as described in steps S220 to S240 in the embodiment.

[0127] S640: The server side extracts the target cascading style sheet CSS code and obtains a syntax tree corresponding to the target cascading style sheet CSS code;

[0128] In this solution, the CSS code is extracted and generated into a syntax tree through the css-tree (CSS tree) tool, and the syntax tree corresponding to the target cascading style sheet CSS code is extracted so that the format of the CSS code can be subsequently converted according to the syntax tree, which is used to solve the problem that the code format generated by the existing CSS code generator is single, resulting in a low code reuse rate.

[0129] S650: The server traverses the syntax tree corresponding to the target cascading style sheet CSS code based on the target template data, obtains a target result, and sends the target result to the client;

[0130] In the above steps, by traversing the syntax tree and writing according to the target template data, a target result consistent with the target template format selected by the user can be obtained.

[0131] S660: The client receives the target result sent by the server after being updated according to the adjustment data, and displays the updated target result on the front-end page.

[0132] After the above step S660, in order to solve the problem that the existing target result cannot be adjusted but can only be viewed, the following steps are also included:

[0133] S671: The client monitors the second operation of the user on the front-end page in real time, and generates adjustment data based on the second operation and sends it to the server;

[0134] S672: After receiving the adjustment data sent by the client, the server updates the target result based on the adjustment data, and sends the updated target result to the client;

[0135] S673: The client receives the target result sent by the server after being updated according to the adjustment data, and displays the updated target result on the front-end page.

[0136] Through the above steps S671 to S673, after the user views the target results displayed on the front-end page, the user is not limited to modifying the theme color, common fonts, shadow effects, blur effects, etc. The user can perform a second operation on the front-end page and modify it directly, overcoming the existing situation where most codes cannot be modified after generation.

[0137] This solution provides a CSS operation platform (including a user side and a server side, where users can perform operations on the user side front-end page, and the server side is used to generate target results according to user operations), which autonomously generates CSS code according to user operations on the front-end page, and then stores and abstracts the CSS to generate target data in other formats, so as to solve the problem that the CSS style generated in the prior art is single and does not support other types of files (including but not limited to template data in stylus / scss / sass / less / wxss formats), and the code reuse rate is low.

[0138] Embodiment 4:

[0139] See also Fig. 9 , a cascading style sheet data generation system 7 of this embodiment includes a server and a client: the server includes the following:

[0140] The acquisition module 711 is used to receive a data generation signal sent by the client and acquire the data to be processed and the target template data;

[0141] The parsing module 712 is used to identify the data type of the data to be processed, parse the data to be processed using a parsing strategy corresponding to the data type, and generate a target cascading style sheet CSS code;

[0142] An extraction module 713 is used to extract based on the target cascading style sheet CSS code to obtain a syntax tree corresponding to the target cascading style sheet CSS code;

[0143] A generating module 714 is used to traverse the syntax tree corresponding to the target cascading style sheet CSS code based on the target template data, obtain a target result and send the target result to the client;

[0144] The server side also includes a first update module 715, which is used to receive adjustment data sent by the client after sending the target result to the client, and update the target result based on the adjustment data, wherein the adjustment data includes variable identification and variable parameters.

[0145] The client includes the following: a monitoring module 721, which is used to monitor the first operation of the user on the front-end page, and generate a data generation signal, data to be processed and target template data according to the first operation;

[0146] The sending module 722 is used to send the data generation signal, the data to be processed and the target template data to the server end;

[0147] The receiving module 723 is used to receive the target result generated according to the data to be processed and the target template data sent by the server, and display the target result on the front-end page.

[0148] The client also includes a second update module 724, which is used to monitor the user's second operation on the front-end page in real time, and generate adjustment data based on the second operation and send it to the server; receive the target result updated according to the adjustment data sent by the server, and display the updated target result on the front-end page.

[0149] This technical solution is based on data processing. It monitors user operations through a monitoring module on the client. When the user triggers a data generation signal, the data to be processed and the target template data selected by the user are sent to the server. The server uses a parsing module, an extraction module and a generation module to parse, extract and generate target results for the data to be processed according to the data sent by the client, and sends the target results to the client. After the client receives the target results through a receiving module, it is displayed on the front-end page to facilitate users to copy, download and other operations on the front-end page, so as to solve the problem of single CSS style generated in the prior art.

[0150] In the above-mentioned server-side processing process, a corresponding parsing strategy is selected according to the type of data to be processed. For example, when the data type of the data to be processed is a preset control set, a target cascading style sheet CSS code is generated according to a preset code template and the preset control set; when the data type of the data to be processed is a picture, image recognition is performed on the data to be processed, and a target cascading style sheet CSS code is generated according to the recognition result and a preset compilation rule; when the data type of the data to be processed is a self-edited text, the data to be processed is extracted based on a preset mapping rule to generate a target cascading style sheet CSS code; after the data to be processed is parsed, an extraction module is used to extract a syntax tree corresponding to the CSS code, and finally a generation module is used to traverse the syntax tree to generate a target result consistent with the target template data format, thereby solving the problem that the style file generated by the CSS platform in the prior art only supports the CSS format, and thus the code reuse efficiency is low and the applicability is poor.

[0151] After the target result is generated as described above and displayed on the front-end page by the client, the client can also monitor user actions based on the second update module, and cooperate with the first update module on the server to achieve real-time update of the target result, thereby reducing the problem that the existing CSS code cannot be changed after generation and adjustment requires a regeneration process, which is time-consuming and convenient to operate.

[0152] Embodiment five:

[0153] To achieve the above-mentioned purpose, the present invention further provides a computer device 8, which may include multiple computer devices. The components of the cascading style sheet data generation system 7 of the second embodiment may be dispersed in different computer devices 8. The computer device 8 may be a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that executes a program. The computer device of this embodiment at least includes but is not limited to: a memory 81, a processor 82, a network interface 83 and a cascading style sheet data generation device 7 that can be interconnected through a system bus, such as Fig.10 It should be pointed out that Fig.10 Only a computer device with components is shown, but it should be understood that implementing all of the components shown is not a requirement and more or fewer components may alternatively be implemented.

[0154] In this embodiment, the memory 81 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 81 can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory 81 can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 81 can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 81 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the cascading style sheet data generation system 7 of the first embodiment. In addition, the memory 81 can also be used to temporarily store various types of data that have been output or are to be output.

[0155] In some embodiments, the processor 82 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 82 is generally used to control the overall operation of the computer device. In this embodiment, the processor 82 is used to run the program code stored in the memory 81 or process data, such as running the cascading style sheet data generating device to implement the cascading style sheet data generating method of the first embodiment.

[0156] The network interface 83 may include a wireless network interface or a wired network interface, and the network interface 83 is generally used to establish a communication connection between the computer device 8 and other computer devices 8. For example, the network interface 83 is used to connect the computer device 8 to an external terminal through a network, and to establish a data transmission channel and a communication connection between the computer device 8 and the external terminal. The network may be a wireless or wired network such as an Intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth, or Wi-Fi.

[0157] It should be pointed out that Fig.10 Only a computer device 8 having components 81 - 83 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.

[0158] In this embodiment, the cascading style sheet data generation system 7 stored in the memory 81 can also be divided into one or more program modules, and the one or more program modules are stored in the memory 81 and executed by one or more processors (processor 82 in this embodiment) to complete the present invention.

[0159] Embodiment six:

[0160] To achieve the above purpose, the present invention also provides a computer-readable storage medium, which includes multiple storage media, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, App application store, etc., on which a computer program is stored, and the program implements the corresponding function when executed by the processor 83. The computer-readable storage medium of this embodiment is used to store the cascading style sheet data generation system 7, and implements the cascading style sheet data generation method of embodiment 1 when executed by the processor 83.

[0161] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0162] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.

[0163] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for generating cascading style sheet data, applied to a CSS platform server, characterized in that: Includes the following: Receive the data generation signal sent by the client, and obtain the data to be processed and the target template data; Identify the data type of the data to be processed, parse the data to be processed using a parsing strategy corresponding to the data type, and generate a target cascading style sheet CSS code; Extracting based on the target cascading style sheet CSS code to obtain a syntax tree corresponding to the target cascading style sheet CSS code; Traversing the syntax tree corresponding to the target cascading style sheet CSS code based on the target template data, obtaining a target result and sending the target result to the client; The step of identifying the data type of the data to be processed, parsing the data to be processed using a parsing strategy corresponding to the data type, and generating a target cascading style sheet CSS code includes the following: Determine the data type of the data to be processed; When the data type of the to-be-processed data is a preset control set, a target cascading style sheet CSS code is generated according to a preset code template and a preset space set; When the data type of the data to be processed is a picture, image recognition is performed on the data to be processed, and a target cascading style sheet CSS code is generated according to the recognition result and a preset compilation rule; When the data type of the data to be processed is self-editable text, the data to be processed is extracted based on a preset mapping rule to generate a target cascading style sheet CSS code; The image recognition is performed on the data to be processed, and a target cascading style sheet CSS code is generated according to the recognition result and the preset compilation rule, including the following: A graphical user interface can be used to distinguish the compiler to process the data to be processed, and obtain HTML+CSS code data as a recognition result; Extracting forward rules based on the recognition result and preset CSS data to generate target cascading style sheet CSS code; The data to be processed and its corresponding target cascading style sheet CSS code are stored in a preset image database; After sending the target result to the client, the following is also included: Receiving adjustment data sent by a client, wherein the adjustment data includes a variable identifier and a variable parameter; The target result is updated based on the adjustment data.

2. The method for generating cascading style sheet data according to claim 1, characterized in that: Before the graphical user interface can distinguish the compiler to process the data to be processed, the method further includes the following: Acquire the data to be processed, and use a preset algorithm to process the data to be processed to obtain a picture hash value corresponding to the data to be processed; Verify, based on the hash value of the image, whether there is image data in a preset image database that is consistent with the data to be processed; If yes, then obtaining the target cascading style sheet CSS code from the image database; If not, a graphical user interface can be used to distinguish the compiler to process the data to be processed.

3. A method for generating cascading style sheet data, applied to a CSS platform client, characterized in that: Includes the following: Monitoring a first operation of a user on a front-end page, and generating a data generation signal, data to be processed, and target template data according to the first operation; Sending the data generation signal, the data to be processed and the target template data to the server side; Receiving a target result generated according to the data to be processed and the target template data sent by the server, and displaying the target result on the front-end page; The target result is obtained by identifying the data type of the data to be processed, parsing the data to be processed using a parsing strategy corresponding to the data type, and generating a target cascading style sheet CSS code; extracting based on the target cascading style sheet CSS code to obtain a syntax tree corresponding to the target cascading style sheet CSS code; and traversing the syntax tree corresponding to the target cascading style sheet CSS code based on the target template data; The generating of the target cascading style sheet CSS code comprises the following steps: determining the data type of the data to be processed; when the data type of the data to be processed is a preset control set, generating the target cascading style sheet CSS code according to a preset code template and a preset space set; when the data type of the data to be processed is a picture, performing image recognition on the data to be processed, and generating the target cascading style sheet CSS code according to the recognition result and a preset compilation rule; when the data type of the data to be processed is an autonomously edited text, extracting the data to be processed based on a preset mapping rule to generate the target cascading style sheet CSS code; The method of performing image recognition on the data to be processed and generating a target cascading style sheet CSS code according to the recognition result and the preset compilation rule comprises the following steps: using a graphical user interface to distinguish a compiler to process the data to be processed, and obtaining HTML+CSS code data as a recognition result; extracting a forward rule based on the recognition result and the preset CSS data to generate a target cascading style sheet CSS code; and storing the data to be processed and its corresponding target cascading style sheet CSS code in a preset image database; After displaying the target result on the front-end page, the following is also included: Monitor the user's second operation on the front-end page in real time, and generate adjustment data based on the second operation and send it to the server; receive the target result updated according to the adjustment data sent by the server, and display the updated target result on the front-end page.

4. A cascading style sheet data generation system, characterized in that: Including server and client: The server side includes the following: an acquisition module, which is used to receive a data generation signal sent by a client and acquire the data to be processed and the target template data; A parsing module, used for identifying the data type of the data to be processed, parsing the data to be processed using a parsing strategy corresponding to the data type, and generating a target cascading style sheet CSS code; The identifying the data type of the data to be processed, parsing the data to be processed using a parsing strategy corresponding to the data type, and generating a target cascading style sheet CSS code, comprises the following: determining the data type of the data to be processed; When the data type of the to-be-processed data is a preset control set, a target cascading style sheet CSS code is generated according to a preset code template and a preset space set; When the data type of the data to be processed is a picture, image recognition is performed on the data to be processed, and a target cascading style sheet CSS code is generated according to the recognition result and a preset compilation rule; When the data type of the data to be processed is self-editable text, the data to be processed is extracted based on a preset mapping rule to generate a target cascading style sheet CSS code; The image recognition is performed on the data to be processed, and a target cascading style sheet CSS code is generated according to the recognition result and the preset compilation rule, including Below: using a graphical user interface to distinguish a compiler to process the data to be processed, and obtaining HTML+CSS code data as a recognition result; Extracting forward rules based on the recognition result and preset CSS data to generate target cascading style sheet CSS code; The data to be processed and its corresponding target cascading style sheet CSS code are stored in a preset image database; An extraction module, configured to extract based on the target cascading style sheet CSS code and obtain a syntax tree corresponding to the target cascading style sheet CSS code; A generation module, configured to traverse a syntax tree corresponding to the target cascading style sheet CSS code based on the target template data, obtain a target result, and send the target result to a client; The system further comprises a first updating module, which is used to receive adjustment data sent by the client after sending the target result to the client, wherein the adjustment data includes a variable identifier and a variable parameter; and update the target result based on the adjustment data; The client includes the following: a monitoring module, which is used to monitor a first operation of a user on a front-end page, and to generate a data generation signal, data to be processed, and target template data according to the first operation; A sending module, used for sending the data generation signal, the data to be processed and the target template data to the server end; A receiving module, used for receiving a target result generated according to the data to be processed and the target template data and sent by the server, and displaying the target result on a front-end page; It also includes a second update module, which is used to monitor the user's second operation on the front-end page in real time, and generate adjustment data based on the second operation and send it to the server; receive the target result updated according to the adjustment data sent by the server, and display the updated target result on the front-end page.

5. A computer device, characterized in that: The computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method for generating cascading style sheet data according to any one of claims 1 to 3 are implemented.

6. A computer-readable storage medium, comprising a plurality of storage media, each storage medium storing a computer program, characterized in that: The computer programs stored in the plurality of storage media, when executed by a processor, jointly implement the steps of the method for generating cascading style sheet data according to any one of claims 1 to 3.