CN117633388A - Page processing method and device, electronic equipment and computer readable medium - Google Patents

Page processing method and device, electronic equipment and computer readable medium Download PDF

Info

Publication number
CN117633388A
CN117633388A CN202311592981.9A CN202311592981A CN117633388A CN 117633388 A CN117633388 A CN 117633388A CN 202311592981 A CN202311592981 A CN 202311592981A CN 117633388 A CN117633388 A CN 117633388A
Authority
CN
China
Prior art keywords
file
style file
page
style
target node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311592981.9A
Other languages
Chinese (zh)
Inventor
孟繁贵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
CCB Finetech Co Ltd
Original Assignee
China Construction Bank Corp
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Construction Bank Corp, CCB Finetech Co Ltd filed Critical China Construction Bank Corp
Priority to CN202311592981.9A priority Critical patent/CN117633388A/en
Publication of CN117633388A publication Critical patent/CN117633388A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a page processing method, a page processing device, electronic equipment and a computer readable medium, and relates to the technical field of computers, wherein the method comprises the following steps: receiving a page processing request, acquiring a corresponding application program type identifier, and determining a corresponding file extension according to the application program type identifier; determining a file type based on the file extension, responding to the file type as a page style file, acquiring a corresponding page style file identifier, and performing file retrieval based on the page style file identifier to obtain a style file array; compiling a style file array into a series of nodes to obtain corresponding attribute values; determining a corresponding character string according to the attribute value, and determining a target node based on the character string; and executing a data replacement process based on the target node to obtain a corresponding new style file, updating a style file array according to the new style file, and displaying a corresponding page. The preset form characters in the small program engineering style file are automatically processed, and the page is prevented from being scrambled.

Description

Page processing method and device, electronic equipment and computer readable medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a page processing method, a device, an electronic device, and a computer readable medium.
Background
The applet is used as a way for connecting the user and the service, can be conveniently acquired and spread in the host APP, and has excellent user experience. The style files in applet engineering include global style files, page style files and component style files. In the mobile terminal, if the attribute value of the style file contains Chinese characters, messy codes may occur.
Disclosure of Invention
In view of this, the embodiments of the present application provide a method, an apparatus, an electronic device, and a computer readable medium for processing a page, which can solve the problem that in the existing mobile terminal and browser, if the attribute value of the style file contains a chinese character, a messy code may occur.
To achieve the above object, according to one aspect of the embodiments of the present application, there is provided a page processing method, including:
receiving a page processing request, acquiring a corresponding application program type identifier, and determining a corresponding file extension according to the application program type identifier;
determining a file type based on the file extension, responding to the file type as a page style file, acquiring a corresponding page style file identifier, and further performing file retrieval based on the page style file identifier to obtain a style file array;
Compiling a style file array into a series of nodes, and acquiring attribute values of the series of nodes;
determining a corresponding character string according to the attribute value, and further determining a target node based on the character string;
and executing a data replacement process based on the target node to obtain a corresponding new style file, updating a style file array according to the new style file, and further displaying a corresponding page.
Optionally, determining the target node includes:
invoking a preset regular expression to verify whether the corresponding character string of the preset form character is contained between the beginning and the end of the character string corresponding to the first preset form character and the second preset form character based on the preset form character set, and if so, determining the node corresponding to the attribute value of the character string containing the corresponding preset form character as a target node.
Optionally, performing a data replacement process based on the target node to obtain a corresponding new style file, including:
and replacing the character string of the preset form character in the target node with a preset corresponding character code to obtain a corresponding new style file.
Optionally, updating the style file array according to the new style file includes:
and executing the checking process of the original-type file corresponding to the new style file and the target node, replacing the original-type file with the new style file and deleting the original-type file in response to the successful checking.
Optionally, compiling the style file array into a series of nodes includes:
and calling a parsing tool plug-in to convert each style file in the style file array into an abstract syntax tree, thereby obtaining a series of nodes consisting of each node on the abstract syntax tree.
Optionally, after obtaining the corresponding new style file, the page processing method further includes:
storing the new style file to the application engineering catalog.
Optionally, before determining the file type based on the file extension, responding to the file type as the page style file, obtaining the corresponding page style file identification, and further performing file retrieval based on the page style file identification to obtain the style file array, the method further comprises:
and excluding the style file corresponding to the third party from the application engineering catalog so as to update the application engineering catalog.
In addition, the application also provides a page processing device, which comprises:
the receiving unit is configured to receive the page processing request, acquire the corresponding application type identifier and determine the corresponding file extension according to the application type identifier;
the retrieval unit is configured to determine the file type based on the file extension, acquire the corresponding page style file identification in response to the file type being the page style file, and further perform file retrieval based on the page style file identification to obtain a style file array;
The compiling unit is configured to compile the style file array into a series of nodes and acquire attribute values of the series of nodes;
the target node determining unit is configured to determine a corresponding character string according to the attribute value, and further determine a target node based on the character string;
and the updating unit is configured to execute a data replacement process based on the target node so as to obtain a corresponding new style file, update the style file array according to the new style file, and further display the corresponding page.
Optionally, the target node determining unit is further configured to:
invoking a preset regular expression to verify whether the corresponding character string of the preset form character is contained between the beginning and the end of the character string corresponding to the first preset form character and the second preset form character based on the preset form character set, and if so, determining the node corresponding to the attribute value of the character string containing the corresponding preset form character as a target node.
Optionally, the updating unit is further configured to:
and replacing the character string of the preset form character in the target node with a preset corresponding character code to obtain a corresponding new style file.
Optionally, the updating unit is further configured to:
And executing the checking process of the original-type file corresponding to the new style file and the target node, replacing the original-type file with the new style file and deleting the original-type file in response to the successful checking.
Optionally, the compiling unit is further configured to:
and calling a parsing tool plug-in to convert each style file in the style file array into an abstract syntax tree, thereby obtaining a series of nodes consisting of each node on the abstract syntax tree.
Optionally, the page processing apparatus further comprises a storage unit configured to:
storing the new style file to the application engineering catalog.
Optionally, the page processing apparatus further includes an exclusion unit configured to:
and excluding the style file corresponding to the third party from the application engineering catalog so as to update the application engineering catalog.
In addition, the application also provides page processing electronic equipment, which comprises: one or more processors; and a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the page processing method as described above.
In addition, the application also provides a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the page processing method as described above.
To achieve the above object, according to yet another aspect of the embodiments of the present application, a computer program product is provided.
A computer program product of an embodiment of the present application includes a computer program, which when executed by a processor implements a page processing method provided by the embodiment of the present application.
One embodiment of the above invention has the following advantages or benefits: the method comprises the steps of obtaining a corresponding application program type identifier by receiving a page processing request, and determining a corresponding file extension according to the application program type identifier; determining a file type based on the file extension, responding to the file type as a page style file, acquiring a corresponding page style file identifier, and further performing file retrieval based on the page style file identifier to obtain a style file array; compiling a style file array into a series of nodes, and acquiring attribute values of the series of nodes; determining a corresponding character string according to the attribute value, and further determining a target node based on the character string; and executing a data replacement process based on the target node to obtain a corresponding new style file, updating a style file array according to the new style file, and further displaying a corresponding page. The method can enable the preset form characters in the small program engineering style file to be automatically processed rapidly and accurately, and prevent the page from being messy.
Further effects of the above-described non-conventional alternatives are described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the present application and are not to be construed as unduly limiting the present application. Wherein:
FIG. 1 is a schematic diagram of the main flow of a page processing method according to one embodiment of the present application;
FIG. 2 is a schematic diagram of the main flow of a page processing method according to one embodiment of the present application;
FIG. 3 is a schematic diagram of a main flow of generating a style file number array according to a page processing method according to one embodiment of the present application;
FIG. 4 is a main flow diagram of traversing applet style files for a page processing method according to one embodiment of the present application;
FIG. 5 is a schematic diagram of the main units of a page processing apparatus according to an embodiment of the present application;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present application may be applied;
fig. 7 is a schematic diagram of a computer system suitable for use in implementing the terminal device or server of the embodiments of the present application.
Detailed Description
Exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness. In the technical scheme of the application, the aspects of acquisition, analysis, use, transmission, storage and the like of the related user personal information all meet the requirements of related laws and regulations, are used for legal and reasonable purposes, are not shared, leaked or sold outside the aspects of legal use and the like, and are subjected to supervision and management of a supervision department. Necessary measures should be taken for the personal information of the user to prevent illegal access to such personal information data, ensure that personnel having access to the personal information data comply with the regulations of the relevant laws and regulations, and ensure the personal information of the user. Once these user personal information data are no longer needed, the risk should be minimized by limiting or even prohibiting the data collection and/or deletion.
User privacy is protected by de-identifying data when used, including in some related applications, such as by removing a particular identifier, controlling the amount or specificity of stored data, controlling how data is stored, and/or other methods.
Fig. 1 is a schematic diagram of main flow of a page processing method according to an embodiment of the present application, and as shown in fig. 1, the page processing method includes:
step S101, receiving a page processing request, acquiring a corresponding application program type identifier, and determining a corresponding file extension according to the application program type identifier.
In this embodiment, the execution body (for example, may be a server) of the page processing method may receive the page processing request by means of a wired connection or a wireless connection. The page processing request may be a request to convert chinese characters in the applet engineering style file into unicode codes to enable correct display of chinese characters without displaying messy codes. After receiving the page processing request, the executing body may acquire an application type identifier carried in the request, where the application type identifier is used to characterize an encoding or a name of an application type that carries a user to access a page. After the execution body obtains the application type identifier, the corresponding file extension name can be determined according to the application type identifier.
The application types may include an a applet, a B applet, a C applet, a D applet, etc., and the application types of the embodiments of the present application are not particularly limited. The file extension of each type of applet is different, and it is first necessary to determine the extension of the file according to the type of applet.
Step S102, determining the file type based on the file extension, responding to the file type as the page style file, acquiring a corresponding page style file identification, and further performing file retrieval based on the page style file identification to obtain a style file array.
The file extension may be any one or more of js, wxml, json, wxss, where js may correspond to a file type that is a page logical file, wxml may correspond to a page structure file, json may correspond to a page configuration file, and wxss may correspond to a page style file.
When the execution body determines that the file type to which the file extension corresponds is a page style file, a corresponding page style file identification, such as app.wss (representing a global style file, i.e., representing a file that controls all page and component styles), wss (representing a file that controls the style of each component), may be acquired. If the page style file identifiers are app.wxss and wxss, searching the corresponding global style file according to the determined page style file identifiers and searching the style file of each corresponding component, and finally summarizing to obtain a style file array. If the page style file identifier is app.wxss, only the corresponding global style file is searched and a corresponding style file array is obtained. If the page style file identifier is wxss, only the style file of each corresponding component is searched and a corresponding style file array is obtained. Thereby enabling faster and more accurate generation of style file arrays.
For example, when determining that the file type corresponding to the file extension is a page style file, the execution body may search for a file of an application engineering directory (e.g., an applet engineering directory) according to a pre-configured applet type miniprogram type parameter or page style file extension type cssType (if the miniprogram type parameter value is null) (e.g., a style file identifier (e.g., app. Wxs and/or wxs) may be included therein), and use a glob (e.g., https:// www.npmjs.com/package/glob) to search for a style file of an application engineering directory (e.g., an applet engineering directory) based on the style file identifier (e.g., app. Wxs and/or wxss), where the search result is a file array, and is recorded as cssPages, i.e., a style file array.
Specifically, before determining the file type based on the file extension, responding to the file type as the page style file, acquiring the corresponding page style file identification, and further performing file retrieval based on the page style file identification to obtain a style file array, the page processing method further comprises: and excluding the style file corresponding to the third party from the application engineering catalog so as to update the application engineering catalog.
As shown in fig. 3, when using glob, the relevant directory needs to be excluded, and the excluded directory is: 'node_modules/' and 'miniprogram_dist/'. Because the applet engineering can refer to the third party library, the installation package of the third party library is located in the node_modules folder, and the files after the third party library construction (which are required to be constructed before the third party library is used) are located in the miniprogram_dist folder.
Third party libraries, for example: the UI component library can be used by a developer to accelerate the development of projects and improve the development efficiency by using a third party library (particularly a third party component library). Taking the WeChat applet version (@ vant/weapp) as an example, the @ vant/weapp installation file is built under the node_modules folder of the project, and the @ vant/weapp is built into the miniprogram_dist folder, because these 2 folders are all third party components (also have style files), but are not the actual development code of the project group.
The reason for excluding the installation and construction of folders where third party libraries are located is: development project groups typically do not modify the file source code of the third party library because of the inconvenience of maintaining the third party source code (the locally modified third party code may be covered after reinstallation of the third party code), and the locally modified content is not valid. The small program items may be packaged by a pipeline (packaged on a server), and packaged on a non-developer local computer, and the third party library code on the server cannot be changed when packaged by the pipeline.
As shown in fig. 3, the procedure for obtaining the style file array may be as follows: and (3) excluding node_modules and miniprogram_dist folders, judging whether miniprogram is empty, searching a style file according to a cssType value if the miniprogram is empty, obtaining a style file array, and searching a style file according to a style file extension of an applet type of the miniprogram value if the miniprogram is not empty, and finally obtaining the style file array.
Step S103, compiling the style file array into a series of nodes, and acquiring attribute values of the series of nodes.
The execution body may invoke the postcs plug-in to compile the style file content into a series of nodes, i.e., AST, which may then be altered to regenerate the style file. For each style file that has been acquired, each style file is converted to an AST and processed using a postacs library. In front-end development, AST (Abstract Syntax Tree) is an abstract syntax tree that represents the syntax structure of a programming language in the form of a tree, with each node on the tree representing a structure in source code. The advantage of using AST to transcode is that the code can be analyzed, optimized, reconstructed, etc. during the transcoding process. The postcs plug-in and a tool for converting the style file can process the style file, namely converting the content of which the attribute value is Chinese characters in the style file into unicode codes.
After compiling the style file array into a series of nodes, the execution body may traverse each attribute of the series of nodes obtained after compiling to obtain a corresponding attribute value.
Step S104, corresponding character strings are determined according to the attribute values, and further, the target node is determined based on the character strings.
For example, the execution body may call a preset regular expression to verify whether a character string of a corresponding preset form character is included between the beginning and the end of the character string corresponding to the attribute value based on the first preset form character and the second preset form character of the preset form character set, and if so, determine a node corresponding to the attribute value of the character string including the corresponding preset form character as the target node.
When traversing the attribute of a series of nodes obtained after compiling, determining the node with the attribute value containing Chinese characters as a target node, and then carrying out conversion processing on the attribute value of the target node.
Step S105, based on the target node, executing a data replacement process to obtain a corresponding new style file, updating a style file array according to the new style file, and displaying a corresponding page.
Specifically, the data replacement process is executed based on the target node to obtain a corresponding new style file, including: and replacing the character string of the preset form character in the target node with a preset corresponding character code, namely a unicode code, so as to obtain a corresponding new style file.
Traversing each attribute of the style file by using a walkDecls API of postscs, if the attribute value contains Chinese characters, taking a node corresponding to the attribute value containing the Chinese characters as a target node, and replacing the Chinese characters in the attribute value of the target node with unicode codes. The core logic for converting the Chinese character string into unicode code is as follows:
(1) And judging whether the character string contains Chinese. The style file attribute value is detected by using/+_u4E00-_9FA5] + $/this regular expression. The regular expression/++u4E00-_9FA5] + $/matches one or more Chinese characters. Where u4E00 and u9FA5 are Unicode encodings, representing the first and last characters of the Chinese character set, respectively. Thus, this regular expression matches a string that contains one or more Chinese characters between the beginning and end of the string.
(2) If the attribute value contains Chinese characters, converting the Chinese characters into Unicode codes to obtain corresponding new style files. The charCode variable stores Unicode encoding of the current character, obtained using the charCodeAt () function. If the Unicode of the current character is less than 4 bits, then zeros are appended before it so that it has 4 bits. The Unicode code of the current character is added to the Unicode variable, and the converted Unicode code is returned by starting with a reverse slash. And updating the style file array according to the new style file, and further displaying the corresponding page.
Specifically, updating the style file array according to the new style file includes: and executing the checking process of the original-type file corresponding to the new style file and the target node, replacing the original-type file with the new style file and deleting the original-type file in response to the successful checking.
For example, there may be a bak file in the directory where each style file is located, the execution body may automatically compare the original file with the bak file, check again whether the conversion is problematic, and then use the contents of the bak file instead of the original file contents, and delete the bak file.
The embodiment obtains the corresponding application program type identifier by receiving the page processing request, and determines the corresponding file extension according to the application program type identifier; determining a file type based on the file extension, responding to the file type as a page style file, acquiring a corresponding page style file identifier, and further performing file retrieval based on the page style file identifier to obtain a style file array; compiling a style file array into a series of nodes, and acquiring attribute values of the series of nodes; determining a corresponding character string according to the attribute value, and further determining a target node based on the character string; and executing a data replacement process based on the target node to obtain a corresponding new style file, updating a style file array according to the new style file, and further displaying a corresponding page. The method can enable the preset form characters in the small program engineering style file to be automatically processed rapidly and accurately, and prevent the page from being messy.
Fig. 2 is a main flow diagram of a page processing method according to an embodiment of the present application, and as shown in fig. 2, the page processing method includes:
step S201, receiving a page processing request, acquiring a corresponding application type identifier, and determining a corresponding file extension according to the application type identifier.
The page processing request may be triggered after a scrambled page has occurred. The execution main body receives the page processing request, executes the acquisition process of the corresponding application program type identifier, and calls the corresponding key value to the database according to the application program type identifier so as to determine the corresponding file extension name from the key value to the database.
By way of example, the file extension may be: js, wxml, json, wxss, acss, css, ttss, qss, css, etc., the embodiment of the present application does not specifically limit the file extension.
Step S202, determining the file type based on the file extension, responding to the file type as the page style file, acquiring the corresponding page style file identification, and further performing file retrieval based on the page style file identification to obtain a style file array.
The page style file identifications may include an identification 1 corresponding to the global style file and/or an identification 2 corresponding to each style file. And generating an asynchronous retrieval task according to the determined page style file identification, and calling a thread pool to retrieve the corresponding global style file so as to obtain a style file array composed of retrieval results. Thereby improving the generation efficiency of the style file array and further improving the page processing efficiency.
Step S203, compiling the style file array into a series of nodes, and obtaining attribute values of the series of nodes.
Specifically, compiling the style file array into a series of nodes includes: and calling a parsing tool plug-in to convert each style file in the style file array into an abstract syntax tree, thereby obtaining a series of nodes consisting of each node on the abstract syntax tree. Parsing tool plug-ins, such as postacs plug-ins. Each node on the abstract syntax tree represents a structure in the source code. The advantage of using AST to transcode is that the code can be analyzed, optimized, reconstructed, etc. during the transcoding process.
In step S204, the preset regular expression is invoked to verify whether the corresponding character string of the preset form character (for example, chinese character, or other language character) is included between the beginning (i.e., the first character of the chinese character set) and the end (i.e., the second character of the chinese character set) of the character string corresponding to the attribute value based on the first preset form character (for example,_4e00) and the second preset form character (for example,_9fa5) of the preset form character set, and if so, determining the node corresponding to the attribute value of the character string including the corresponding preset form character (for example, chinese character, or other language character) as the target node.
For example, the style file attribute value is detected by using/+_u4E00-_9FA5] + $/this regular expression. The regular expression/++u4E00-_9FA5] + $/matches one or more Chinese characters. Where u4E00 and u9FA5 are Unicode encodings, representing the first and last characters of the Chinese character set, respectively. Therefore, the regular expression matches a character string containing one or more Chinese characters between the beginning and the end of the character string, and if so, the node corresponding to the character string is the target node.
Step S205, based on the target node, executing a data replacement process to obtain a corresponding new style file, updating the style file array according to the new style file, and displaying the corresponding page.
Specifically, after obtaining the corresponding new style file, the method further includes: storing the new style file to the application engineering catalog. So as to ensure the accuracy of the style file array obtained by subsequent retrieval.
FIG. 4 is a main flow diagram of traversing applet style files for a page processing method according to one embodiment of the present application. The overall implementation flow of the page processing method of the embodiment of the application is that (1) the type of the applet is selected; (2) processing each style file; (3) the developer processes the output file. Specifically, in the process of processing each style file, traversing the style file, and if the attribute value of the style file contains Chinese characters, replacing the Chinese characters with corresponding unicode codes. As shown in fig. 4, in the process of traversing the style files, whether the traversing is completed is detected in real time, if yes, the completion is prompted, if not, the postscs device is continuously used for processing each style file, whether the attribute value of the style file contains a chinese character is judged, if yes, the chinese character is converted into unicode code to generate a new style file, if no, or after the new style file is generated, whether the traversing is completed is continuously judged until the completion of the traversing is completed, and the generation of the new style file is finished. If the attribute value of the style file contains Chinese characters, outputting the converted content to a new file under the same directory, wherein the original file is index.
In the applet wxss file, a page is a selector for selecting the root element of the page. In this example, a before pseudo element is used to insert content, such as "hello" is shown on a page. The corresponding record in the index. Wxss file, from content: "hello"; to content: "\4f60\597d"; the page starts still displaying "hello". The unicode code of "hello" is "\4f60\597d". In the cascading style sheet (Cascading Style Sheets, css), unicode encoding is represented using a single reverse slash/notation, while u is omitted. The embodiment of the application is to newly generate a style file without covering the original style file, so that a developer can compare the optimized file content conveniently, if the optimized content is confirmed to have no problem, the optimized content can be replaced with the original style file content, and then the bak style file is deleted. The method is based on Chinese character conversion in the applet engineering style file to avoid the possible occurrence of display messy codes of the applet page and improve the maintainability of the item.
Fig. 5 is a schematic diagram of main units of the page processing apparatus according to the embodiment of the present application. As shown in fig. 5, the page processing apparatus 500 includes a receiving unit 501, a retrieving unit 502, a compiling unit 503, a target node determining unit 504, and an updating unit 505.
The receiving unit 501 is configured to receive the page processing request, obtain the corresponding application type identifier, and determine the corresponding file extension according to the application type identifier.
The retrieving unit 502 is configured to determine a file type based on the file extension, obtain a corresponding page style file identifier in response to the file type being a page style file, and further perform file retrieval based on the page style file identifier to obtain a style file array.
The compiling unit 503 is configured to compile the style file array into a series of nodes, and obtain attribute values of the series of nodes.
The target node determining unit 504 is configured to determine the corresponding character string according to the attribute value, and further determine the target node based on the character string.
The updating unit 505 is configured to perform a data replacement process based on the target node, so as to obtain a corresponding new style file, update the style file array according to the new style file, and further display the corresponding page.
In some embodiments, the target node determination unit 504 is further configured to: invoking a preset regular expression to verify whether the corresponding character string of the preset form character is contained between the beginning and the end of the character string corresponding to the first preset form character and the second preset form character based on the preset form character set, and if so, determining the node corresponding to the attribute value of the character string containing the corresponding preset form character as a target node.
In some embodiments, the updating unit 505 is further configured to: and replacing the character string of the preset form character in the target node with a preset corresponding character code to obtain a corresponding new style file.
In some embodiments, the updating unit 505 is further configured to: and executing the checking process of the original-type file corresponding to the new style file and the target node, replacing the original-type file with the new style file and deleting the original-type file in response to the successful checking.
In some embodiments, the compiling unit 503 is further configured to: and calling a parsing tool plug-in to convert each style file in the style file array into an abstract syntax tree, thereby obtaining a series of nodes consisting of each node on the abstract syntax tree.
In some embodiments, the page processing apparatus further comprises a memory unit, not shown in fig. 5, configured to: storing the new style file to the application engineering catalog.
In some embodiments, the page processing apparatus further comprises an exclusion unit, not shown in fig. 5, configured to: and excluding the style file corresponding to the third party from the application engineering catalog so as to update the application engineering catalog.
It should be noted that, the page processing method and the page processing apparatus of the present application have a corresponding relationship in terms of implementation content, so repeated descriptions are not repeated.
Fig. 6 illustrates an exemplary system architecture 600 in which the page processing method or page processing apparatus of embodiments of the present application may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used as a medium to provide communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 605 via the network 604 using the terminal devices 601, 602, 603 to receive or send messages, etc. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 601, 602, 603.
The terminal devices 601, 602, 603 may be various electronic devices having a page processing screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (by way of example only) that provides support for page processing requests submitted by users using the terminal devices 601, 602, 603. The background management server can receive the page processing request, acquire the corresponding application program type identifier and determine the corresponding file extension name according to the application program type identifier; determining a file type based on the file extension, responding to the file type as a page style file, acquiring a corresponding page style file identifier, and further performing file retrieval based on the page style file identifier to obtain a style file array; compiling a style file array into a series of nodes, and acquiring attribute values of the series of nodes; determining a corresponding character string according to the attribute value, and further determining a target node based on the character string; and executing a data replacement process based on the target node to obtain a corresponding new style file, updating a style file array according to the new style file, and further displaying a corresponding page. The method can enable the preset form characters in the small program engineering style file to be automatically processed rapidly and accurately, and prevent the page from being messy.
It should be noted that, the page processing method provided in the embodiment of the present application is generally executed by the server 605, and accordingly, the page processing apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to fig. 7, there is illustrated a schematic diagram of a computer system 700 suitable for use in implementing the terminal device of an embodiment of the present application. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data required for the operation of the computer system 700 are also stored. The CPU701, ROM702, and RAM703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input section 706 including a keyboard, a mouse, and the like; an output section 707 including a Cathode Ray Tube (CRT), a liquid crystal credit authorization query processor (LCD), and the like, and a speaker, and the like; a storage section 708 including a hard disk or the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. The drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read therefrom is mounted into the storage section 708 as necessary.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments disclosed herein include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 709, and/or installed from the removable medium 711. The above-described functions defined in the system of the present application are performed when the computer program is executed by a Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium may include, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware. The described units may also be provided in a processor, for example, described as: a processor includes a receiving unit, a retrieving unit, a compiling unit, a target node determining unit, and an updating unit. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
As another aspect, the present application also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs, and when the one or more programs are executed by the device, the device receives a page processing request, obtains a corresponding application type identifier, and determines a corresponding file extension according to the application type identifier; determining a file type based on the file extension, responding to the file type as a page style file, acquiring a corresponding page style file identifier, and further performing file retrieval based on the page style file identifier to obtain a style file array; compiling a style file array into a series of nodes, and acquiring attribute values of the series of nodes; determining a corresponding character string according to the attribute value, and further determining a target node based on the character string; and executing a data replacement process based on the target node to obtain a corresponding new style file, updating a style file array according to the new style file, and further displaying a corresponding page.
The computer program product of the present application comprises a computer program which, when executed by a processor, implements the page processing method in the embodiments of the present application.
According to the technical scheme of the embodiment of the application, the preset form characters in the small program engineering style file can be automatically processed rapidly and accurately, and disorder codes of pages are prevented.
The above embodiments do not limit the scope of the application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application are intended to be included within the scope of the present application.

Claims (16)

1. A method of processing a page, comprising:
receiving a page processing request, acquiring a corresponding application program type identifier, and determining a corresponding file extension according to the application program type identifier;
determining a file type based on the file extension, responding to the file type as a page style file, acquiring a corresponding page style file identifier, and further performing file retrieval based on the page style file identifier to obtain a style file array;
Compiling the style file array into a series of nodes, and acquiring attribute values of the series of nodes;
determining a corresponding character string according to the attribute value, and further determining a target node based on the character string;
and executing a data replacement process based on the target node to obtain a corresponding new style file, updating the style file array according to the new style file, and further displaying a corresponding page.
2. The method of claim 1, wherein the determining the target node comprises:
and calling a preset regular expression to verify whether the character string of the corresponding preset form character is contained between the beginning and the end of the character string corresponding to the attribute value based on the first preset form character and the second preset form character of the preset form character set, and if so, determining the node corresponding to the attribute value of the character string containing the corresponding preset form character as a target node.
3. The method of claim 1, wherein the performing a data replacement process based on the target node to obtain a corresponding new style file comprises:
and replacing the character string of the preset form character in the target node with a preset corresponding character code to obtain a corresponding new style file.
4. The method of claim 1, wherein the updating the style file array from the new style file comprises:
and executing a checking process of the original-type file corresponding to the new style file and the target node, replacing the original-type file with the new style file and deleting the original-type file in response to the successful checking.
5. The method of claim 1, wherein compiling the style file array into a series of nodes comprises:
and calling a parsing tool plug-in to convert each pattern file in the pattern file array into an abstract syntax tree, and further obtaining a series of nodes consisting of each node on the abstract syntax tree.
6. The method of claim 1, wherein after the obtaining the corresponding new style file, the method further comprises:
and storing the new style file to the application engineering catalog.
7. The method of claim 1, wherein prior to the determining a file type based on the file extension, in response to the file type being a page-style file, obtaining a corresponding page-style file identification, and further performing file retrieval based on the page-style file identification to obtain a style file array, the method further comprises:
And excluding the style file corresponding to the third party from the application engineering catalog so as to update the application engineering catalog.
8. A page processing apparatus, comprising:
the receiving unit is configured to receive the page processing request, acquire a corresponding application type identifier and determine a corresponding file extension according to the application type identifier;
the retrieval unit is configured to determine a file type based on the file extension, respond to the file type as a page style file, acquire a corresponding page style file identifier, and further perform file retrieval based on the page style file identifier to obtain a style file array;
the compiling unit is configured to compile the style file array into a series of nodes and acquire attribute values of the series of nodes;
a target node determining unit configured to determine a corresponding character string according to the attribute value, and further determine a target node based on the character string;
and the updating unit is configured to execute a data replacement process based on the target node so as to obtain a corresponding new style file, update the style file array according to the new style file, and further display a corresponding page.
9. The apparatus of claim 8, wherein the target node determination unit is further configured to:
and calling a preset regular expression to verify whether the character string of the corresponding preset form character is contained between the beginning and the end of the character string corresponding to the attribute value based on the first preset form character and the second preset form character of the preset form character set, and if so, determining the node corresponding to the attribute value of the character string containing the corresponding preset form character as a target node.
10. The apparatus of claim 8, wherein the updating unit is further configured to:
and replacing the character string of the preset form character in the target node with a preset corresponding character code to obtain a corresponding new style file.
11. The apparatus of claim 8, wherein the updating unit is further configured to:
and executing a checking process of the original-type file corresponding to the new style file and the target node, replacing the original-type file with the new style file and deleting the original-type file in response to the successful checking.
12. The apparatus of claim 8, wherein the compiling unit is further configured to:
And calling a parsing tool plug-in to convert each pattern file in the pattern file array into an abstract syntax tree, and further obtaining a series of nodes consisting of each node on the abstract syntax tree.
13. The apparatus of claim 8, further comprising a storage unit configured to:
and storing the new style file to the application engineering catalog.
14. A page processing electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-7.
15. A computer readable medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any of claims 1-7.
16. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-7.
CN202311592981.9A 2023-11-27 2023-11-27 Page processing method and device, electronic equipment and computer readable medium Pending CN117633388A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311592981.9A CN117633388A (en) 2023-11-27 2023-11-27 Page processing method and device, electronic equipment and computer readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311592981.9A CN117633388A (en) 2023-11-27 2023-11-27 Page processing method and device, electronic equipment and computer readable medium

Publications (1)

Publication Number Publication Date
CN117633388A true CN117633388A (en) 2024-03-01

Family

ID=90015723

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311592981.9A Pending CN117633388A (en) 2023-11-27 2023-11-27 Page processing method and device, electronic equipment and computer readable medium

Country Status (1)

Country Link
CN (1) CN117633388A (en)

Similar Documents

Publication Publication Date Title
CN109492053B (en) Method and device for accessing data
CN110555030B (en) SQL sentence processing method and device
CN113760948A (en) Data query method and device
CN108959294B (en) Method and device for accessing search engine
CN110851343A (en) Test method and device based on decision tree
CN112559024A (en) Method and device for generating transaction code change list
CN116775613A (en) Data migration method, device, electronic equipment and computer readable medium
CN112100168A (en) Method and device for determining data association relationship
CN116204428A (en) Test case generation method and device
CN117633388A (en) Page processing method and device, electronic equipment and computer readable medium
CN111026629A (en) Method and device for automatically generating test script
CN115543967A (en) Data migration method and device, electronic equipment and computer readable medium
CN114625373A (en) Application conversion method and device, electronic equipment and storage medium
CN113704222A (en) Method and device for processing service request
CN113704242A (en) Data processing method and device
CN112214500A (en) Data comparison method and device, electronic equipment and storage medium
CN112925573B (en) Method, device, equipment and computer readable medium for loading web page
CN110727739B (en) Data storage method and device
CN115994145B (en) Method and device for processing data
KR102258241B1 (en) Server side data component for support of development and management and method for perform the data component
CN115993981A (en) Data processing method, device, electronic equipment and computer readable medium
CN117743156A (en) Test method, test device, electronic equipment and computer readable medium
CN117785205A (en) Data evaluation method, device, electronic equipment and computer readable medium
CN118259917A (en) Information generation method, device, electronic equipment and computer readable medium
CN118170677A (en) Data analysis method, device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination