CN113761871A - Rich text rendering method and device, electronic equipment and storage medium - Google Patents

Rich text rendering method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113761871A
CN113761871A CN202110144657.5A CN202110144657A CN113761871A CN 113761871 A CN113761871 A CN 113761871A CN 202110144657 A CN202110144657 A CN 202110144657A CN 113761871 A CN113761871 A CN 113761871A
Authority
CN
China
Prior art keywords
rich text
text
rendering
rich
original
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
CN202110144657.5A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110144657.5A priority Critical patent/CN113761871A/en
Publication of CN113761871A publication Critical patent/CN113761871A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/38Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually
    • G06F16/381Retrieval characterised by using metadata, e.g. metadata not derived from the content or metadata generated manually using identifiers, e.g. barcodes, RFIDs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Library & Information Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The present disclosure provides a rich text rendering method, including: the original rich text information is converted into a text field having a preset hierarchical structure. And carrying out recursive analysis on the text field by using a pre-constructed analyzer to obtain rich text labels, wherein the text field comprises the rich text labels nested in the hierarchy. And finally, rendering the original rich text information based on the configuration rule of the rich text label. The disclosure also provides a rich text rendering device, an electronic device and a computer readable storage medium.

Description

Rich text rendering method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a rich text rendering method, apparatus, electronic device, and storage medium.
Background
Rich Text Format (RTF), also known as multiple Text Format, is a cross-platform document Format developed by microsoft corporation, which is a Format that can be mutually transmitted and viewed between different devices, different operating systems, and different applications. Commonly, when the WeChat front-end interface presents rich text information to a user, the original rich text code is rendered, typically through an officially provided rich-text component.
In implementing the disclosed concept, the inventors found that there are at least the following problems in the related art: the rich-text component is not user-friendly, does not support events, and cannot resolve some rich-text tags, and also cannot achieve configurable resolution of tag information in rich text. When the complex label information contained in the rich text is faced, the iterative parsing needs to be performed by using a parsing language containing a large number of templates, so that the rendering component is too large and inflexible.
Disclosure of Invention
In view of the above, the present disclosure provides a flexible, lightweight, and configurable rich text rendering method and apparatus.
One aspect of the present disclosure provides a rich text rendering method, including: converting the original rich text information into a text field with a preset hierarchical structure; carrying out recursive analysis on the text field by using a pre-constructed analyzer to obtain a rich text label; rendering the original rich text information based on configuration rules of the rich text label.
According to an embodiment of the present disclosure, the parser is a recursive traversal component with a Tree structure.
According to an embodiment of the present disclosure, the performing recursive parsing on the text field by using a pre-constructed parser to obtain a rich text tag includes: performing recursive traversal on each level of the text field by using the traversal component to obtain rich text labels contained in each level of the text field; wherein the text field comprises hierarchically nested rich text labels.
According to an embodiment of the present disclosure, rendering the original rich text information based on the configuration rule of the rich text label includes: in response to a user configured instruction, loading a rendering component corresponding to the instruction; rendering, by the rendering component, the original rich text information based on the configuration rule of the rich text label.
According to an embodiment of the present disclosure, the rendering component includes a text component, a picture component, and a video component.
According to an embodiment of the present disclosure, the converting the original rich text information into a text field having a preset hierarchical structure includes: converting the original rich text information into stack data; distributing the stack data into different types of node data; analyzing the node data to obtain attributes and events contained in the node data; and converting the attribute and the event into a text field with a preset hierarchical structure.
According to an embodiment of the present disclosure, the types of node data include a text node type and an element node type.
Another aspect of the present disclosure provides a rich text rendering apparatus including: the conversion module is used for converting the original rich text information into a text field with a preset hierarchical structure; the analysis module is used for carrying out recursive analysis on the text field by utilizing a pre-constructed analyzer to obtain a rich text label; and the rendering module renders the original rich text information based on the configuration rule of the rich text label.
Another aspect of the present disclosure provides an electronic device comprising one or more processors; and memory for storing one or more programs, wherein 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 the preceding claims.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing the method as described above when executed.
According to the embodiment of the disclosure, because a technical means of analyzing the text field with the hierarchical structure by using the recursive traversal component is adopted, the technical problems that the analysis scheme is inflexible and the rich text information is analyzed by calling a large number of hierarchical relations and templates to cause overlarge size of the analysis component in the prior art are at least partially overcome, and the technical effects of supporting configurable, expandable and flexible rich text rendering of rich text labels and simple and convenient access are achieved.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following description of embodiments of the disclosure, which proceeds with reference to the accompanying drawings, in which:
fig. 1 schematically illustrates an exemplary system architecture to which the disclosed method and apparatus for rich text rendering may be applied;
FIG. 2 schematically shows a flow diagram of a rich text rendering method according to an embodiment of the disclosure;
FIG. 3 is a schematic diagram illustrating an architecture of a resolver according to an embodiment of the disclosure;
FIG. 4A schematically illustrates a flow diagram of a method of obtaining a text field according to an embodiment of the present disclosure;
FIG. 4B schematically illustrates a flow chart of a method of rendering rich textual information, in accordance with an embodiment of the disclosure;
FIG. 5 schematically shows a block diagram of a rich text rendering apparatus according to an embodiment of the present disclosure;
FIG. 6A schematically illustrates a block diagram of a translation module in accordance with an embodiment of the present disclosure;
FIG. 6B schematically shows a block diagram of a rendering module according to an embodiment of the disclosure; and
fig. 7 schematically shows a block diagram of an electronic device suitable for a rich text rendering apparatus according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs, unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
The embodiment of the disclosure provides a method and a device for rich text rendering. The method includes a process of parsing the original rich text and a process of rendering the rich text. In the process of analyzing the original rich text, the original rich text information is converted into a text field with a preset hierarchical structure, and the text field is subjected to recursive analysis by using a pre-constructed analyzer to obtain a rich text label. After parsing the original rich text, rendering the original rich text information based on configuration rules of the rich text tags.
Fig. 1 schematically illustrates an exemplary system architecture 100 to which the rich text rendering method and apparatus may be applied, according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various types of connections, such as wired and/or wireless communication links, and so forth.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, and/or social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and/or otherwise process the received data, such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the rich text rendering method provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the rich text rendering apparatus provided by the embodiments of the present disclosure may be generally disposed in the server 105. The rich text rendering method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the rich text rendering apparatus provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Alternatively, the rich text rendering method provided by the embodiment of the present disclosure may also be executed by the terminal device 101, 102, or 103, or may also be executed by another terminal device different from the terminal device 101, 102, or 103. Accordingly, the rich text rendering apparatus provided by the embodiment of the present disclosure may also be disposed in the terminal device 101, 102, or 103, or in another terminal device different from the terminal device 101, 102, or 103.
For example, the original rich text information to be rendered may be originally stored in any of the terminal devices 101, 102, or 103 (e.g., the terminal device 101, but not limited thereto), or stored on an external storage device and may be imported into the terminal device 101. Then, the terminal device 101 may locally perform the rich text rendering method provided by the embodiment of the present disclosure, or send the original rich text information to be rendered to other terminal devices, servers, or server clusters, and perform the rich text rendering method provided by the embodiment of the present disclosure by other terminal devices, servers, or server clusters receiving the original rich text information to be rendered.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Fig. 2 schematically shows a flow chart of a rich text rendering method according to an embodiment of the present disclosure.
As shown in fig. 2, the method includes operations S201 to S203.
In operation S201, the original rich text information is converted into a text field having a preset hierarchical structure.
In operation S202, a pre-constructed parser is used to perform recursive parsing on the text field to obtain rich text labels.
In operation S203, the original rich text information is rendered based on the configuration rule of the rich text tag.
In an embodiment of the present disclosure, the parser is a recursive traversal component with a Tree structure. For a rich-text field having a hierarchical structure, the rich-text field includes hierarchically nested rich-text tags. And performing recursive traversal on the field by using the traversal component, and performing recursive traversal on each level of the text field by using the traversal component to obtain rich text labels contained in each level of the text field.
Fig. 3 schematically shows a structural diagram of a resolver according to an embodiment of the present disclosure. As shown in FIG. 3, the parser is a tree component, and the structure thereof is to call the tree component in the tree component to form a recursive traversal component with a tree structure. The traversal component is used for recursively traversing and analyzing the rich text fields containing the hierarchy nested rich text labels, so that a large number of hierarchy relations and templates are avoided being processed in the analyzing process, and storage space is released.
The method for referencing the Tree component is implemented as < trees nodes ═ { { nodes } } "/>. The event and attribute binding is omitted in the analyzer, the problems of template level and size are avoided, and the size of a rendering device containing the analyzer is reduced and can be flexibly applied.
Before the rich text label is analyzed, configuring the rich text label needing to be supported, wherein the specific configuration method is
Figure BDA0002929025110000071
Wherein, require: true indicates that the rich text label needs to be parsed, click: true indicates that a click event needs to be added and class indicates that an externally loaded style name is needed.
Through the embodiment of the disclosure, the nested rich text labels of the resolution level are traversed by utilizing a recursive traversal component with a tree structure. A large number of templates are not used for iterative analysis in the grammar analysis scheme, and storage space is released, so that the volume of the whole rendering device is lighter and more controllable, and the method is more suitable for small-volume program development such as WeChat small programs. Meanwhile, configurable analysis of label information contained in the rich text information is supported, the rich text information is flexibly and extendably rendered, the problems that users of official components provided by developers such as WeChat are not friendly to each other, events are not supported, partial rich text labels cannot be analyzed and the like are solved, and experience of the users is improved.
The method shown in fig. 2 will be further described with reference to fig. 4A to 4B in conjunction with specific embodiments.
FIG. 4A schematically illustrates a flow diagram of a method of obtaining a text field according to an embodiment of the present disclosure.
As shown in fig. 4A, converting the original rich text information into a text field having a preset hierarchical structure includes operations S301 to S304.
In operation S301, the original rich text information is converted into stack data.
In operation S302, stack data is distributed into different types of node data.
In operation S303, the node data is parsed to obtain attributes and events included in the node data.
In operation S304, the attributes and the events are converted into text fields having a preset hierarchical structure.
In the embodiment of the disclosure, the original rich text information is converted into the text field with the corresponding hierarchical structure according to different development requirements of developers. Taking the development applied to the WeChat applet as an example, the original rich text information is converted into a hierarchy structure supported by the WeChat by modifying a JavaScript library.
Specifically, the content contained in the original rich text information is sequentially converted into stack data by identifying a start label "</and an end label"/> "contained in the rich text information, and then the stack data is distributed into different types of node data according to configuration requirements, wherein the types of the node data comprise text node types and element node types. If the data is element node data, the attributes and events contained in the data need to be analyzed, and finally the attributes and time are converted into text fields with a hierarchical structure supported by WeChat.
Fig. 4B schematically shows a flow chart of a method of rendering rich textual information according to an embodiment of the present disclosure.
As shown in fig. 4B, rendering the original rich text information includes operations S401 to S402 based on the configuration rule of the rich text tag.
In operation S401, in response to an instruction configured by a user, a rendering component corresponding to the instruction is loaded.
In operation S402, the original rich text information is rendered based on the configuration rule of the rich text tag using the rendering component.
In the embodiment of the disclosure, to further reduce the volume of the rendering device, the load rendering component may be dynamically assembled and loaded at runtime according to the instruction configured by the user to perform the rendering operation, so as to flexibly perform "slimming" for the applet in a configurable manner. Common rendering components include text components, picture components, audio components, and video components, among others. For example, the instruction information configured by the user is that the user only needs to render the text and the image, so before the rendering operation is performed, only the corresponding text component and the corresponding image component need to be loaded, and if the original rich text information contains video information, the video information is shielded and is not displayed to the user any more.
And rendering the rich text information by using a rendering component corresponding to the instruction configured by the user according to the configuration rule of the rich text label. For example, common rich text labels include < div >, < a >, < br >, < img >, < video >, < span >, < p >, < h1> - < h6>, and the like. Specifically, the configuration rule of < div > is to define a partition or section in the document for dividing the document into separate, distinct parts; the configuration rule of < a > is to define hyperlinks for linking from one page to another; < br > is a configuration rule that defines an empty tag that can be used to indicate the start of a new line of content; the configuration rule of < img > is to link images from a webpage, the configuration rule of < video > is to define the video, and the configuration rule of < span > is to combine inline elements in a document; the configuration rule of < p > is to define a paragraph; the configuration rules of < h1> - < h6> define titles, < h1> defines the largest title, < h6> defines the smallest title.
An example will be described specifically.
Figure BDA0002929025110000091
Wherein, "color: #00FF00 "is the number of colors and the rich text described above contains tags meaning that the following document content is rendered green. In the specific document content, "This is a header" is rendered as a style of 3-level title, and "This is a paragraph" is rendered as a new paragraph. The tags < h3> </h3> and the tags < p > </p > are nested in the tags < div > </div >.
According to the embodiment of the disclosure, the corresponding rendering components are dynamically loaded as required according to the configuration requirements of the user, the rich text information is rendered, and the configuration of the rendering process is simple, extensible, light and flexible.
Fig. 5 schematically shows a block diagram of a rich text rendering apparatus according to an embodiment of the present disclosure.
As shown in fig. 5, the rich text rendering apparatus 500 includes a conversion module 510, a parsing module 520, and a rendering module 530.
A conversion module 510, converting the original rich text information into a text field having a preset hierarchical structure;
the analysis module 520 performs recursive analysis on the text field by using a pre-constructed analyzer to obtain a rich text label;
the rendering module 530 renders the original rich text information based on the configuration rules of the rich text tags.
Through the embodiment of the disclosure, the rich text label can be configured, the rendering function can be expanded, the rendering component is flexible and light in volume, the access and the use are simple and convenient, and the method is more suitable for being applied to the development of small-volume programs such as WeChat small programs. The method supports most rich text labels, supports label events, solves the problems that users of official components provided by developers such as WeChat are not friendly to each other, do not support events, and part of rich text labels cannot be analyzed, and improves the experience of users.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any number of the conversion module 510, the parsing module 520, and the rendering module 530 may be combined in one module/unit/sub-unit to be implemented, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality of other modules/units/sub-units and implemented in one module/unit/sub-unit. According to an embodiment of the present disclosure, at least one of the conversion module 510, the parsing module 520, and the rendering module 530 may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, at least one of the conversion module 510, the parsing module 520, and the rendering module 530 may be implemented at least in part as a computer program module that, when executed, may perform a corresponding function.
The method shown in fig. 5 will be further described with reference to fig. 6A to 6B in conjunction with specific embodiments.
Fig. 6A schematically illustrates a block diagram of a conversion module according to an embodiment of the disclosure.
As shown in fig. 6A, the conversion module 510 includes a first conversion unit 5101 for converting the original rich text information into stack data. The dispatching unit 5102 is configured to dispatch the stack data into different types of node data. The parsing unit 5103 is configured to parse the node data to obtain attributes and events included in the node data. The second conversion unit 5104 converts the attributes and the events into text fields having a preset hierarchical structure.
Fig. 6B schematically illustrates a block diagram of a rendering module according to an embodiment of the disclosure.
As shown in fig. 6B, the rendering module 530 includes a loading unit 5301 for loading, in response to the instruction configured by the user, a rendering component corresponding to the instruction. The rendering unit 5302 is configured to render the original rich text information based on the configuration rule of the rich text label by using the rendering component.
It should be noted that, the rich text rendering device portion in the embodiment of the present disclosure corresponds to the rich text rendering method portion in the embodiment of the present disclosure, and the description of the rich text rendering device portion specifically refers to the rich text rendering method portion, which is not described herein again.
Fig. 7 schematically shows a block diagram of an electronic device adapted to implement the above described method according to an embodiment of the present disclosure. The electronic 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 disclosure.
As shown in fig. 7, an electronic device 600 according to an embodiment of the present disclosure includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. Processor 601 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 601 may also include onboard memory for caching purposes. Processor 601 may include a single processing unit or multiple processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 603, various programs and data necessary for the operation of the system 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 602 and/or RAM 603. It is to be noted that the programs may also be stored in one or more memories other than the ROM 602 and RAM 603. The processor 601 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, system 600 may also include an input/output (I/O) interface 605, input/output (I/O) interface 605 also connected to bus 604. The system 600 may also include one or more of the following components connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609 and/or installed from the removable medium 611. The computer program, when executed by the processor 601, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium described above carries one or more programs which, when executed, implement a method according to an embodiment of the present disclosure.
According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. Examples may include, but are not limited to: 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), 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 present disclosure, 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.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 602 and/or RAM 603 described above and/or one or more memories other than the ROM 602 and RAM 603.
The flowchart 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 disclosure. 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.
It will be appreciated by a person skilled in the art that various embodiments of the disclosure and/or features recited in the claims may be combined and/or coupled in a variety of ways, even if such combinations or couplings are not explicitly recited in the disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments of the present disclosure and/or claims may be made without departing from the spirit and teachings of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. A rich text rendering method, comprising:
converting the original rich text information into a text field with a preset hierarchical structure;
carrying out recursive analysis on the text field by using a pre-constructed analyzer to obtain a rich text label;
rendering the original rich text information based on configuration rules of the rich text label.
2. The method of claim 1, wherein the parser is a recursive traversal component with a Tree structure.
3. The method of claim 2, wherein the recursively parsing the text field with a pre-built parser to obtain rich text labels comprises:
performing recursive traversal on each level of the text field by using the traversal component to obtain rich text labels contained in each level of the text field;
wherein the text field comprises hierarchically nested rich text labels.
4. The method of claim 1, wherein the rendering the original rich text information based on the configuration rule of the rich text label comprises:
in response to a user configured instruction, loading a rendering component corresponding to the instruction;
rendering, with the rendering component, the original rich text information based on the configuration rules of the rich text tags.
5. The method of claim 4, wherein the rendering components include a text component, a picture component, and a video component.
6. The method of claim 1, wherein said converting the original rich text information into a text field having a preset hierarchical structure comprises:
converting the original rich text information into stack data;
distributing the stack data into different types of node data;
analyzing the node data to obtain attributes and events contained in the node data;
converting the attribute and the event into a text field having a preset hierarchical structure.
7. The method of claim 6, wherein the types of node data comprise a text node type and an element node type.
8. A rich text rendering apparatus comprising:
the conversion module is used for converting the original rich text information into a text field with a preset hierarchical structure;
the analysis module is used for carrying out recursive analysis on the text field by utilizing a pre-constructed analyzer to obtain a rich text label;
and the rendering module renders the original rich text information based on the configuration rule of the rich text label.
9. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs,
wherein 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.
10. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 7.
CN202110144657.5A 2021-02-02 2021-02-02 Rich text rendering method and device, electronic equipment and storage medium Pending CN113761871A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110144657.5A CN113761871A (en) 2021-02-02 2021-02-02 Rich text rendering method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110144657.5A CN113761871A (en) 2021-02-02 2021-02-02 Rich text rendering method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113761871A true CN113761871A (en) 2021-12-07

Family

ID=78786599

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110144657.5A Pending CN113761871A (en) 2021-02-02 2021-02-02 Rich text rendering method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113761871A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114924815A (en) * 2022-03-31 2022-08-19 北京达佳互联信息技术有限公司 Page rendering method and device, electronic equipment and storage medium
CN115526160A (en) * 2022-10-21 2022-12-27 广州市玄武无线科技股份有限公司 Rich text processing method, device and equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114924815A (en) * 2022-03-31 2022-08-19 北京达佳互联信息技术有限公司 Page rendering method and device, electronic equipment and storage medium
CN115526160A (en) * 2022-10-21 2022-12-27 广州市玄武无线科技股份有限公司 Rich text processing method, device and equipment and storage medium

Similar Documents

Publication Publication Date Title
EP3816823A1 (en) Webpage rendering method, device, electronic apparatus and storage medium
US7870482B2 (en) Web browser extension for simplified utilization of web services
US20140207826A1 (en) Generating xml schema from json data
CN110457144B (en) Method, device, medium and equipment for realizing front-end application
CN113126990B (en) Page development method, device, equipment and storage medium
CN111221521A (en) Method and device for generating log code, computer system and readable storage medium
CN111581555B (en) Document loading method, device, equipment and storage medium
CN112395027B (en) Widget interface generation method and device, storage medium and electronic equipment
CN111294395A (en) Terminal page transmission method, device, medium and electronic equipment
CN113761871A (en) Rich text rendering method and device, electronic equipment and storage medium
CN110377273B (en) Data processing method, device, medium and electronic equipment
CN111078228A (en) Method and device for converting webpage into small program, server and storage medium
CN115809056B (en) Component multiplexing implementation method and device, terminal equipment and readable storage medium
CN110489326B (en) IDS-based HTTPAPI debugging method device, medium and equipment
CN110618811B (en) Information presentation method and device
CN115982491A (en) Page updating method and device, electronic equipment and computer readable storage medium
CN109669720B (en) Chain type asynchronous request processing method and device based on Promise and electronic equipment
CN113656041A (en) Data processing method, device, equipment and storage medium
CN110780898B (en) Page data upgrading method and device and electronic equipment
CN113553123A (en) Data processing method and device, electronic equipment and storage medium
CN113296771A (en) Page display method, device, equipment and computer readable medium
CN113448578A (en) Page data processing method, processing system, electronic device and readable storage medium
CN111767498A (en) Method and device for realizing file information sharing
CN112818267A (en) Data processing method and device, computer readable storage medium and electronic equipment
CN112068814A (en) Method, device, system and medium for generating executable file

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