Webpage file generation method and device based on webpage template
By writing the layer information and web configuration files in the graphic file into the web template, combined with the preset webpage generated script for processing, the problem of low and accurate accuracy of the web file in the existing technology has been solved, and the automation web page is realized. File generation.
Patent Information
- Application Number
- CN202411279754.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-01-28
AI Technical Summary
The prior art has problems such as high communication costs, low generation efficiency and insufficient accuracy when generating web page files.
By writing the layer information and web configuration files in the graphic file into the pre -reading web templates, generate the initial web file, and generate structure processing and style based on the preset web -generating script to generate the final webpage file.
It can automatically generate web files without communication with web designers, which improves the generating efficiency and accuracy of the generating results of web files.
Smart Images

Figure CN119377512A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer technology, and specifically relates to a method and device for generating a web page file based on a web page template. Background Art
[0002] Web pages are the basic elements of websites and are the platforms that carry various website applications. A web page file is a plain text file containing hypertext markup language tags. It can be stored in a computer somewhere in the world. It is usually in the hypertext markup language format and needs to be read through a web browser.
[0003] In the prior art, web page files are usually generated by firstly using image processing tools such as Photoshop to create graphic design prototype files of web pages by designers, and then developers manually write HTML, CSS and JavaScript codes according to these graphic design prototype files to generate web page files that conform to the graphic design prototype files. However, the generation of web page files using the prior art requires developers to communicate with designers constantly and manually write the codes of web page files. There is a lot of repetitive work in the process of generating web page files, and there are problems such as high communication cost, low efficiency of generating web page files and insufficient accuracy. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method and device for generating a web page file based on a web page template, which solves the problems of high communication cost, low web page file generation efficiency and insufficient accuracy when generating web page files using the existing technology. An initial web page file is obtained by writing layer information and a web page configuration file in a graphic file into a pre-read web page template, and the initial web page file is processed based on a preset web page generation script to generate a final web page file. This can achieve the purpose of automatically generating web page files without communicating with web page designers, thereby improving the generation efficiency of web page files and the accuracy of generation results.
[0005] In a first aspect, an embodiment of the present application provides a method for generating a web page file based on a web page template, the method comprising:
[0006] Receiving a graphic file and corresponding web page customization information sent by a client, and generating a web page configuration file based on the web page customization information;
[0007] Parsing the graphic file based on a preset layer parsing tool to obtain layer information, and writing the layer information and the web page configuration file into a predetermined web page template to obtain an initial web page file;
[0008] The initial web page file is subjected to structural processing and style processing based on a preset web page generation script, and a processing result of the structural processing and a processing result of the style processing are integrated to generate a final web page file.
[0009] Optionally, the step of parsing the graphic file based on a preset layer parsing tool to obtain layer information includes:
[0010] Reading the format information of the graphic file and the tool support format of a preset layer parsing tool, and determining the layer parsing tool of the graphic file according to the format information and the tool support format;
[0011] Determine the layer to be extracted in the graphic file and the information to be extracted of the layer to be extracted according to the web page custom information;
[0012] The layer to be extracted in the graphic file is extracted based on the layer parsing tool, and the information to be extracted in the layer to be extracted is parsed based on the layer parsing tool to obtain the layer information.
[0013] Optionally, the web page template includes: at least two web page structure templates and at least two web page style templates;
[0014] Accordingly, before writing the layer information and the webpage configuration file into a predetermined webpage template to obtain an initial webpage file, the method further includes:
[0015] Receiving web page structure display requirement data and web page style display requirement data sent by the client;
[0016] Reading the pre-stored structure data of the page structure parameter field in the at least two web page structure templates, and determining the target web page structure template that meets the web page structure display requirement data among the at least two web page structure templates according to the structure data;
[0017] The style data of the page style parameter field in the at least two pre-stored web page style templates are read, and a target web page style template that meets the web page style display requirement data among the at least two web page style templates is determined according to the style data.
[0018] Optionally, after receiving the webpage structure display requirement data and the webpage style display requirement data sent by the client, the method further includes:
[0019] Reading the pre-stored structure data of the page structure parameter field in the at least two web page structure templates, and calculating a first similarity between the structure data and the web page structure display requirement data;
[0020] Sorting the first similarities to obtain a first similarity sorting result, determining a web page structure template to be rewritten among the at least two web page structure templates based on the first similarity sorting result, and rewriting the web page structure template to be rewritten based on the web page structure display requirement data to obtain a target web page structure template;
[0021] Reading the pre-stored style data of the page style parameter field in the at least two web page style templates, and calculating a second similarity between the style data and the web page style display requirement data;
[0022] The second similarities are sorted to obtain a second similarity sorting result, a web page style template to be rewritten among the at least two web page style templates is determined based on the second similarity sorting result, and the web page style template to be rewritten is template-rewritten based on the web page style display requirement data to obtain a target web page style template.
[0023] Optionally, writing the layer information and the webpage configuration file into a predetermined webpage template to obtain an initial webpage file includes:
[0024] Reading the target webpage structure template and the target webpage style template, backing up the target webpage structure template and the target webpage style template to obtain a target webpage structure backup template and a target webpage style backup template;
[0025] Writing the layer information and the webpage configuration file into the target webpage structure backup template to obtain a first initial webpage file;
[0026] The first initial web page file is written into the target web page style backup template to obtain a second initial web page file.
[0027] Optionally, the preset web page generation script includes: a structure processing script and a style processing script;
[0028] The method of performing structural processing and style processing on the initial web page file based on a preset web page generation script, and integrating the processing results of the structural processing and the processing results of the style processing to generate a final web page file includes:
[0029] Processing the first initial web page file based on the structure processing script, and writing the processing result of the first initial web page file into the target web page style backup template to obtain a second initial web page file;
[0030] The second initial web page file is obtained, and the second initial web page file is processed based on the style processing script to generate a final web page file, and the final web page file is transferred to a preset website page folder for use by the client in the website access stage.
[0031] Optionally, after transferring the final webpage file to a preset website page folder, the method further includes:
[0032] receiving webpage feedback information from the client, and determining items to be modified of the final webpage according to the webpage feedback information;
[0033] Identify the type of the item to be modified, and modify the first initial web page file and / or the second initial web page file according to the type of the item to be modified;
[0034] The modification results of the first initial web page file and / or the second initial web page file are traversed based on the preset web page generation script to obtain the modification results of the final web page file, and the modification results of the final web page file are transmitted to the preset website page folder for use by the client during the website access stage.
[0035] In a second aspect, an embodiment of the present application provides a device for generating a web page file based on a web page template, the device comprising:
[0036] A web page configuration module, used to obtain the graphic file input by the client and the corresponding web page custom information, and generate a web page configuration file based on the web page custom information;
[0037] An initial web page file acquisition module, used to parse the graphic file based on a preset layer parsing tool to obtain layer information, and write the layer information and the web page configuration file into a predetermined web page template to obtain an initial web page file;
[0038] The final web page file generation module is used to perform structure processing and style processing on the initial web page file based on a preset web page generation script, and integrate the processing results of the structure processing and the processing results of the style processing to generate a final web page file.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0040] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0041] In the fifth aspect, an embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium, and at least one processor of the device reads and executes the computer program from the computer-readable storage medium, so that the device performs the method described in the first aspect.
[0042] In an embodiment of the present application, a graphic file and corresponding web page customization information sent by a client are received, and a web page configuration file is generated based on the web page customization information; the graphic file is parsed based on a preset layer parsing tool to obtain layer information, and the layer information and the web page configuration file are written into a predetermined web page template to obtain an initial web page file; the initial web page file is subjected to structure processing and style processing based on a preset web page generation script, and the processing results of the structure processing and the processing results of the style processing are integrated to generate a final web page file. The web page file generation method based on the web page template solves the problems of high communication cost, low web page file generation efficiency and insufficient accuracy when generating web page files using the prior art. The initial web page file is obtained by writing the layer information and the web page configuration file in the graphic file into a pre-read web page template, and the final web page file is generated by processing the initial web page file based on the preset web page generation script, so as to achieve the purpose of automatically generating web page files without communicating with web page designers, thereby improving the generation efficiency of web page files and the accuracy of generation results. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 It is a flow chart of a method for generating a web page file based on a web page template provided in an embodiment of the present application;
[0044] Figure 2 is a flowchart of another method for generating a web page file based on a web page template provided in an embodiment of the present application;
[0045] Figure 3 This is a flow chart of generating a final web page file provided by an embodiment of the present application;
[0046] Figure 4 is a schematic diagram of a preset website page folder provided in an embodiment of the present application;
[0047] Figure 5 It is a structural block diagram of a web page file generation device based on a web page template provided in an embodiment of the present application;
[0048] Figure 6 It is a structural block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0050] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0051] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0052] First, the use scenario of this solution can be a scenario of web page file generation, especially a scenario of automatically generating web page files using a preset web page template. By writing the layer information and web page configuration file in the graphic file into the pre-read web page template to obtain the initial web page file, and processing the initial web page file based on the preset web page generation script to generate the final web page file, the purpose of automatically generating web page files without communicating with the web page designer can be achieved, thereby improving the generation efficiency of web page files and the accuracy of the generation results. Based on the above usage scenarios, it can be understood that the executor of this solution can be a server.
[0053] In conjunction with the accompanying drawings, a web page template-based web page file generation method and device provided in an embodiment of the present application are described in detail through specific embodiments and application scenarios.
[0054] Figure 1 FIG. 1 is a flow chart of a method for generating a web page file based on a web page template provided in an embodiment of the present application. Figure 1 As shown, the specific steps include:
[0055] S101, receiving a graphic file and corresponding web page customization information sent by a client, and generating a web page configuration file based on the web page customization information.
[0056] Among them, the graphic file can be a graphic format file for storing graphics or image information of a web design interface. For example: a PSD (Photoshop Document, image processing file) file. The graphic file may include graphic attribute parameters such as pixel data, image size ratio and color information of each graphic or image in the web design interface. Web page customization information may be information defined by a web page designer to limit the web page generation results and define the web page content. For example: the web page customization information of a certain game may include the game name and an interface or link for requesting data, etc. A web page configuration file may be a file generated based on the web page customization information to define the behavior of a web page file and the web page content.
[0057] In one embodiment, a graphic file and web page customization information corresponding to the graphic file sent by a client may be received, and a web page configuration file may be generated according to the web page customization information. The web page configuration file may be generated by integrating and adjusting the web page customization information based on a preset web page generation script to automatically generate a web page configuration file corresponding to the graphic file, and the web page customization information may be written into corresponding fields of the web page configuration file.
[0058] S102, parsing the graphic file based on a preset layer parsing tool to obtain layer information, and writing the layer information and the web page configuration file into a predetermined web page template to obtain an initial web page file.
[0059] Among them, the preset layer parsing tool can be a pre-set tool for separating layers of images and viewing, editing and managing layer information in each layer. For example: psd.js. Layer information can be parameters and setting information that define how the layer is displayed and its behavior. Layer information includes but is not limited to the transformation properties of the layer, including anchor point, position, scaling, rotation and transparency, etc.; display properties, including the minimum visible scale, etc.; visibility control, including setting whether the layer is displayed in the map or image, etc. By setting or adjusting the layer information, the purpose of adjusting the display effect of the layer and the image data display requirements can be achieved. The web page template can be a pre-designed web page framework. The purpose of automatically generating a web page can be achieved by inputting the user's custom information and the layer information of the graphic file into the web page template. The web page template includes the basic structure, elements, layout and page style of the web page. The initial web page file can be a file obtained after the user's custom information and the layer information of the graphic file are input into the corresponding fields of the web page template.
[0060] In one embodiment, a graphic file parsing instruction can be issued to a preset layer parsing tool, and the preset layer parsing tool can automatically parse the layers of each image in the graphic file and the information in each layer to obtain the layer information. The layer information and the web page configuration file are written into the corresponding fields of a predetermined web page template according to the names or information types corresponding to the data in each layer information and the web page configuration file to obtain the initial web page file.
[0061] In one embodiment, optionally, parsing the graphic file based on a preset layer parsing tool to obtain layer information includes:
[0062] Read the format information of the graphic file and the tool support format of the preset layer parsing tool, and determine the layer parsing tool of the graphic file according to the format information and the tool support format;
[0063] Determine the layers to be extracted and the information to be extracted of the layers to be extracted in the graphic file according to the custom information of the web page;
[0064] The layer to be extracted in the graphic file is extracted based on the layer parsing tool, and the information to be extracted in the layer to be extracted is parsed based on the layer parsing tool to obtain the layer information.
[0065] The tool-supported format may be a file format that can be parsed by a preset layer parsing tool. A preset layer parsing tool may support parsing of multiple file formats. The layer to be extracted may be a layer in a graphic file used for web design. The information to be extracted of the layer to be extracted may be layer information in the layer to be extracted used for web design. The user may select the layer to be extracted and the information to be extracted in the graphic file according to web design requirements.
[0066] In one embodiment, the format information of the graphic file and the tool support format of the preset layer parsing tool can be read, and it is identified whether the tool support format of each preset layer parsing tool includes the format information of the graphic file, and the preset layer parsing tool including the format information of the graphic file is determined as the layer parsing tool of the graphic file. The web page customization information can also include the layers and layer information in the graphic file required for web page design. Since the web page does not need to completely cover all the layers in the graphic file or all the layer information in each layer, the user can write the layers and layer information required for this web page design in the web page customization information according to the web page design requirements, and the layers and layer information in the web page customization information can be used as the layers to be extracted and the information to be extracted of the layers to be extracted. The layers to be extracted in the graphic file are extracted by the layer parsing tool, and the information to be extracted in the layers to be extracted for web page design is parsed based on the layer parsing tool, and the information to be extracted is used as the layer information.
[0067] This solution, by determining the layer parsing tool of the graphic file according to the format information of the graphic file and the tool support format, and determining the layer to be extracted and the information to be extracted according to the custom information of the web page, can achieve the purpose of screening the layer parsing tool and extracting the layer information according to user needs, thereby improving the accuracy of layer information parsing and the extraction efficiency.
[0068] S103, performing structure processing and style processing on the initial web page file based on a preset web page generation script, integrating the processing results of the structure processing and the processing results of the style processing to generate a final web page file.
[0069] The preset web page generation script may be a script pre-written by a user for automatically converting a web page template into a final web page file, such as a node.js script in java. The final web page file may be a web page presented when a user visits a website.
[0070] In one embodiment, the initial web page file can be subjected to structural processing and style processing respectively by a preset web page generation script stored in a storage unit. In this solution, the preset web page generation script can be used to perform structural processing and style processing on the initial web page file respectively, and the structural processing results and style processing results of the same page elements can be merged to obtain the final web page file; the preset web page generation script can also be used to first perform structural processing on the initial web page file, and then perform style processing on the initial web page file after structural processing to obtain the final web page file. The structural processing of the initial web page file can be a processing of organizing page elements using a language for marking and organizing web page content to tell the browser how to display the content. The style processing of the initial web page file after structural processing can be a language for adding styles and beautifying the display of the initial web page file after structural processing to define the color, font, size, margin and background of the page elements.
[0071] The technical solution provided by the embodiment of the present application receives the graphic file and the corresponding web page customization information sent by the client, generates a web page configuration file based on the web page customization information; parses the graphic file based on a preset layer parsing tool to obtain layer information, writes the layer information and the web page configuration file into a predetermined web page template to obtain an initial web page file; performs structural processing and style processing on the initial web page file based on a preset web page generation script, and integrates the processing results of the structural processing and the processing results of the style processing to generate a final web page file. Through the above-mentioned web page file generation method based on the web page template, the problems of high communication cost, low web page file generation efficiency and insufficient accuracy when using the existing technology to generate web page files are solved. By writing the layer information and web page configuration file in the graphic file into the pre-read web page template to obtain the initial web page file, and processing the initial web page file based on the preset web page generation script to generate the final web page file, the purpose of automatically generating web page files without communicating with the web page designer can be achieved, and the generation efficiency of the web page file and the accuracy of the generation results are improved.
[0072] Figure 2 1 is a flow chart of another web page file generation method based on web page templates provided in an embodiment of the present application. The web page template includes: at least two web page structure templates and at least two web page style templates, such as Figure 2 As shown, the specific steps include:
[0073] S201, receiving a graphic file and corresponding web page customization information sent by a client, and generating a web page configuration file based on the web page customization information.
[0074] S202, parsing the graphic file based on a preset layer parsing tool to obtain layer information.
[0075] S203, receiving web page structure display requirement data and web page style display requirement data sent by the client.
[0076] The web page structure display requirement data may be parameters set by a user for limiting the web page display structure. The web page display structure may be the position, layout, and sequence of web page elements in a web page. The web page style display requirement data may be parameters set by a user for limiting the web page display style. The web page style may be the color, size, and spacing of web page elements or web page background in a web page. The web page structure display requirement data and the web page style display requirement data may be represented by specific values or by data ranges.
[0077] In one embodiment, the webpage structure display requirement data and the webpage style display requirement data sent by the client may be received through an interactive interface with the client.
[0078] S204, reading the structure data of the page structure parameter field in at least two pre-stored web page structure templates, and determining the target web page structure template that meets the web page structure display requirement data in the at least two web page structure templates according to the structure data.
[0079] The target web page structure template may be a web page structure template whose structure data conforms to the web page structure display requirement data. The web page structure template may be a template for organizing the structure and content of a web page in a standardized manner. For example, an HTML template. An HTML template may be a predefined HTML code structure that includes the basic elements and layout required to create a web page. By using an HTML template, a web page may be quickly constructed without having to write all the HTML codes from scratch.
[0080] In one embodiment, the structural data of the page structure parameter fields of each template in at least two pre-stored web page structure templates can be read, and the target web page structure template that meets the web page structure display requirement data in at least two web page structure templates can be determined based on the structural data of the same page elements and the web page structure display requirement data.
[0081] S205, reading the style data of the page style parameter field in at least two pre-stored web page style templates, and determining a target web page style template that meets the web page style display requirement data among the at least two web page style templates according to the style data.
[0082] The target web page style template may be a web page style template whose style data conforms to the web page style display requirement data. The web page style template may be a template that determines the display format of a web page file. For example, a CSS template. A CSS template may be a language used for web page typesetting and web page presentation. The style and appearance of text, images, or even the entire website may be changed through a CSS template, and the fixed format provided by the CSS template may be used to achieve the beautification and standardization of web pages.
[0083] In one embodiment, the style data of the page style parameter field of each of the at least two pre-stored web page style templates can be read, and the target web page style template that meets the web page style display requirement data among the at least two web page style templates can be determined based on the style data of the same page element and the web page style display requirement data.
[0084] In one embodiment, optionally, after receiving the webpage structure display requirement data and the webpage style display requirement data sent by the client, the method further includes:
[0085] Reading structure data of page structure parameter fields in at least two pre-stored web page structure templates, and calculating a first similarity between the structure data and web page structure display requirement data;
[0086] Sorting the first similarities to obtain a first similarity sorting result, determining a to-be-rewritten webpage structure template among at least two webpage structure templates based on the first similarity sorting result, and rewriting the to-be-rewritten webpage structure template based on the webpage structure display requirement data to obtain a target webpage structure template;
[0087] Reading the style data of the page style parameter field in at least two pre-stored web page style templates, and calculating a second similarity between the style data and the web page style display requirement data;
[0088] The second similarities are sorted to obtain a second similarity sorting result, a to-be-rewritten webpage style template among at least two webpage style templates is determined based on the second similarity sorting result, and the to-be-rewritten webpage style template is template-rewritten based on the webpage style display requirement data to obtain a target webpage style template.
[0089] Among them, the first similarity can be a parameter used to indicate the degree of conformity between each web page template and the web page structure display requirement data. The more structural data that conforms to the web page structure display requirement data in the web page template, the greater the first similarity between the web page template and the structural display requirement data. The web page structure template to be rewritten can be the web page structure template with the greatest first similarity to the structural display requirement data. The target web page structure template can be a template obtained by rewriting the structural data that does not conform to the web page structure display requirement data in the web page structure template to be rewritten to conform to the web page structure display requirement data. The second similarity can be a parameter used to indicate the degree of conformity between each web page template and the web page style display requirement data. The web page style template to be rewritten can be the web page style template with the greatest second similarity to the style display requirement data. The target web page style template can be a template obtained by rewriting the style data that does not conform to the web page style display requirement data in the web page style template to be rewritten to conform to the web page style display requirement data.
[0090] In one embodiment, since different users have different requirements for web page design, and the structural data and style data of the preset web page structure templates and web page style templates are fixed, it is possible that neither the preset web page structure templates nor the web page style templates meet the web page structure display requirement data and web page style display requirement data uploaded by the user. The above problem can be solved by rewriting the structural data and style data in the template.
[0091] In one embodiment, the structure data of the page structure parameter field in at least two pre-stored web page structure templates can be read, and the number of structure data in each web page structure template that meets the web page structure display requirement data can be identified, and the number can be used as the first similarity between the structure data of the web page structure template and the web page structure display requirement data. The difference between the structure data of the same page element in each web page structure template and the web page structure display requirement data can also be calculated, and the average value of the difference between the structure data of all page elements in the web page structure template and the web page structure display requirement data can be calculated, and the average value of the difference can be used as the first similarity between the structure data of the web page structure template and the web page structure display requirement data. The first similarity is sorted in descending order to obtain a first similarity sorting result, and at least the first two web page structure templates in the first similarity sorting result are used as the web page structure templates to be rewritten, and the structure data in the web page structure template to be rewritten is modified to the corresponding web page structure display requirement data according to the web page structure display requirement data to obtain the target web page structure template. The target web page style template can be obtained by rewriting at least two pre-stored web page style templates according to the rewriting steps of the above target web page structure template, which will not be repeated here.
[0092] This scheme determines the web page structure template to be rewritten by calculating the similarity between the structure data in the web page structure template and the web page structure display requirement data, and performs template rewriting on the web page structure template to obtain the target web page structure template, and calculates the similarity between the style data in the web page style template and the web page style display requirement data to determine the web page style template to be rewritten, and performs template rewriting on the web page style template to obtain the target web page style template. This can avoid the problem that the preset web page template cannot fully meet the user's web page design requirements, and improves the flexibility of web page design and the user's satisfaction with the web page file generation results.
[0093] S206, writing the layer information and the web page configuration file into a predetermined web page template to obtain an initial web page file.
[0094] In one embodiment, optionally, writing the layer information and the webpage configuration file into a predetermined webpage template to obtain an initial webpage file includes:
[0095] Reading a target webpage structure template and a target webpage style template, backing up the target webpage structure template and the target webpage style template to obtain a target webpage structure backup template and a target webpage style backup template;
[0096] Writing the layer information and the webpage configuration file into the target webpage structure backup template to obtain a first initial webpage file;
[0097] The first initial web page file is written into the target web page style backup template to obtain a second initial web page file.
[0098] In one embodiment, a target web page structure template and a target web page style template are read, the target web page structure template is copied to obtain a target web page structure backup template, and the target web page style template is copied to obtain a target web page style backup template. Layer information and web page configuration files are written into corresponding fields of the target web page structure backup template, so as to perform web page structure processing on the layer information and the web page configuration files to obtain a first initial web page file. The first initial web page file is written into the target web page style backup template, so as to perform web page style processing on the first initial web page file to obtain a second initial web page file.
[0099] This solution, by backing up the target web page structure template and the target web page style template, and writing the layer information and the web page configuration file into the target web page structure backup template to obtain the first initial web page file, and writing the first initial web page file into the target web page style backup template to obtain the second initial web page file, can automatically generate web page files without changing the preset template, thereby improving the versatility of the web page template.
[0100] S207, performing structure processing and style processing on the initial web page file based on a preset web page generation script, integrating the processing results of the structure processing and the processing results of the style processing to generate a final web page file.
[0101] The technical solution provided in the embodiment of the present application, by receiving the web page structure display requirement data and the web page style display requirement data sent by the client, determines the target web page structure template and the target web page style template that meet the web page structure display requirement data among at least two web page structure templates, thereby achieving the purpose of determining the web page template according to the user's web page design requirements and improving the accuracy of the web page file generation results.
[0102] Figure 3 is a flowchart of generating a final web page file provided by an embodiment of the present application. The preset web page generation script includes: a structure processing script and a style processing script, such as Figure 3 As shown, the specific steps include:
[0103] S301, processing a first initial web page file based on a structure processing script, and writing the processing result of the first initial web page file into a target web page style backup template to obtain a second initial web page file.
[0104] The structure processing script may be a script that automatically processes the structure of the layer information and user-defined information in the first initial web page file to conform to the target web page structure backup template. The first initial web page file may be a web page file that has layer information and web page configuration files written into the target web page structure backup template and has not been subjected to structure processing. The second initial web page file may be a web page file that has written the structure processing result of the first initial web page file into the target web page style backup template and has not been subjected to style processing.
[0105] In one embodiment, the structure of the layer information and user-defined information in the first initial web page file can be processed by a structure processing script, and the processing result of the first initial web page file can be written into the corresponding field of the target web page style backup template to obtain the second initial web page file.
[0106] S302, obtaining a second initial web page file, processing the second initial web page file based on a style processing script to generate a final web page file, and transferring the final web page file to a preset website page folder for use by the client during the website access phase.
[0107] The style processing script may be a script that automatically processes the webpage style in the second initial webpage file into a script that conforms to the target webpage style backup template. The preset website page folder may be a pre-set folder for linking or jumping to a corresponding webpage according to a user's operation instruction.
[0108] Figure 4is a schematic diagram of the preset website page folder provided by this application. Figure 4 As shown, a website can be composed of web pages. When a user clicks a link or icon of a website, the user can jump to the corresponding web page through the web page interface, and the content of the web page is presented to the display interface of the client. Among them, websites AD are different websites, and web pages 1-N are the web page files that make up website D.
[0109] In one embodiment, a second initial web page file can be obtained, and the web page element style and web page background style in the second initial web page file can be processed by a style processing script to generate a final web page file. The final web page file is transferred to a preset website page folder so that the client can jump to the corresponding page by clicking the corresponding link during the website access stage.
[0110] In one embodiment, optionally, after transferring the final webpage file to a preset website page folder, the method further includes:
[0111] Receive webpage feedback information from the client, and determine the items to be modified on the final webpage according to the webpage feedback information;
[0112] Identify the type of the item to be modified, and modify the first initial webpage file and / or the second initial webpage file according to the type of the item to be modified;
[0113] The modification results of the first initial web page file and / or the second initial web page file are traversed based on the preset web page generation script to obtain the modification results of the final web page file, and the modification results of the final web page file are transmitted to the preset website page folder for use by the client during the website access stage.
[0114] The webpage feedback information may be webpage modification suggestions fed back by the user through the client according to the final generated effect of the webpage. The items to be modified of the final webpage may be webpage elements and modification parameters to be modified on the final webpage. The types to be modified may include webpage structure modification and webpage style modification.
[0115] In one embodiment, webpage feedback information from a client is received, and the items to be modified that need to be modified in the final webpage are determined according to the modification fields in the webpage feedback information, and the types of items to be modified are identified. If the modification type is a webpage structure modification, the first initial webpage file is modified, and the modification results of the first initial webpage file and the second initial webpage file are traversed based on a preset webpage generation script to obtain the modification results of the final webpage file; if the modification type is a webpage style modification, the second initial webpage file is modified, and the modification results of the second initial webpage file are traversed based on a preset webpage generation script to obtain the modification results of the final webpage file. The modification results of the final webpage file are transmitted to a preset website page folder for use by the client in the website access stage.
[0116] This solution, by receiving web page feedback information from the client, makes corresponding modifications to the initial web page file, and traverses the modification results of the initial web page file based on a preset web page generation script to obtain the modification results of the final web page file. This can achieve the purpose of automatically modifying the web page generation results based on user needs, thereby improving the generation efficiency of the final web page file and the user's satisfaction with the generation results.
[0117] The technical solution provided in the embodiment of the present application processes the first initial web page file based on the structure processing script, writes the processing result of the first initial web page file into the target web page style backup template to obtain the second initial web page file, obtains the second initial web page file, processes the second initial web page file based on the style processing script to generate a final web page file, and transfers the final web page file to a preset website page folder for use by the client in the website access stage. Style processing can be performed on the basis of structure processing, thereby improving processing efficiency.
[0118] Figure 5 is a structural block diagram of a web page file generation device based on a web page template provided in an embodiment of the present application. Figure 5 As shown, specifically including the following:
[0119] The web page configuration module 501 is used to obtain the graphic file input by the client and the corresponding web page customization information, and generate a web page configuration file based on the web page customization information;
[0120] The initial web page file acquisition module 502 is used to parse the graphic file based on a preset layer parsing tool to obtain layer information, and write the layer information and the web page configuration file into a predetermined web page template to obtain the initial web page file;
[0121] The final web page file generation module 503 is used to perform structure processing and style processing on the initial web page file based on a preset web page generation script, and integrate the processing results of the structure processing and the processing results of the style processing to generate a final web page file.
[0122] Furthermore, the initial webpage file acquisition module 502 is specifically used for:
[0123] Read the format information of the graphic file and the tool support format of the preset layer parsing tool, and determine the layer parsing tool of the graphic file according to the format information and the tool support format;
[0124] Determine the layers to be extracted and the information to be extracted of the layers to be extracted in the graphic file according to the custom information of the web page;
[0125] The layer to be extracted in the graphic file is extracted based on the layer parsing tool, and the information to be extracted in the layer to be extracted is parsed based on the layer parsing tool to obtain the layer information.
[0126] Further, the web page template includes: at least two web page structure templates and at least two web page style templates;
[0127] Correspondingly, the initial webpage file acquisition module 502 is also used for:
[0128] Receive web page structure display requirement data and web page style display requirement data sent by the client;
[0129] Reading the structure data of the page structure parameter field in at least two pre-stored web page structure templates, and determining the target web page structure template that meets the web page structure display requirement data in the at least two web page structure templates according to the structure data;
[0130] The style data of the page style parameter field in at least two pre-stored web page style templates are read, and a target web page style template that meets the web page style display requirement data among the at least two web page style templates is determined according to the style data.
[0131] Furthermore, the initial webpage file acquisition module 502 is also used to:
[0132] Reading structure data of page structure parameter fields in at least two pre-stored web page structure templates, and calculating a first similarity between the structure data and web page structure display requirement data;
[0133] Sorting the first similarities to obtain a first similarity sorting result, determining a to-be-rewritten webpage structure template among at least two webpage structure templates based on the first similarity sorting result, and rewriting the to-be-rewritten webpage structure template based on the webpage structure display requirement data to obtain a target webpage structure template;
[0134] Reading the style data of the page style parameter field in at least two pre-stored web page style templates, and calculating a second similarity between the style data and the web page style display requirement data;
[0135] The second similarities are sorted to obtain a second similarity sorting result, a to-be-rewritten webpage style template among at least two webpage style templates is determined based on the second similarity sorting result, and the to-be-rewritten webpage style template is template-rewritten based on the webpage style display requirement data to obtain a target webpage style template.
[0136] Furthermore, the initial webpage file acquisition module 502 is specifically used for:
[0137] Reading a target webpage structure template and a target webpage style template, backing up the target webpage structure template and the target webpage style template to obtain a target webpage structure backup template and a target webpage style backup template;
[0138] Writing the layer information and the webpage configuration file into the target webpage structure backup template to obtain a first initial webpage file;
[0139] The first initial web page file is written into the target web page style backup template to obtain a second initial web page file.
[0140] Furthermore, the preset web page generation script includes: a structure processing script and a style processing script;
[0141] The final web page file generation module 503 is specifically used for:
[0142] Processing the first initial web page file based on the structure processing script, and writing the processing result of the first initial web page file into the target web page style backup template to obtain a second initial web page file;
[0143] The second initial web page file is obtained, and the second initial web page file is processed based on the style processing script to generate a final web page file, and the final web page file is transmitted to a preset website page folder for use by the client in the website access stage.
[0144] Furthermore, the final web page file generation module 503 is also used to:
[0145] Receive webpage feedback information from the client, and determine the items to be modified on the final webpage according to the webpage feedback information;
[0146] Identify the type of the item to be modified, and modify the first initial webpage file and / or the second initial webpage file according to the type of the item to be modified;
[0147] The modification results of the first initial web page file and / or the second initial web page file are traversed based on the preset web page generation script to obtain the modification results of the final web page file, and the modification results of the final web page file are transmitted to the preset website page folder for use by the client during the website access stage.
[0148] The technical solution provided by the embodiment of the present application includes a web page configuration module, which is used to obtain the graphic file input by the client and the corresponding web page customization information, and generate a web page configuration file based on the web page customization information; an initial web page file acquisition module, which is used to parse the graphic file based on a preset layer parsing tool to obtain layer information, and write the layer information and the web page configuration file into a predetermined web page template to obtain an initial web page file; and a final web page file generation module, which is used to perform structural processing and style processing on the initial web page file based on a preset web page generation script, and integrate the processing results of the structural processing and the processing results of the style processing to generate a final web page file. Through the above-mentioned web page file generation device based on a web page template, the problems of high communication cost, low web page file generation efficiency and insufficient accuracy when generating web page files using the existing technology are solved. By writing the layer information and the web page configuration file in the graphic file into the pre-read web page template to obtain the initial web page file, and processing the initial web page file based on the preset web page generation script to generate the final web page file, the purpose of automatically generating web page files without communicating with the web page designer can be achieved, and the generation efficiency of the web page file and the accuracy of the generation results are improved.
[0149] A web page file generation device based on a web page template in the embodiment of the present application can be configured in a device, or can be configured in a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0150] A web page file generation device based on a web page template in the embodiment of the present application may be an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0151] The web page file generation device based on the web page template provided in the embodiment of the present application can implement each process implemented by the above-mentioned method embodiments. To avoid repetition, it will not be described again here.
[0152] like Figure 6 As shown, an embodiment of the present application also provides an electronic device 600, including a processor 601, a memory 602, and a program or instruction stored in the memory 602 and executable on the processor 601. When the program or instruction is executed by the processor 601, each process of an embodiment of a web page file generation method based on a web page template is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0153] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0154] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned embodiment of a method for generating a web page file based on a web page template is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0155] The processor is a processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0156] The present application embodiment further provides a program product, which includes a program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the method according to various exemplary embodiments of the present application described above in this specification. For example, the computer device can execute a web page file generation method based on a web page template recorded in the present application embodiment. The program product can be implemented using any combination of one or more readable media.
[0157] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0158] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned 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. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0159] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0160] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.
Claims
1. A method for generating a web page file based on a web page template, characterized in that: The method comprises: Receiving a graphic file and corresponding web page customization information sent by a client, and generating a web page configuration file based on the web page customization information; Parsing the graphic file based on a preset layer parsing tool to obtain layer information, and writing the layer information and the web page configuration file into a predetermined web page template to obtain an initial web page file; The initial web page file is subjected to structural processing and style processing based on a preset web page generation script, and a processing result of the structural processing and a processing result of the style processing are integrated to generate a final web page file.
2. The method for generating a web page file based on a web page template according to claim 1, characterized in that: The step of parsing the graphic file based on a preset layer parsing tool to obtain layer information includes: Reading the format information of the graphic file and the tool support format of a preset layer parsing tool, and determining the layer parsing tool of the graphic file according to the format information and the tool support format; Determine the layer to be extracted in the graphic file and the information to be extracted of the layer to be extracted according to the web page custom information; The layer to be extracted in the graphic file is extracted based on the layer parsing tool, and the information to be extracted in the layer to be extracted is parsed based on the layer parsing tool to obtain the layer information.
3. The method for generating a web page file based on a web page template according to claim 1, characterized in that: The web page templates include: at least two web page structure templates and at least two web page style templates; Accordingly, before writing the layer information and the webpage configuration file into a predetermined webpage template to obtain an initial webpage file, the method further includes: Receiving web page structure display requirement data and web page style display requirement data sent by the client; Reading the pre-stored structure data of the page structure parameter field in the at least two web page structure templates, and determining the target web page structure template that meets the web page structure display requirement data among the at least two web page structure templates according to the structure data; The style data of the page style parameter field in the at least two pre-stored web page style templates are read, and a target web page style template that meets the web page style display requirement data among the at least two web page style templates is determined according to the style data.
4. The method for generating a web page file based on a web page template according to claim 3, characterized in that: After receiving the webpage structure display requirement data and the webpage style display requirement data sent by the client, the method further includes: Reading the pre-stored structure data of the page structure parameter field in the at least two web page structure templates, and calculating a first similarity between the structure data and the web page structure display requirement data; Sorting the first similarities to obtain a first similarity sorting result, determining a web page structure template to be rewritten among the at least two web page structure templates based on the first similarity sorting result, and rewriting the web page structure template to be rewritten based on the web page structure display requirement data to obtain a target web page structure template; Reading the pre-stored style data of the page style parameter field in the at least two web page style templates, and calculating a second similarity between the style data and the web page style display requirement data; The second similarities are sorted to obtain a second similarity sorting result, a web page style template to be rewritten among the at least two web page style templates is determined based on the second similarity sorting result, and the web page style template to be rewritten is template-rewritten based on the web page style display requirement data to obtain a target web page style template.
5. The method for generating a web page file based on a web page template according to claim 3, characterized in that: The step of writing the layer information and the webpage configuration file into a predetermined webpage template to obtain an initial webpage file includes: Reading the target webpage structure template and the target webpage style template, backing up the target webpage structure template and the target webpage style template to obtain a target webpage structure backup template and a target webpage style backup template; Writing the layer information and the webpage configuration file into the target webpage structure backup template to obtain a first initial webpage file; The first initial web page file is written into the target web page style backup template to obtain a second initial web page file.
6. The method for generating a web page file based on a web page template according to claim 5, characterized in that: The preset web page generation script includes: a structure processing script and a style processing script; The method of performing structural processing and style processing on the initial web page file based on a preset web page generation script, and integrating the processing results of the structural processing and the processing results of the style processing to generate a final web page file includes: Processing the first initial web page file based on the structure processing script, and writing the processing result of the first initial web page file into the target web page style backup template to obtain a second initial web page file; The second initial web page file is obtained, and the second initial web page file is processed based on the style processing script to generate a final web page file, and the final web page file is transferred to a preset website page folder for use by the client in the website access stage.
7. The method for generating a web page file based on a web page template according to claim 6, characterized in that: After transferring the final web page file to the preset website page folder, the method further includes: Receiving webpage feedback information from the client, and determining items to be modified of the final webpage according to the webpage feedback information; Identify the type of the item to be modified, and modify the first initial web page file and / or the second initial web page file according to the type of the item to be modified; The modification results of the first initial web page file and / or the second initial web page file are traversed based on the preset web page generation script to obtain the modification results of the final web page file, and the modification results of the final web page file are transmitted to the preset website page folder for use by the client during the website access stage.
8. A web page file generation device based on a web page template, characterized in that: The device comprises: A web page configuration module, used to obtain the graphic file input by the client and the corresponding web page custom information, and generate a web page configuration file based on the web page custom information; An initial web page file acquisition module, used to parse the graphic file based on a preset layer parsing tool to obtain layer information, and write the layer information and the web page configuration file into a predetermined web page template to obtain an initial web page file; The final web page file generation module is used to perform structure processing and style processing on the initial web page file based on a preset web page generation script, and integrate the processing results of the structure processing and the processing results of the style processing to generate a final web page file.
9. An electronic device, characterized in that: It includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, the steps of a web page file generation method based on a web page template as described in any one of claims 1-7 are implemented.
10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of a method for generating a web page file based on a web page template as described in any one of claims 1 to 7 are implemented.