CN111539200A - Method, device, medium and electronic equipment for generating rich text - Google Patents

Method, device, medium and electronic equipment for generating rich text Download PDF

Info

Publication number
CN111539200A
CN111539200A CN202010322375.5A CN202010322375A CN111539200A CN 111539200 A CN111539200 A CN 111539200A CN 202010322375 A CN202010322375 A CN 202010322375A CN 111539200 A CN111539200 A CN 111539200A
Authority
CN
China
Prior art keywords
rich text
grammar
information
text
syntax
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.)
Granted
Application number
CN202010322375.5A
Other languages
Chinese (zh)
Other versions
CN111539200B (en
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 ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network 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 ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010322375.5A priority Critical patent/CN111539200B/en
Publication of CN111539200A publication Critical patent/CN111539200A/en
Application granted granted Critical
Publication of CN111539200B publication Critical patent/CN111539200B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/253Grammatical analysis; Style critique
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/313Logic programming, e.g. PROLOG programming language
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing

Abstract

The present disclosure provides a method, an apparatus, a medium, and an electronic device for generating a rich text. The method comprises the following steps: the method comprises the following steps: acquiring a first rich text from a rich text set based on preset display logic under a cross-platform framework; determining a grammar type for the first rich text; acquiring a corresponding grammar analysis model based on the grammar type; analyzing codes in the first rich text based on the syntactic analysis model to obtain a corresponding first abstract syntactic tree; the first abstract syntax tree is analyzed based on a unified description syntax generation model to generate a second rich text composed based on a unified description syntax. The method can effectively improve the compatibility of the cross-platform framework to the description grammar.

Description

Method, device, medium and electronic equipment for generating rich text
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and an electronic device for generating a rich text.
Background
The existing cross-platform development framework is widely applied by virtue of the advantages of cross-platform property, high fidelity, high performance and the like, provides abundant components and interfaces, and is convenient for developers to develop a set of codes and applicable to various platforms.
Taking the Flutter framework as an example, the Flutter framework is an open-source mobile application development framework, and a set of codes of a runnable program developed based on the Flutter framework can be run on an iOS platform or an Android platform.
The flute framework adopts a Dart language as a development language, the Dart language is a static language which uses a specific Dart VM virtual machine to run, and provides a high-speed compilation before running (Ahead Of Time for short, AOT) scheme and a just-in-Time dynamic compilation (JIT) scheme for emphasizing dynamic property. Before the AOT program runs, the source code file is directly compiled into the local machine code. The JIT scheme is a process that compiles class file bytecodes into local machine code at runtime.
The rich text engine under the current Flutter framework has insufficient support on rich text component schemes, has single decoupling function, and cannot support the development of other voices, so that the development of rich texts is limited.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
An object of the present disclosure is to provide a method, an apparatus, a medium, and an electronic device for generating a rich text, which can solve at least one of the above-mentioned technical problems. The specific scheme is as follows:
according to a specific embodiment of the present disclosure, in a first aspect, the present disclosure provides a method for generating rich text, including:
acquiring a first rich text from a rich text set based on preset display logic under a cross-platform framework; the rich text set comprises first rich text, and the first rich text comprises code composed based on a descriptive grammar;
determining a grammar type for the first rich text;
acquiring a corresponding grammar analysis model based on the grammar type;
analyzing codes in the first rich text based on the syntactic analysis model to obtain a corresponding first abstract syntactic tree;
analyzing the first abstract syntax tree based on a uniform description syntax generation model to generate a second rich text composed based on the uniform description syntax; the unified description grammar includes grammars supported by a rich text engine under the cross-platform framework.
According to a second aspect, the present disclosure provides an apparatus for generating rich text, including:
the method comprises the steps of obtaining a first rich text unit, wherein the first rich text unit is used for obtaining a first rich text from a rich text set based on preset display logic under a cross-platform framework; the rich text set comprises first rich text, and the first rich text comprises code composed based on a descriptive grammar;
a grammar type determining unit for determining a grammar type of the first rich text;
the grammar analysis model obtaining unit is used for obtaining a corresponding grammar analysis model based on the grammar type;
the obtaining unit of the first abstract syntax tree is used for analyzing codes in the first rich text based on the syntax analysis model and obtaining a corresponding first abstract syntax tree;
generating a second rich text unit, which is used for analyzing the first abstract syntax tree based on a uniform description syntax generation model and generating a second rich text which is composed based on the uniform description syntax; the unified description grammar includes grammars supported by a rich text engine under the cross-platform framework.
According to a third aspect, the present disclosure provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of generating rich text according to any of the first aspect.
According to a fourth aspect thereof, the present disclosure provides an electronic device, comprising: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of generating rich text according to any one of the first aspect.
Compared with the prior art, the scheme of the embodiment of the disclosure at least has the following beneficial effects:
the present disclosure provides a method, an apparatus, a medium, and an electronic device for generating a rich text. In the method, the parsing of various description syntax rich texts is realized under a cross-platform framework, a first rich text which is not supported by a rich text engine under the cross-platform framework can be converted into a first abstract syntax tree, and then the first abstract syntax tree is analyzed based on a uniform description syntax generation model to generate a second rich text which is supported by the rich text engine under the cross-platform framework and is based on the uniform description syntax. Therefore, the compatibility of various description grammars under a cross-platform framework can be effectively improved.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
FIG. 1 shows a flow diagram of a method of generating rich text according to an embodiment of the present disclosure;
FIG. 2 shows a schematic diagram of a method of generating rich text according to an embodiment of the present disclosure;
FIG. 3 illustrates an exemplary diagram of a second rich text unified description syntax for a method of generating rich text in accordance with an embodiment of the present disclosure;
FIG. 4 shows a block diagram of elements of an apparatus for generating rich text, according to an embodiment of the present disclosure;
fig. 5 shows an electronic device connection structure schematic according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
A first embodiment, an embodiment of a method of generating rich text, is provided for the present disclosure.
The embodiments of the present disclosure will be described in detail with reference to fig. 1 to 3. Please refer to fig. 1.
Step S101, under a cross-platform framework, acquiring a first rich text from a rich text set based on preset display logic.
The method and the system are applied to a cross-platform framework, and a set of development codes can run in a plurality of system platforms under the cross-platform framework. All cross-platform frameworks with high code complexity and difficult maintenance problems can be applied to the method of the embodiment of the disclosure. The cross-platform framework comprises a Flutter framework. The Flutter framework is an open-source mobile application development framework and enables a runnable program to run across platforms. For example, under the Flutter framework, a set of development codes can be run on both the iOS platform and the Android platform. Under the Flutter framework, developers can be concentrated and concentrate on building application content, rather than being at the expense of the problem of the target platform before each development. In the multi-device and multi-platform world, the Flutter framework aims to provide a set of universal framework and development tools, so that developers are free from the limitation of devices and machine types, and smoothly create a first-class user experience. The Flutter engine driven by the high-level programming language Dart helps a developer to realize rapid development through a hot reload function for keeping an application state, and in addition, the Flutter engine can provide excellent local compiling support no matter on a mobile terminal, a desktop terminal, a network front end or an embedded device, so that rapid and powerful performance is brought to the developer. And the method can deliver consistent experience for users, and under a proper condition, code multiplexing is realized on three platforms, namely a mobile end, a network front end and a desktop. The Flutter framework is unique in that it only requires a set of reference codes to support a rich native compilation experience.
Referring to fig. 2, the set of rich texts includes at least one first rich text, and each first rich text includes code written based on a descriptive grammar. The description syntax of the different first rich texts may be different or the same, and in a specific implementation, the description syntax of the first rich text may include: any one of a hypertext markup Language (HTML) grammar, a Markdown grammar and a Delta grammar, which may be a custom description grammar.
The preset display logic is a preset logic relation displayed on a front page among rich texts in the rich text display set. Typically the default display logic is stored in one or more files. The display logic is the sequence displayed by each display unit in the rich text. May be a linear logic, or a nested logic, or a custom logic.
Step S102, determining the grammar type of the first rich text.
Because the description syntax of the rich text in the rich text set is different. Therefore, the grammar type corresponding to the first rich text can be obtained by describing the characteristics of the grammar.
And step S103, acquiring a corresponding grammar analysis model based on the grammar type.
The grammar parsing model is a custom model for parsing the code of rich text corresponding to grammar type.
Because the description grammar of the rich text is different, the corresponding grammar analysis model is also different. Therefore, a corresponding parsing model needs to be obtained based on the syntax type.
Optionally, the obtaining a corresponding syntax analysis model based on the syntax type includes:
and step S103-1, acquiring corresponding grammar description feature information based on the grammar type.
The syntax description feature information is information customized based on the syntax description feature. A grammar type has a plurality of grammar description feature information.
And step S103-2, analyzing the syntactic description characteristic information to obtain a corresponding syntactic analysis model.
The grammar analysis model in the step is generated by self-defined grammar description characteristic information.
And step S104, analyzing codes in the first rich text based on the syntactic analysis model, and acquiring a corresponding first abstract syntactic tree.
An Abstract Syntax Tree (AST) is a tree representation of the abstract syntax structure of the source code. Each node on the tree represents a structure in the source code. The syntax is said to be "abstract" in that the syntax does not represent every detail that appears in the true syntax. Different rich text syntax types describing syntax are different, and the characteristics and properties of corresponding abstract syntax trees are also different.
And step S105, analyzing the first abstract syntax tree based on the unified description syntax generation model, and generating a second rich text composed based on the unified description syntax.
The unified description grammar generation model is used for generating rich text written based on the unified description grammar according to the logical relation of the abstract grammar tree.
The unified description grammar includes grammars supported by the rich text engine under the cross-platform framework to this point, embodiments of the present disclosure transform rich text written based on a different description grammar to a second rich text written based on a unified description grammar.
For example, the tag is a base class of the AST node, and a parent node and left and right nodes are constructed on the basis of the tag, thereby forming the AST; in AST, represented by the label: the elements in the row are changed, thickened and italicized; the corresponding description of the second rich text, please refer to fig. 3.
As can be seen from fig. 3, in the second rich text, the descriptive sentences are arranged linearly. During execution, sentence by sentence from top to bottom, so that the complex logic relationship between descriptive sentences is avoided, and the readability of rich text for uniformly describing grammar is improved.
After the generating of the second rich text composed based on the unified description grammar, further comprising:
and step S106, analyzing the codes of the second rich text based on the unified description syntax analysis model, and generating text node information corresponding to unit information.
The unit information is information associated with a component in the second rich text.
The text node information belongs to a part of the rendering information and is the most basic information in the rendering information. The unit information corresponding to the second rich text can be converted into each other or can be indexed with each other.
The component is a display object of a specific function in the display information. For example, the line component and the embedded component in the display information, and the text node information and the corresponding unit information describe the line component and the embedded component, respectively.
The second rich text serves to unify different description grammars into a unified description grammar, serving as a bridge for generating display information. And the text node information is the level of transition of the information describing the grammar to rendering, so as to be beneficial to generating display information.
And step S107, acquiring style information matched with the text node information.
The style information may be saved in a component style dataset. The component style dataset is a custom database that includes text node information and corresponding style information. The style information can be conveniently changed through the component style data set, and the rendering flexibility is improved. And retrieving a component style data set based on the text node information to acquire corresponding style information.
And step S108, rendering the text node information and the style information to generate display information.
Optionally, the method further includes:
and step S111, obtaining the change information of the text node information.
The change information is generated by operating on the display information. For example, the change information includes: insertion information, formatting information, and deletion information. The change to the display information is mapped to the text node information, thereby causing changed information of the text node information.
And step S112, carrying out compliance detection on the text node information based on the change information.
And the compliance detection is to detect whether the text node information meets the requirements of the pre-designed rules. For example, the pre-designed rules are: there cannot be a space behind a character or symbol.
And step S113, when the detection is not passed, performing compliance processing on the text node information.
The compliance processing is to process the text node information according to the requirements of the pre-designed rules. For example, continuing the above example, if there are multiple spaces after a period and the detection fails, the spaces after the period are deleted.
Compliance detection can improve the simplicity, aesthetics, and readability of the displayed information.
After the obtaining of the change information of the text node information, the method further includes:
step S121, changing the unit information corresponding to the text node information based on the change information.
The text node information and the corresponding unit information in the second rich text can be mutually converted and can also be mutually indexed. Therefore, the text node information and the corresponding unit information in the second rich text have a mapping relationship with each other. When the text node information is changed, the corresponding unit information is also changed at the same time.
The embodiment of the disclosure converts a first rich text which is not supported by a rich text engine under a cross-platform framework into a first abstract syntax tree, and then generates a second rich text which is supported by the rich text engine under the cross-platform framework and is composed based on a unified description syntax through the first abstract syntax tree. A method for parsing various descriptive grammar rich texts under a cross-platform framework is provided. Description grammars for rich text include hypertext markup language grammars, Markdown description grammars, and Delta description grammars, even custom description grammars. The problem of description grammar compatibility which is not supported under a cross-platform framework and the problem of display under the cross-platform framework are effectively solved through a self-defined grammar analysis model.
The present disclosure also provides a second embodiment, namely an apparatus for generating rich text, corresponding to the first embodiment provided by the present disclosure. Since the second embodiment is basically similar to the first embodiment, the description is simple, and the relevant portions should be referred to the corresponding description of the first embodiment. The device embodiments described below are merely illustrative.
Fig. 4 illustrates an embodiment of an apparatus for generating rich text provided by the present disclosure. Fig. 4 is a block diagram of elements of an apparatus for generating rich text according to an embodiment of the present disclosure.
Referring to fig. 4, the present disclosure provides an apparatus for generating rich text, including: a first rich text unit 401 is obtained, a grammar type unit 402 is determined, a grammar analysis model unit 403 is obtained, a first abstract grammar tree unit 404 is obtained, and a second rich text unit 405 is generated.
The acquiring first rich text unit 401 is configured to acquire a first rich text from a rich text set based on a preset display logic in a cross-platform framework; the rich text set comprises first rich text, and each first rich text comprises code written based on a descriptive grammar;
a syntax type determining unit 402 for determining a syntax type of the first rich text;
a syntax analysis model obtaining unit 403, configured to obtain a corresponding syntax analysis model based on the syntax type;
a first abstract syntax tree obtaining unit 404, configured to analyze codes in the first rich text based on the syntax analysis model, and obtain a corresponding first abstract syntax tree;
a generate second rich text unit 405, configured to analyze the first abstract syntax tree based on the unified description syntax generating model, and generate a second rich text composed based on the unified description syntax; the unified description grammar includes grammars supported by a rich text engine under the cross-platform framework.
Optionally, the obtaining the syntactic analysis model unit 403 includes:
a syntax description feature information acquiring subunit, configured to acquire corresponding syntax description feature information based on the syntax type;
and the grammar analysis model generating subunit is used for analyzing the grammar description characteristic information and acquiring a corresponding grammar analysis model.
Optionally, in the apparatus, the apparatus further includes:
a text node information generating unit, configured to, after the second rich text of the unified description grammar is generated, analyze a code of the second rich text based on the unified description grammar analysis model, and generate text node information corresponding to unit information; the unit information is information associated with a component in the second rich text;
the acquiring style information unit is used for acquiring style information matched with the text node information after the text node information corresponding to the unit information is generated;
and the generating and displaying information unit is used for rendering the text node information and the style information and generating displaying information.
Optionally, in the apparatus, the apparatus further includes:
a change information acquiring unit for acquiring change information of the text node information;
a compliance detection unit for performing compliance detection on the text node information based on the change information;
and the compliance processing unit is used for performing compliance processing on the text node information when the detection fails.
Optionally, in the apparatus, the apparatus further includes:
and a unit configured to, after the change information of the text node information is acquired, change the unit information corresponding to the text node information based on the change information.
Optionally, the cross-platform framework comprises a Flutter framework.
The embodiment of the disclosure converts a first rich text which is not supported by a rich text engine under a cross-platform framework into a first abstract syntax tree, and then generates a second rich text which is supported by the rich text engine under the cross-platform framework and is composed based on a unified description syntax through the first abstract syntax tree. A method for parsing various descriptive grammar rich texts under a cross-platform framework is provided. Description grammars for rich text include hypertext markup language grammars, Markdown description grammars, and Delta description grammars, even custom description grammars. The problem of description grammar compatibility which is not supported under a cross-platform framework and the problem of display under the cross-platform framework are effectively solved through a self-defined grammar analysis model.
The third embodiment of the present disclosure provides an electronic device, which is a method for generating a rich text, and the electronic device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the one processor to cause the at least one processor to perform the method of generating rich text as described in the first embodiment.
The disclosed embodiments provide a fourth embodiment, which is a computer storage medium for generating a rich text, the computer storage medium storing computer-executable instructions that can execute the method for generating a rich text as described in the first embodiment.
Referring now to FIG. 5, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 5 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. 5, the electronic device may include a processing means (e.g., central processing unit, graphics processor, etc.) 501 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage means 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
Generally, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, and the like; storage devices 508 including, for example, magnetic tape, hard disk, etc.; and a communication device 509. The communication means 509 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 5 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable 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 via the communication means 509, or installed from the storage means 508, or installed from the ROM 502. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing device 501.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the 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. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
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 and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A method of generating rich text, comprising:
acquiring a first rich text from a rich text set based on preset display logic under a cross-platform framework; the rich text set comprises a first rich text comprising code composed based on a descriptive grammar;
determining a grammar type for the first rich text;
acquiring a corresponding grammar analysis model based on the grammar type;
analyzing codes in the first rich text based on the syntactic analysis model to obtain a corresponding first abstract syntactic tree;
analyzing the first abstract syntax tree based on a uniform description syntax generation model to generate a second rich text composed based on the uniform description syntax; the unified description grammar includes grammars supported by a rich text engine under the cross-platform framework.
2. The method of claim 1, wherein said obtaining a corresponding parsing model based on said syntax type comprises:
acquiring corresponding grammar description feature information based on the grammar type;
and analyzing the syntactic description characteristic information to obtain a corresponding syntactic analysis model.
3. The method of claim 1, after the generating a second rich text composed based on a unified description grammar, further comprising:
analyzing the codes of the second rich text based on the unified description syntax analysis model, and generating text node information corresponding to unit information; the unit information is information associated with a component in the second rich text;
acquiring style information matched with the text node information;
and rendering the text node information and the style information to generate display information.
4. The method of claim 3, further comprising:
acquiring change information of the text node information;
performing compliance detection on the text node information based on the change information;
and when the detection is not passed, performing compliance processing on the text node information.
5. The method according to claim 4, further comprising, after the obtaining of the change information of the text node information:
and changing the unit information corresponding to the text node information based on the change information.
6. The method of any one of claims 1-5, wherein the cross-platform framework comprises a Flutter framework.
7. An apparatus for generating rich text, comprising:
the method comprises the steps of obtaining a first rich text unit, wherein the first rich text unit is used for obtaining a first rich text from a rich text set based on preset display logic under a cross-platform framework; the rich text set comprises a first rich text comprising code composed based on a descriptive grammar;
a grammar type determining unit for determining a grammar type of the first rich text;
the grammar analysis model obtaining unit is used for obtaining a corresponding grammar analysis model based on the grammar type;
the obtaining unit of the first abstract syntax tree is used for analyzing codes in the first rich text based on the syntax analysis model and obtaining a corresponding first abstract syntax tree;
generating a second rich text unit, which is used for analyzing the first abstract syntax tree based on a uniform description syntax generation model and generating a second rich text which is composed based on the uniform description syntax; the unified description grammar includes grammars supported by a rich text engine under the cross-platform framework.
8. The apparatus of claim 7, wherein the obtaining the parsing model unit comprises:
a syntax description feature information acquiring subunit, configured to acquire corresponding syntax description feature information based on the syntax type;
and the grammar analysis model generating subunit is used for analyzing the grammar description characteristic information and acquiring a corresponding grammar analysis model.
9. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 6.
10. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of any one of claims 1 to 6.
CN202010322375.5A 2020-04-22 2020-04-22 Method, device, medium and electronic equipment for generating rich text Active CN111539200B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010322375.5A CN111539200B (en) 2020-04-22 2020-04-22 Method, device, medium and electronic equipment for generating rich text

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010322375.5A CN111539200B (en) 2020-04-22 2020-04-22 Method, device, medium and electronic equipment for generating rich text

Publications (2)

Publication Number Publication Date
CN111539200A true CN111539200A (en) 2020-08-14
CN111539200B CN111539200B (en) 2023-08-18

Family

ID=71979580

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010322375.5A Active CN111539200B (en) 2020-04-22 2020-04-22 Method, device, medium and electronic equipment for generating rich text

Country Status (1)

Country Link
CN (1) CN111539200B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113741900A (en) * 2021-08-31 2021-12-03 广州数励科技有限公司 Development method and device for front-end page application and related equipment

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070169010A1 (en) * 2005-10-31 2007-07-19 Dhi Technologies, Inc. Multiplatform programming environment
US20140282444A1 (en) * 2013-03-15 2014-09-18 ArtinSoft Corporation Programming language transformations with abstract syntax tree extensions
US20150154011A1 (en) * 2013-11-29 2015-06-04 Huawei Technologies Co., Ltd. Transplantation Method and Source-to-Source Compiler
US9092505B1 (en) * 2013-06-25 2015-07-28 Google Inc. Parsing rule generalization by n-gram span clustering
US20170139690A1 (en) * 2015-11-16 2017-05-18 Sap Se Universal transcompiling framework
US20180144002A1 (en) * 2016-11-18 2018-05-24 Change Healthcare Llc Methods and apparatuses for interpreter-based utilization of measure logic
CN108182069A (en) * 2017-12-28 2018-06-19 深圳市创梦天地科技股份有限公司 Programming language transformation method, terminal device and computer-readable medium
CN108959626A (en) * 2018-07-23 2018-12-07 四川省烟草公司成都市公司 A kind of cross-platform efficient automatic generation method of isomeric data bulletin
CN110275709A (en) * 2018-03-15 2019-09-24 阿里巴巴集团控股有限公司 Processing and optimization method, device, equipment and storage medium for dynamic language
CN110377289A (en) * 2019-07-01 2019-10-25 北京字节跳动网络技术有限公司 A kind of data analysis method, device, medium and electronic equipment
CN110442344A (en) * 2019-08-14 2019-11-12 中国工商银行股份有限公司 Method, apparatus, system and medium for cross-platform conversion application
CN110471666A (en) * 2019-07-18 2019-11-19 五八有限公司 Code automatic switching method and device, code converter and medium
CN110532280A (en) * 2019-07-18 2019-12-03 阿里巴巴集团控股有限公司 SQL statement method for visualizing and device

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070169010A1 (en) * 2005-10-31 2007-07-19 Dhi Technologies, Inc. Multiplatform programming environment
US20140282444A1 (en) * 2013-03-15 2014-09-18 ArtinSoft Corporation Programming language transformations with abstract syntax tree extensions
US9092505B1 (en) * 2013-06-25 2015-07-28 Google Inc. Parsing rule generalization by n-gram span clustering
US20150154011A1 (en) * 2013-11-29 2015-06-04 Huawei Technologies Co., Ltd. Transplantation Method and Source-to-Source Compiler
US20170139690A1 (en) * 2015-11-16 2017-05-18 Sap Se Universal transcompiling framework
US20180144002A1 (en) * 2016-11-18 2018-05-24 Change Healthcare Llc Methods and apparatuses for interpreter-based utilization of measure logic
CN108182069A (en) * 2017-12-28 2018-06-19 深圳市创梦天地科技股份有限公司 Programming language transformation method, terminal device and computer-readable medium
CN110275709A (en) * 2018-03-15 2019-09-24 阿里巴巴集团控股有限公司 Processing and optimization method, device, equipment and storage medium for dynamic language
CN108959626A (en) * 2018-07-23 2018-12-07 四川省烟草公司成都市公司 A kind of cross-platform efficient automatic generation method of isomeric data bulletin
CN110377289A (en) * 2019-07-01 2019-10-25 北京字节跳动网络技术有限公司 A kind of data analysis method, device, medium and electronic equipment
CN110471666A (en) * 2019-07-18 2019-11-19 五八有限公司 Code automatic switching method and device, code converter and medium
CN110532280A (en) * 2019-07-18 2019-12-03 阿里巴巴集团控股有限公司 SQL statement method for visualizing and device
CN110442344A (en) * 2019-08-14 2019-11-12 中国工商银行股份有限公司 Method, apparatus, system and medium for cross-platform conversion application

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113741900A (en) * 2021-08-31 2021-12-03 广州数励科技有限公司 Development method and device for front-end page application and related equipment
CN113741900B (en) * 2021-08-31 2024-03-19 广州数励科技有限公司 Development method and device of front-end page application and related equipment

Also Published As

Publication number Publication date
CN111539200B (en) 2023-08-18

Similar Documents

Publication Publication Date Title
CN111274760B (en) Rich text data processing method and device, electronic equipment and computer storage medium
CN111381817A (en) Method, device, medium and electronic equipment for realizing cross-platform multi-language development
CN110543297B (en) Method and apparatus for generating source code
CN110457144B (en) Method, device, medium and equipment for realizing front-end application
CN110442330A (en) List element conversion method, device, electronic equipment and storage medium
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
CN111813381A (en) Method, device, medium and electronic equipment for generating executable program in cross-platform mode
CN111736840A (en) Compiling method and running method of applet, storage medium and electronic equipment
CN110780874B (en) Method and device for generating information
CN109726217B (en) Database operation method, device, equipment and storage medium
CN111314388B (en) Method and apparatus for detecting SQL injection
CN111324833A (en) Page display method, device, electronic design and computer readable medium
CN109739524B (en) Software installation package generation method and device, electronic equipment and storage medium
JP2023541186A (en) Visualization page rendering method, device, equipment and storage medium
CN114153459A (en) Interface document generation method and device
CN114895908B (en) Web application expression-based implementation method, system, equipment and storage medium
CN115599386A (en) Code generation method, device, equipment and storage medium
CN110851211A (en) Method, apparatus, electronic device, and medium for displaying application information
CN110941655A (en) Data format conversion method and device
CN111539200B (en) Method, device, medium and electronic equipment for generating rich text
CN111857658A (en) Method, device, medium and electronic equipment for rendering dynamic component
CN111027333B (en) Chapter translation method and apparatus
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN116860286A (en) Page dynamic update method, device, electronic equipment and computer readable medium
CN111124541A (en) Configuration file generation method, device, equipment and medium

Legal Events

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