Text configuration-based page generation method and device, electronic equipment and storage medium
By using predefined format tagging tables and cross-platform development frameworks, the text content is converted into HTML text, which solves the cumbersome configuration problems in the existing technology, and realizes simplified text format management and efficient page generation.
Patent Information
- Application Number
- CN202510317906.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-06-13
AI Technical Summary
In the prior art, plain text editors and rendering solutions require the development of custom logic for specific styles, resulting in cumbersome configuration and difficult to expand.
The text content is configured in segments using a predefined format tag table, and the tagged text is converted into a configuration file type that can be parsed by the application service through the cross-platform mobile application development framework, and HTML text is generated and rendered.
Simplifies the text format configuration process, improves page generation efficiency, and reduces configuration complexity.
Smart Images

Figure CN120144129A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular, to a method, device, electronic device, and storage medium for generating a page based on text configuration. Background Art
[0002] In the design of visual network pages, it is a common technique to configure the format of pure text content to obtain rich text with better display effects. Currently, there are various rich text editors and rendering solutions implemented with pure text on the market, and the commonly used configuration method is to manage text and styles separately. This method often requires developing custom logic for specific styles in practical applications, resulting in cumbersome configuration and difficult expansion. Summary of the Invention
[0003] In view of the above, it is necessary to provide a method for generating a page based on text configuration, which is used to segment and configure texts of different styles using a predefined format tag table to manage and configure multi-style texts intuitively and simply.
[0004] To achieve the above object, the present invention provides a method for generating a page based on text configuration, and the method includes:
[0005] Receiving page text information about a preset application service sent by a user, identifying the text content in the page text information and the text format corresponding to the text content, obtaining a text tag corresponding to the text format from a predefined format tag table, and generating a tagged text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text tag corresponding to the text format;
[0006] Obtaining configuration file information of the application service, obtaining a configuration file type that can be parsed by the application service based on the configuration file information, and inputting the tagged text into a preset cross-platform mobile application development framework to convert it into a configuration file type that can be parsed by the application service to obtain a file to be parsed;
[0007] Parsing the file to be parsed to obtain text information with text tags, converting the text information with text tags into configuration text in a preset text format, generating HTML text based on the configuration text in the preset text format, and rendering the HTML text to generate a visual page of the application service.
[0008] Optionally, the page text information includes text content and text format, and the receiving page text information about a preset application service sent by a user includes:
[0009] Receiving the text content input by the user through a text input box in the text configuration interface provided by the preset application service;
[0010] Receive the text format input by the user through the format selection box in the text configuration interface provided by the preset application service.
[0011] Optionally, identifying the text content in the page text information and the text format corresponding to the text content includes:
[0012] Parse the text content in the page text information;
[0013] Divide the text content with continuous content and the same text format into one paragraph of text, obtaining one or more paragraphs of text content and the text format of each paragraph of text content.
[0014] Optionally, obtaining the text mark corresponding to the text format from the predefined format mark table, and generating the marked text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text mark corresponding to the text format includes:
[0015] When the text mark corresponding to the text format is not obtained from the predefined format mark table, determine that the text format corresponding to the text content is the default format, and generate the text content without text marks;
[0016] When the text mark corresponding to the text format is obtained from the predefined format mark table, add the text mark corresponding to the text format before the text content, and add a termination mark after the text content to obtain the marked text corresponding to the text content.
[0017] Optionally, converting the text information with text marks into a configuration text in a preset text format includes:
[0018] Identify the text marks in the text information with text marks;
[0019] Match the format label of the preset text format corresponding to the text mark according to the preset mark - label association table;
[0020] Convert the text information with text marks into a configuration text in a preset text format according to the format label of the preset text format.
[0021] Optionally, generating HTML text based on the configuration text in the preset text format includes:
[0022] Identify the content label and format label in the configuration text in the preset text format;
[0023] Combine the content label and format label to generate the corresponding HTML label;
[0024] Generate HTML text according to the HTML tags.
[0025] Optionally, rendering the HTML text to generate the visual page of the application service includes:
[0026] Parse the HTML text to obtain a document object model tree and a CSS object model tree;
[0027] Merge the CSS object model tree into the document object model tree to obtain a merged model tree, traverse the nodes of the merged model tree and calculate the styles of each node to obtain a merged model tree with node styles;
[0028] Recursively traverse the merged model tree with node styles, calculate the geometric information of each node to obtain a layout tree;
[0029] Perform layer stratification on the layout tree to obtain a hierarchical tree, and separately generate corresponding drawing instruction sets for each layer in the hierarchical tree;
[0030] Perform chunking and rasterization on the layers in the hierarchical tree, and perform synchronous painting rendering according to the position information of each layer and each chunk using the corresponding drawing instruction sets to obtain the visual page corresponding to the HTML text.
[0031] In addition, to achieve the above object, the present invention also provides a page generation device based on text configuration, including:
[0032] A text rewriting module for receiving page text information about a preset application service sent by a user, identifying the text content in the page text information and the text format corresponding to the text content, obtaining the text mark corresponding to the text format from a predefined format mark table, and generating the marked text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text mark corresponding to the text format;
[0033] A type conversion module for obtaining the configuration file information of the application service, obtaining the configuration file type that can be parsed by the application service based on the configuration file information, and inputting the marked text into a preset cross-platform mobile application development framework to convert it into the configuration file type that can be parsed by the application service to obtain a file to be parsed;
[0034] A parsing and rendering module for parsing the file to be parsed to obtain text information with text marks, converting the text information with text marks into configuration text in a preset text format, generating HTML text based on the configuration text in the preset text format, and rendering the HTML text to generate the visual page of the application service.
[0035] In addition, to achieve the above object, the present invention further provides an electronic device, which includes:
[0036] At least one processor; and,
[0037] A memory communicatively connected to the at least one processor; wherein,
[0038] The memory stores a computer program executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned page generation method based on text configuration.
[0039] In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is executed by a processor in an electronic device to implement the above-mentioned page generation method based on text configuration.
[0040] The present invention rewrites the page text information of an application according to the text format corresponding to the text content by using a predefined format tag table to obtain a tagged text, converts the file type of the tagged text into a configuration file type that can be parsed by an application service through a preset cross-platform mobile application development framework to obtain a file to be parsed, generates a configuration text in a preset text format based on the file to be parsed, generates an HTML text according to the configuration text in the preset text format, and renders the HTML text to generate a page, reducing the complexity of text format configuration, simplifying the text format configuration process, and improving the efficiency of page generation. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 It is a flowchart of an embodiment of the page generation method based on text configuration of the present invention;
[0042] Figure 2 It is a schematic diagram of an embodiment of the electronic device of the present invention;
[0043] Figure 3 It is a schematic diagram of an embodiment of the page generation device based on text configuration of the present invention.
[0044] The realization of the object of the present application, functional features and advantages will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0045] In order to make the objectives, technical solutions and advantages of the present invention more clear and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0046] It should be noted that the descriptions involving "first", "second", etc. in the present invention are only for descriptive purposes and cannot be construed as indicating or implying their relative importance or implicitly indicating the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of such features. In addition, the technical solutions between various embodiments may be combined with each other, but it must be based on the ability of those of ordinary skill in the art to implement. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the protection scope required by the present invention.
[0047] As Figure 1 shown, it is a flowchart of an embodiment of the page generation method based on text configuration of the present invention, including steps S1 - S3.
[0048] S1. Receive the page text information about the preset application service sent by the user, identify the text content in the page text information and the text format corresponding to the text content, obtain the text marker corresponding to the text format from the predefined format marker table, and generate the marker text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text marker corresponding to the text format;
[0049] In one embodiment, the preset application service is installed on the server side and the client side, and a text configuration interface is provided on the server side for obtaining the page text information input by the background administrator user of the application service.
[0050] In one embodiment, the text configuration interface includes a text input box, a format selection box, and a confirmation button. The page text information includes text content and text format. The receiving of the page text information about the preset application service sent by the user includes:
[0051] Receiving the text content input by the user through the text input box provided by the text configuration interface of the preset application service;
[0052] Receiving the text format input by the user through the format selection box provided by the text configuration interface;
[0053] Confirm the text content and text format through the text configuration interface and use them as the page text information of the preset application service.
[0054] Specifically, the text format is the character format of the text content, such as font, font style, font size, font color, artistic effect, etc.
[0055] In one embodiment, the text configuration interface further includes a display area, which is used to display the text content received by the text input box according to the text format received by the format selection box, so that the user can view the display effect of the text content and the corresponding text format.
[0056] In one embodiment, the text configuration interface can receive the text content and text format sent by the user multiple times, and merge the text content and text format received multiple times in the order of reception to obtain the page text information.
[0057] For example: The user enters "This is a bold red text" in the text input box of the text configuration interface, and selects red and bold in the format selection box. The display area of the text configuration interface displays the page text information with the text content "This is a bold red text" and the text format "Red font / Bold font". When the user clicks the confirmation button to confirm, the text configuration interface clears the text input box and the format selection box for the user to continue inputting or exit the text configuration interface. The user continues to enter "There is also an italic underlined text" in the text input box of the text configuration interface and selects italic and underline in the format selection box. At this time, the display area of the text configuration interface adds the display content with the text content "There is also an italic underlined text" and the text format "Italic font / Underline" after the display content with the text content "This is a bold red text" and the text format "Red font / Bold font".
[0058] In one embodiment, identifying the text content in the page text information and the text format corresponding to the text content includes:
[0059] Parse the text content in the page text information;
[0060] Divide the text content with continuous content and the same text format into one paragraph of text, obtaining one or more paragraphs of text content and the text format of each paragraph of text content.
[0061] For example: The text content in the page text information contains 4 short sentences. The text format of the first short sentence is A, the text format of the second short sentence is A, the text format of the third short sentence is B, and the text format of the fourth short sentence is A. Since the first short sentence is connected to the second short sentence and they have the same text format, the first short sentence and the second short sentence with continuous content and the same text format are divided into one paragraph of text. The fourth short sentence has the same text format as the first and second short sentences but is separated by other text (the third short sentence) in the middle, so it is determined that the content of the fourth short sentence is not continuous with the first and second short sentences. Therefore, the text content is divided into three paragraphs of text. The first paragraph of text is the first and second short sentences, the second paragraph of text is the third short sentence, and the third paragraph of text is the fourth short sentence.
[0062] In one embodiment, the text markers corresponding to the text formats obtained based on the predefined format marker table include shorthand markers, attribute-value pair markers, and composite markers obtained by combining the shorthand markers and the attribute-value pair markers. Specifically, the text markers are text markers obtained by corresponding simplification based on the format tags of the preset text formats, and the text markers are associated and stored with the format tags of the corresponding preset text formats to generate a marker-tag association table. The preset text format can be a rich text format.
[0063] For example: shorthand marker <del>Indicates strikethrough of text information; shorthand notation <bold>Indicates bolding of text information; the attribute value pair tag <color='red'> indicates changing the color of the text information to red; the attribute value pair tag <size='24px'> indicates setting the font size of the text information to 24px; the composite tag <color='red' bold> indicates changing the color of the text information to red and simultaneously bolding the text information.
[0064] In one embodiment, obtaining the text tag corresponding to the text format from a predefined format tag table and generating the tagged text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text tag corresponding to the text format includes:
[0065] When the text tag corresponding to the text format is not obtained from the predefined format tag table, it is determined that the text format corresponding to the text content is the default format, and the text content without text tags is generated;
[0066] When the text tag corresponding to the text format is obtained from the predefined format tag table, the text tag corresponding to the text format is added before the text content, and a termination tag is added after the text content to obtain the tagged text corresponding to the text content.
[0067] For example: "This is a piece of text, <color=\\\"red' bold>The words in the middle are in bold red.\\\" In this abbreviated tagged text, \\\"This is a piece of text,\\\" is the text content without text tags, and \\\"The words in the middle are in bold red.\\\" is the text with the text format of bold red.
[0068] In this embodiment, the text content in the page text information input by the user is rewritten based on a predefined format tag table in the form of a combination of multiple groups of text content and text tags to obtain tagged text. Compared with the page text information that manages the format and text separately, it can more intuitively display the corresponding format of the text, facilitate the user to manage the text format, and greatly reduce the complexity of text configuration.
[0069] S2. Obtain the configuration file information of the application service, obtain the configuration file type that can be parsed by the application service based on the configuration file information, and input the tagged text into a preset cross-platform mobile application development framework to convert it into the configuration file type that can be parsed by the application service to obtain a file to be parsed;
[0070] Specifically, the file type of the marked text refers to the type of the file to which the marked text belongs, and the file type can be determined according to the extension of the file. Common file types include document files, graphic files, sound files, animation files, database files, code files, configuration files, etc. In this embodiment, the file to which the marked text belongs is usually a document file. Document files include text files (such as.txt), Word documents (such as.doc), rich text format files (such as.rtf), web page files (such as.html), PDF files (such as.pdf), etc.
[0071] In one embodiment, the preset cross-platform mobile application development framework is the WEEX framework. The WEEX framework is a framework that can develop high-performance native applications using modern Web technologies, and can build iOS, Android, and Web applications through a single codebase using Web-like syntax. The WEEX framework uses native components and native modules to maximize the performance advantages of native rendering and platform capabilities. All components and modules are pluggable and extensible, and can be compiled into different target files using the same code and run on Web, Android, and iOS platforms respectively. The native components and modules have different implementations on different platforms, but they all provide the same interfaces.
[0072] In one embodiment, the application service includes a server side and a client side, and the application service sends the file to be parsed from the server side to the client side for parsing and rendering through the WEEX framework.
[0073] In this embodiment, converting the file type of the marked text into a configuration file type that can be parsed by the application service through the WEEX framework can adapt to multiple page platforms and interfaces, and improve the compatibility of the file to be parsed.
[0074] S3. Parse the file to be parsed to obtain text information with text marks, convert the text information with text marks into a configuration text in a preset text format, generate an HTML text based on the configuration text in the preset text format, and render the HTML text to generate a visual page of the application service.
[0075] In one embodiment, the converting the text information with text marks into a configuration text in a preset text format includes:
[0076] Identify the text marks in the text information with text marks;
[0077] Match the format tags in the preset text format corresponding to the text marks according to a preset mark-tag association table;
[0078] Convert the text information with text markers into configuration text in a preset text format according to the format tags of the preset text format.
[0079] In one embodiment, when the text information is text content without text markers, convert the text information into configuration text in a preset text format according to the empty format tags of the preset text format.
[0080] In one embodiment, the preset text format may be a rich text format. For example: the text information corresponding to the file to be parsed is "This is a piece of text, <color='red'bold>the middle words are in red and bold,
[0081] <size='12px'del>here is the text with a 12px strikethrough, and here is the normal text”.
[0082] Identify that the first paragraph of text information "This is a piece of text," has no corresponding text markers, and convert it according to the rich text format as follows:
[0083] arr[0]:{
[0084] text:'This is a piece of text,',
[0085] style:{}
[0086] }
[0087] Identify that the second paragraph of text information "the middle words are in red and bold," has the corresponding text marker as
[0088] <color='red'bold>, and convert it according to the corresponding rich text format as follows:
[0089] arr[1]:{
[0090] text:'the middle words are in red and bold,',
[0091] style:{color:'red'; fontWeight:'bold'}
[0092] }
[0093] Identify that the third paragraph of text information "here is the text with a 12px strikethrough," has the corresponding text marker <size='12px'del>, and convert it according to the corresponding rich text format as follows:
[0094] arr[2]:{
[0095] text:'here is the text with a 12px strikethrough,',
[0096] style: {fontSize: '12px'; textDecoration: 'line-through'}
[0097] }
[0098] It is recognized that there is no corresponding text marker for the fourth paragraph of text information "Here is ordinary text again", and it is converted according to the rich text format as follows:
[0099] arr[3]: {
[0100] text: 'Here is ordinary text again',
[0101] style: {}
[0102] }
[0103] Concatenate the above four paragraphs of text information in sequence to obtain the configuration text in rich text format.
[0104] Rich Text Format (RTF) is a cross-platform document format widely used to exchange text and graphic information between different word processing software. RTF files are recognized by their.rtf suffix, and most word processing programs can open and edit files in this format. The RTF format supports text formatting options such as fonts, colors, tables, and pictures to ensure a consistent appearance on different platforms. Rich text format files can be shared and viewed between different operating systems and software applications, ensuring that the format and content of the document remain consistent across different platforms. Compared with other format files, rich text format files are usually smaller, making them convenient for storage, sending, and uploading. Most word processing software can read and save rich text format documents, providing a wide range of application scenarios.
[0105] In one embodiment, generating HTML text based on the configuration text of the preset text format includes:
[0106] Identifying the content tags and format tags in the configuration text of the preset text format;
[0107] Combining the content tags and format tags to generate corresponding HTML tags;
[0108] Generating HTML text according to the HTML tags.
[0109] For example: The configuration text of the preset text format is as follows:
[0110] arr[0]: {
[0111] text: 'This is a paragraph of text,',
[0112] style:{}
[0113] }
[0114] arr[1]:{
[0115] text: 'The middle character is in red and bold,',
[0116] style: {color:'red'; fontWeight: 'bold'}
[0117] }
[0118] arr[2]:{
[0119] text: 'Here is text with a 12px strikethrough,',
[0120] style: {fontSize: '12px'; textDecoration: 'line-through'}
[0121] }
[0122] arr[3]:{
[0123] text: 'Here is ordinary text again',
[0124] style:{}
[0125] }
[0126] Read the content tags (text) and format tags (style) in the configuration text in the above preset text format, and convert them to HTML text to get:
[0127] <text>This is a text,< / text>
[0128] <text style="color:'red'; fontWeight: 'bold'">The middle character is in red and bold,
[0129] <text style="fontSize: '12px'; textDecoration: 'line-through'">Here is text with a 12px strikethrough,
[0130] <text>Here is ordinary text again< / text>
[0131] In one embodiment, the rendering of the HTML text to generate the visual page of the application service includes:
[0132] Parse the HTML text to obtain a document object model tree and a CSS object model tree;
[0133] Merge the CSS object model tree into the document object model tree to obtain a merged model tree, traverse the nodes of the merged model tree and calculate the styles of each node to obtain a merged model tree with node styles;
[0134] Recursively traverse the merged model tree with node styles, calculate the geometric information of each node to obtain a layout tree;
[0135] Perform layer stratification on the layout tree to obtain a hierarchical tree, and generate a corresponding drawing instruction set for each layer in the hierarchical tree separately;
[0136] Chunk and rasterize the layers in the hierarchical tree, and perform synchronous painting rendering using the corresponding drawing instruction set according to the position information of each layer and each chunk to obtain the visual page corresponding to the HTML text.
[0137] Specifically, before starting to parse the HTML text, start a pre-parsing thread to download external CSS files and external JS files in the HTML file.
[0138] Specifically, when parsing the HTML text, convert the HTML text into a string, mark the HTML text tags in the string, parse the string into multiple node nodes according to the marks, and generate a document object model tree based on the node nodes; parse the format tags of the HTML text to obtain a Cascading Style Sheet (CSS), mark and parse the cascading style sheet to generate a CSS object model tree, and the default styles, internal styles, external styles, and inline styles of the HTML text will all be included in the CSS object model tree.
[0139] Specifically, calculating the styles of each node in the merged model tree includes: obtaining the element attribute values of each node, calculating the absolute values corresponding to the preset values of the element attribute values, and assigning the attribute values of all styles to each node according to the calculation results.
[0140] Specifically, calculate the geometric information of the node according to the page layout information of each node in the merged model tree, and the geometric information is geometric information such as the position of the node on the page (coordinates of X, Y) and the size of the box model.
[0141] As can be seen from the above embodiments, the page generation method based on text configuration proposed by the present invention rewrites the page text information of the application according to the text format corresponding to the text content by using a predefined format tag table to obtain a tagged text, converts the file type of the tagged text into a configuration file type that can be parsed by the application service through a preset cross-platform mobile application development framework to obtain a file to be parsed, generates a configuration text in a preset text format based on the file to be parsed, generates an HTML text according to the configuration text in the preset text format, and renders the HTML text to generate a page, reducing the complexity of text format configuration, simplifying the text format configuration process, and improving the efficiency of page generation.
[0142] As Figure 2 shown, it is a schematic diagram of an embodiment of an electronic device according to the present invention. The electronic device 1 is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions. The electronic device 1 may be a computer, a server, or a server group composed of multiple servers.
[0143] In this embodiment, the electronic device 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can communicate with each other through a system bus. The memory 11 stores a page generation program 10 based on text configuration, and the page generation program 10 based on text configuration can be executed by the processor 12. Figure 3 Only the electronic device 1 with components 11-13 and the page generation program 10 based on text configuration is shown. Those skilled in the art can understand that Figure 3 the shown structure does not constitute a limitation on the electronic device 1, and it may include fewer or more components than shown, or combine some components, or have different component arrangements.
[0144] Among them, the memory 11 includes a memory and at least one type of readable storage medium. The memory provides a cache for the operation of the electronic device 1; the readable storage medium can be volatile or non-volatile. Specifically, the readable storage medium can be a storage medium such as a flash memory, a hard disk, a multimedia card, a card-type memory (such as an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the readable storage medium can be an internal storage unit of the electronic device 1, such as the hard disk of the electronic device 1; in other embodiments, the storage medium can also be an external storage device of the electronic device 1, such as a plug-in hard disk equipped on the electronic device 1, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. In this embodiment, the readable storage medium of the memory 11 mainly includes a program storage area and a data storage area. Among them, the program storage area is usually used to store the operating system installed in the electronic device 1 and various application software, such as storing the code of the page generation program 10 based on text configuration in an embodiment of the present invention, etc.; the data storage area can store data created according to the use of the blockchain node, such as various types of data that have been output or will be output.
[0145] In some embodiments, the processor 12 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication with other devices. In this embodiment, the processor 12 is used to run the program code stored in the memory 11 or process data, such as running the page generation program 10 based on text configuration, etc.
[0146] The network interface 13 can include a wireless network interface or a wired network interface, and the network interface 13 is used to establish a communication connection between the electronic device 1 and a server (not shown in the figure).
[0147] Optionally, the electronic device 1 may further include a user interface, which may include a display, an input unit such as a keyboard. Optionally, the user interface may further include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, an organic light-emitting diode (OLED) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visual user interface.
[0148] In an embodiment of the present invention, when the page generation program 10 based on text configuration is executed by the processor 12, the following steps S1 - S3 are implemented.
[0149] S1. Receive the page text information about the preset application service sent by the user, identify the text content in the page text information and the text format corresponding to the text content, obtain the text tag corresponding to the text format from the predefined format tag table, and generate the tagged text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text tag corresponding to the text format;
[0150] S2. Obtain the configuration file information of the application service, obtain the configuration file type that can be parsed by the application service based on the configuration file information, and input the tagged text into a preset cross-platform mobile application development framework to convert it into the configuration file type that can be parsed by the application service to obtain a file to be parsed;
[0151] S3. Parse the file to be parsed to obtain the text information with text tags, convert the text information with text tags into a configuration text in a preset text format, generate an HTML text based on the configuration text in the preset text format, and render the HTML text to generate the visual page of the application service.
[0152] The specific operation steps implemented by the above steps S1 - S3 are substantially the same as those in an embodiment of the page generation method based on text configuration of the present invention, and will not be elaborated here.
[0153] In other embodiments, the page generation program 10 based on text configuration may also be divided into one or more modules. The one or more modules are stored in the memory 11 and are executed by one or more processors (processor 12 in this embodiment) to complete the present invention. The module referred to in the present invention refers to a series of computer program instruction segments that can complete specific functions and is used to describe the execution process of the page generation program 10 based on text configuration in the electronic device 1.
[0154] As shown Figure 3 in the figure, it is a schematic diagram of an embodiment of the page generation device based on text configuration of the present invention.
[0155] In the first embodiment of the present invention, the page generation device 100 based on text configuration includes a text rewriting module 110, a type conversion module 120, and a parsing and rendering module 130. Exemplarily:
[0156] The text rewriting module 110 is configured to receive page text information about a preset application service sent by a user, identify the text content in the page text information and the text format corresponding to the text content, obtain a text marker corresponding to the text format from a predefined format marker table, and generate a marker text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text marker corresponding to the text format;
[0157] The type conversion module 120 is configured to obtain configuration file information of the application service, obtain a configuration file type that can be parsed by the application service based on the configuration file information, and input the marker text into a preset cross-platform mobile application development framework to convert it into a configuration file type that can be parsed by the application service to obtain a file to be parsed;
[0158] The parsing and rendering module 130 is configured to parse the file to be parsed to obtain text information with text markers, convert the text information with text markers into configuration text in a preset text format, generate HTML text based on the configuration text in the preset text format, and render the HTML text to generate a visual page of the application service.
[0159] The specific operation steps implemented when the above text rewriting module 110, type conversion module 120, and parsing and rendering module 130 are executed are substantially the same as those in the above embodiment, and will not be elaborated here.
[0160] In addition, an embodiment of the present invention further provides a computer-readable storage medium, which may be volatile or non-volatile. Specifically, the computer-readable storage medium may be any one or a combination of any several of a hard disk, a multimedia card, an SD card, a flash card, an SMC, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disc read-only memory (CD-ROM), a USB memory, etc. A page generation program 10 based on text configuration is stored in the computer-readable storage medium.
[0161] When the page generation program 10 based on text configuration is executed by a processor, the following operations are implemented:
[0162] A1. Receive the page text information of a preset application service sent by a user, identify the text content in the page text information and the text format corresponding to the text content, obtain the text mark corresponding to the text format from a predefined format mark table, and generate the marked text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text mark corresponding to the text format;
[0163] A2. Obtain the configuration file information of the application service, obtain the configuration file type that can be parsed by the application service based on the configuration file information, and input the marked text into a preset cross-platform mobile application development framework to convert it into the configuration file type that can be parsed by the application service to obtain a file to be parsed;
[0164] A3. Parse the file to be parsed to obtain text information with text marks, convert the text information with text marks into configuration text in a preset text format, generate HTML text based on the configuration text in the preset text format, and render the HTML text to generate the visual page of the application service.
[0165] The serial numbers of the embodiments of the present invention above are only for description and do not represent the advantages and disadvantages of the embodiments.
[0166] It should be noted that in this article, the terms "including", "comprising" or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements but also other elements not expressly listed, or also includes elements inherent to such process, device, article or method. Without further limitation, an element defined by the statement "including a..." does not exclude the existence of additional identical elements in the process, device, article or method including the element.
[0167] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disc) and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0168] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be similarly included in the patent protection scope of the present invention.< / bold> < / del>
Claims
1. A page generation method based on text configuration, characterized in that: The method comprises: Receiving page text information about a preset application service sent by a user, identifying text content in the page text information and a text format corresponding to the text content, obtaining a text tag corresponding to the text format from a predefined format tag table, and generating a tag text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text tag corresponding to the text format; Obtain configuration file information of the application service, obtain a configuration file type that can be parsed by the application service based on the configuration file information, and convert the markup text into a configuration file type that can be parsed by the application service by inputting the markup text into a preset cross-platform mobile application development framework to obtain a file to be parsed; Parse the file to be parsed to obtain text information with text tags, convert the text information with text tags into configuration text in a preset text format, generate HTML text based on the configuration text in the preset text format, and render the HTML text to generate a visualization page for the application service.
2. The page generation method based on text configuration as claimed in claim 1, characterized in that: The page text information includes text content and text format, and the receiving of the page text information about the preset application service sent by the user includes: Receiving text content input by a user through a text input box provided by the text configuration interface of the preset application service; Receiving a text format input by a user through a format selection box provided by the text configuration interface; The text content and text format are confirmed through the text configuration interface and used as page text information of the preset application service.
3. The page generation method based on text configuration as claimed in claim 1, characterized in that: The identifying the text content in the page text information and the text format corresponding to the text content includes: Parsing the text content in the page text information and the text format corresponding to the text content; The text content with continuous content and the same text format is divided into one paragraph of text, and one or more paragraphs of text content and the text format of each paragraph of text content are obtained.
4. The page generation method based on text configuration as claimed in claim 1, characterized in that: The step of acquiring a text mark corresponding to the text format from a predefined format mark table, and generating a markup text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text mark corresponding to the text format, comprises: When the text mark corresponding to the text format is not obtained from the predefined format mark table, determining that the text format corresponding to the text content is a default format, and generating text content without a text mark; When the text mark corresponding to the text format is obtained from the predefined format mark table, the text mark corresponding to the text format is added before the text content, and a termination mark is added after the text content to obtain the marked text corresponding to the text content.
5. The page generation method based on text configuration as claimed in claim 1, characterized in that: The step of converting the text information with text mark into a configuration text in a preset text format includes: Recognizing a text tag in the text information with the text tag; Matching a format tag of a preset text format corresponding to the text tag according to a preset tag-tag association table; The text information with the text mark is converted into a configuration text in the preset text format according to the format tag of the preset text format.
6. The page generation method based on text configuration as claimed in claim 1, characterized in that: The step of generating HTML text based on the configuration text in the preset text format includes: Identifying content tags and format tags in the configuration text of the preset text format; Combining the content tag and the format tag to generate a corresponding HTML tag; Generate HTML text according to the HTML tags.
7. The page generation method based on text configuration as claimed in claim 1, characterized in that: The step of rendering the HTML text to generate a visualization page of the application service includes: Parsing the HTML text to obtain a document object model tree and a CSS object model tree; Merging the CSS object model tree into the document object model tree to obtain a merged model tree, traversing the nodes of the merged model tree and calculating the style of each node to obtain a merged model tree with node styles; Recursively traverse the merged model tree with node patterns, and calculate the geometric information of each node to obtain a layout tree; The layout tree is layered to obtain a hierarchical tree, and a corresponding drawing instruction set is generated for each layer in the hierarchical tree; The layers in the hierarchical tree are divided into blocks and rasterized, and the corresponding drawing instruction set is used to perform synchronous drawing rendering according to the position information of each layer and each block to obtain a visualization page corresponding to the HTML text.
8. A page generation device based on text configuration, characterized in that: include: A text rewriting module is used to receive page text information about a preset application service sent by a user, identify text content in the page text information and a text format corresponding to the text content, obtain a text tag corresponding to the text format from a predefined format tag table, and generate a tag text corresponding to the text content based on the text content, the text format corresponding to the text content, and the text tag corresponding to the text format; A type conversion module, used to obtain configuration file information of the application service, obtain a configuration file type that can be parsed by the application service based on the configuration file information, and convert the markup text input into a preset cross-platform mobile application development framework into a configuration file type that can be parsed by the application service to obtain a file to be parsed; A parsing and rendering module is used to parse the file to be parsed to obtain text information with text tags, convert the text information with text tags into a configuration text in a preset text format, generate HTML text based on the configuration text in the preset text format, and render the HTML text to generate a visualization page for the application service.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the page generation method based on text configuration as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for generating a page based on text configuration as claimed in any one of claims 1 to 7 is implemented.