CN111539200B - 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
CN111539200B
CN111539200B CN202010322375.5A CN202010322375A CN111539200B CN 111539200 B CN111539200 B CN 111539200B CN 202010322375 A CN202010322375 A CN 202010322375A CN 111539200 B CN111539200 B CN 111539200B
Authority
CN
China
Prior art keywords
grammar
rich text
information
text
description
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.)
Active
Application number
CN202010322375.5A
Other languages
Chinese (zh)
Other versions
CN111539200A (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

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Machine Translation (AREA)

Abstract

The disclosure provides a method, a device, a medium and electronic equipment for generating rich text. The method comprises the following steps: comprising the following steps: under a cross-platform framework, acquiring a first rich text from a rich text set based on preset display logic; determining a grammar type of 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 grammar analysis model to obtain a corresponding first abstract grammar tree; and analyzing the first abstract syntax tree based on the unified description syntax generation model, and generating a second rich text written based on the 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 technology, and in particular, to a method, an apparatus, a medium, and an electronic device for generating rich text.
Background
The existing cross-platform development framework is widely applicable by virtue of the advantages of cross-platform property, high fidelity, high performance and the like, and provides rich components and interfaces, so that a developer can develop a set of codes conveniently, and the cross-platform development framework is 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 an executable program developed based on the Flutter framework can be run on an iOS platform or an Android platform.
The Flutter framework adopts the Dart language as a development language, and the Dart language is a static language running by using a specific Dart VM virtual machine, and provides a high-speed pre-running compilation (AOT) scheme and a dynamic-emphasized just-in-Time dynamic compilation (JIT) scheme. Before the AOT scheme program is run, the source code file is directly compiled into the local machine code. The JIT scheme compiles class file bytecodes into native machine code at run-time.
The rich text engine under the Flutter framework has insufficient support for the rich text component scheme, has single decoupling function, and cannot support the development of other voices, so that the development of rich text 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.
The present disclosure aims to provide a method, an apparatus, a medium and an electronic device for generating rich text, which can solve at least one technical problem mentioned above. The specific scheme is as follows:
according to a first aspect of the present disclosure, there is provided a method of generating rich text, comprising:
under a cross-platform framework, acquiring a first rich text from a rich text set based on preset display logic; the rich text set comprises a first rich text, and the first rich text comprises codes written based on a description grammar;
determining a grammar type of 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 grammar analysis model to obtain a corresponding first abstract grammar tree;
analyzing the first abstract syntax tree based on a unified description syntax generation model, and generating a second rich text written based on the unified description syntax; the unified description grammar includes grammar supported by the rich text engine under the cross-platform framework.
According to a second aspect of a specific embodiment of the present disclosure, the present disclosure provides an apparatus for generating rich text, including:
acquiring a first rich text unit, which is used for 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, and the first rich text comprises codes written based on a description grammar;
a grammar type determining unit for determining a grammar type of the first rich text;
the grammar type obtaining unit is used for obtaining a grammar type according to the grammar type;
the first abstract syntax tree obtaining unit is used for analyzing codes in the first rich text based on the syntax analysis model to obtain 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 unified description syntax generation model and generating a second rich text written based on the unified description syntax; the unified description grammar includes grammar supported by the rich text engine under the cross-platform framework.
According to a third aspect of the disclosure, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a method of generating rich text as in any of the first aspects.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: one or more processors; storage means for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to implement the method of generating rich text as in any of the first aspects.
Compared with the prior art, the scheme of the embodiment of the disclosure has at least the following beneficial effects:
the disclosure provides a method, a device, a medium and electronic equipment for generating rich text. In the method, analysis of rich texts of various description grammars 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 grammar tree, and then the first abstract grammar tree is analyzed based on a unified description grammar 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 unified description grammar. Therefore, the compatibility of various description grammars under the cross-platform framework can be effectively improved.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
FIG. 1 illustrates a flow chart 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 example diagram of a unified description grammar for a second rich text of a method of generating rich text in accordance with an embodiment of the present disclosure;
FIG. 4 illustrates a block diagram of a unit of an apparatus for generating rich text according to an embodiment of the disclosure;
fig. 5 shows a schematic diagram of an electronic device connection structure 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 have been shown in the accompanying 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 are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present 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. Furthermore, 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 "including" and variations thereof as used herein are intended to be 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. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the drawings.
The first embodiment provided for in this disclosure is an embodiment of a method of generating rich text.
Embodiments of the present disclosure are described in detail below with reference to fig. 1 through 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 embodiment of the disclosure is 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 suitable for the method according to the embodiment of the disclosure. The cross-platform framework includes a Flutter framework. The Flutter framework is an open-source mobile application development framework, and can enable an executable program to realize cross-platform operation. For example, under the Flutter framework, a set of development code may run on either an iOS platform or an Android platform. Under the Flutter framework, the developer can concentrate on building application content, rather than headache to 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 models, and a first-class user experience is smoothly built. The Flutter engine driven by the high-level programming language Dart helps a developer to realize quick development through a hot reloading function for maintaining an application state, and in addition, the Flutter engine can provide excellent local compiling support on a mobile terminal, a desktop terminal, a network front end and an embedded device, so that quick and strong performance is brought to the developer. And consistent experience can be delivered for users, and code multiplexing is realized on three platforms, namely a mobile terminal, a network front end and a desktop under appropriate conditions. The Flutter framework is unique in that it requires only one set of benchmark code to support a rich local compilation experience.
Referring to fig. 2, the rich text set includes at least one first rich text, and each first rich text includes a code written based on a description grammar. The different first rich text description grammar may be different or the same, and in particular implementation, the first rich text description grammar may include: any of hypertext markup language (english full name Hyper Text Markup Language, abbreviated HTML) grammar, markdown grammar, and Delta grammar, and of course, may be a custom description grammar.
The preset display logic is a preset logic relation for displaying the front page among rich texts in the rich text set. The preset display logic is typically stored in one or more files. The display logic is the sequence of the display of each display unit in the rich text. It may be a linear logic, or a nested logic, or a custom logic.
Step S102, determining the grammar type of the first rich text.
Since the description syntax of rich text in the rich text set is different. Therefore, the grammar type corresponding to the first rich text can be obtained through the feature describing the grammar.
Step S103, obtaining a corresponding grammar analysis model based on the grammar type.
The grammar analysis model is a custom model for analyzing the code of rich text of the corresponding grammar type.
Because of the different description grammars of rich text, the corresponding grammar analysis models are also different. Accordingly, a corresponding parsing model needs to be acquired 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 characteristic information based on the grammar type.
The grammar description feature information is information customized based on grammar description features. A grammar type has a plurality of grammar description feature information.
And step S103-2, analyzing the grammar description characteristic information to obtain a corresponding grammar analysis model.
The parsing model in this step is generated by custom syntax description feature information.
Step S104, analyzing codes in the first rich text based on the grammar analysis model, and obtaining a corresponding first abstract grammar tree.
An abstract syntax tree (english full name abstract syntax tree, AST for short) is a tree representation of the abstract syntax structure of source code. Each node on the tree represents a structure in the source code. The grammar is said to be "abstract" in that the grammar herein does not represent every detail that appears in the real grammar. The rich text of different description grammars has different grammar types, and the corresponding abstract grammar trees have different characteristics and properties.
Step S105, analyzing the first abstract syntax tree based on the unified description syntax generating model, and generating a second rich text written 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 logic relation of the abstract grammar tree.
The unified description grammar includes grammars supported by the rich text engine under the cross-platform framework so far, and the embodiment of the disclosure converts rich texts written based on different description grammars into second rich texts written based on the unified description grammar.
For example, the label is a base class of an AST node, and a father node and left and right nodes are constructed on the basis of the label, so that the AST is formed; indicated by the label in AST: element in line, line feed, thickening and italic; for a 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 description sentences are arranged linearly. When the method is executed, sentence-by-sentence execution is performed from top to bottom, complex logic relations among description sentences are avoided, and the readability of rich texts of the unified description grammar is improved.
After the generating of the second rich text written based on the unified descriptive grammar, further comprising:
and S106, analyzing the codes of the second rich text based on the unified description grammar analysis model, and generating text node information corresponding to the 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 mutually converted or mutually indexed.
The component is a display object for displaying a specific function in the information. For example, a line component and an embedded component in the display information, text node information, and corresponding unit information describe the line component and the embedded component, respectively.
The second rich text is used for unifying different description grammars to the unified description grammar and plays a role of generating a bridge for displaying information. Text node information is the layer of transition of information describing grammar to rendering so as to be beneficial to generating display information.
Step S107, style information matched with the text node information is acquired.
Style information may be stored in the component style dataset. The component style dataset is a custom database comprising text node information and corresponding style information. The style information can be conveniently changed through the component style dataset, so that the flexibility of rendering is improved. And retrieving a component style dataset based on the text node information, and acquiring corresponding style information.
And step S108, rendering the text node information and the style information to generate display information.
Optionally, the method further comprises:
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: insert information, format information, and delete information. Changes to the display information map to the text node information, thereby causing change information of the text node information.
And step S112, carrying out compliance detection on the text node information based on the change information.
Compliance detection is to detect whether text node information meets the requirement of a pre-designed rule. For example, the rules that are pre-designed are: no space can exist after the text or symbol.
And step S113, when the text node information is detected to be failed, the text node information is subjected to compliance processing.
The compliance processing is to process the text node information according to the pre-designed rule requirement. For example, continuing the above example, if there are a plurality of spaces after the period, and a failure is detected, the spaces after the period are deleted.
Compliance detection may improve the simplicity, aesthetics, and readability of the displayed information.
After the change information of the text node information is obtained, the method further comprises the following steps:
step S121, changing the unit information corresponding to the text node information based on the change information.
Since the text node information and the corresponding unit information in the second rich text can be mutually converted and also can be mutually indexed. Therefore, the text node information and the corresponding unit information in the second rich text have a mutual mapping relation. When the text node information is changed, the corresponding unit information is also changed.
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 written based on a unified description syntax through the first abstract syntax tree. A parsing method for rich text of various description grammars under a cross-platform framework is provided. Rich text description grammars include hypertext markup language grammars, markdown description grammars, and Delta description grammars, and even custom description grammars. The problem of description grammar compatibility which is not supported under the cross-platform framework and the problem of display under the cross-platform framework are effectively solved through the customized grammar analysis model.
Corresponding to the first embodiment provided by the present disclosure, the present disclosure also provides a second embodiment, namely an apparatus for generating rich text. Since the second embodiment is substantially similar to the first embodiment, the description is relatively simple, and the relevant portions will be referred to the corresponding descriptions 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 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.
A first rich text obtaining unit 401, configured to obtain, under a cross-platform framework, a first rich text from a rich text set based on preset display logic; the rich text set comprises first rich texts, and each first rich text comprises codes written based on a description grammar;
a determining grammar type unit 402 for determining a grammar type of the first rich text;
an acquisition syntax analysis model unit 403, configured to acquire 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 second rich text generating unit 405, configured to analyze the first abstract syntax tree based on a unified description syntax generating model, and generate a second rich text written based on the unified description syntax; the unified description grammar includes grammar supported by the rich text engine under the cross-platform framework.
Optionally, in the parsing model obtaining unit 403, it includes:
the grammar description characteristic information acquisition subunit is used for acquiring corresponding grammar description characteristic information based on the grammar type;
and generating a grammar analysis model subunit, which is used for analyzing the grammar description characteristic information and obtaining a corresponding grammar analysis model.
Optionally, in the apparatus, further includes:
a text node information generating unit, configured to, after the second rich text that generates 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 the unit information; the unit information is information associated with a component in the second rich text;
the style information obtaining unit is used for obtaining style information matched with the text node information after the text node information corresponding to the unit information is generated;
and generating display information unit for rendering the text node information and the style information to generate display information.
Optionally, in the apparatus, further includes:
the change information acquisition unit is used for acquiring change information of the text node information;
the compliance detection unit is used for carrying out compliance detection on the text node information based on the change information;
and the compliance processing unit is used for carrying out compliance processing on the text node information when the detection fails.
Optionally, in the apparatus, further includes:
and the unit is used for changing the unit information corresponding to the text node information based on the change information after the change information of the text node information is acquired.
Optionally, the cross-platform framework includes a router 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 written based on a unified description syntax through the first abstract syntax tree. A parsing method for rich text of various description grammars under a cross-platform framework is provided. Rich text description grammars include hypertext markup language grammars, markdown description grammars, and Delta description grammars, and even custom description grammars. The problem of description grammar compatibility which is not supported under the cross-platform framework and the problem of display under the cross-platform framework are effectively solved through the customized grammar analysis model.
An embodiment of the present disclosure provides a third embodiment, that is, an electronic device, which is configured to generate a method for generating rich text, where the electronic device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the one processor to enable the at least one processor to perform the method of generating rich text as described in the first embodiment.
The present disclosure provides a fourth embodiment, namely a computer storage medium storing computer-executable instructions that are executable to perform the method of generating rich text as described in the first embodiment.
Referring now to fig. 5, a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 5 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 5, the electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 501, which 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 required for the operation of the electronic device are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
In general, the following devices may be connected to the I/O interface 505: input devices 506 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 507 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 508 including, for example, magnetic tape, hard disk, etc.; and communication means 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 shows an electronic device having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication means 509, or from the storage means 508, or from the ROM 502. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 501.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this 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 the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, 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 communication 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 networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
Computer program code for carrying out operations of the present disclosure may be written in 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 kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present 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 involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The functions described above herein 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: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), 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. The 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 of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although 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. In 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 limiting the scope of the present 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 example forms of implementing the claims.

Claims (9)

1. A method of generating rich text, comprising:
under a cross-platform framework, acquiring a first rich text from a rich text set based on preset display logic; the rich text set comprises a first rich text, and the first rich text comprises codes written based on a description grammar;
determining a grammar type of 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 grammar analysis model to obtain a corresponding first abstract grammar tree;
analyzing the first abstract syntax tree based on a unified description syntax generation model, and generating a second rich text written based on the unified description syntax; the unified description grammar comprises grammar supported by a rich text engine under the cross-platform framework, wherein 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 obtaining a corresponding grammar analysis model based on the grammar type includes:
acquiring corresponding grammar description characteristic information based on the grammar type;
analyzing the grammar description characteristic information to obtain a corresponding grammar analysis model.
2. The method of claim 1, further comprising, after the generating the second rich text written based on the unified descriptive grammar:
analyzing the codes of the second rich text based on the unified description grammar analysis model, and generating text node information corresponding to the unit information; the unit information is information associated with a component in the second rich text, and the component is a display object for displaying a specific function in the information;
acquiring style information matched with the text node information;
and rendering the text node information and the style information to generate display information.
3. The method according to claim 2, wherein the method further comprises:
acquiring change information of the text node information;
performing compliance detection on the text node information based on the change information;
and when the text node information is detected to pass, carrying out compliance processing on the text node information.
4. The method according to claim 3, further comprising, after the obtaining the change information of the text node information:
and changing the unit information corresponding to the text node information based on the change information.
5. The method of any of claims 1-4, wherein the cross-platform framework comprises a Flutter framework.
6. An apparatus for generating rich text, comprising:
acquiring a first rich text unit, which is used for 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, and the first rich text comprises codes written based on a description grammar;
a grammar type determining unit for determining a grammar type of the first rich text;
the grammar type obtaining unit is used for obtaining a grammar type according to the grammar type;
the first abstract syntax tree obtaining unit is used for analyzing codes in the first rich text based on the syntax analysis model to obtain 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 unified description syntax generation model and generating a second rich text written based on the unified description syntax; the unified description grammar comprises grammar supported by a rich text engine under the cross-platform framework, wherein 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 obtaining a corresponding grammar analysis model based on the grammar type includes:
acquiring corresponding grammar description characteristic information based on the grammar type;
analyzing the grammar description characteristic information to obtain a corresponding grammar analysis model.
7. The apparatus of claim 6, wherein the means for obtaining a parse model comprises:
the grammar description characteristic information acquisition subunit is used for acquiring corresponding grammar description characteristic information based on the grammar type;
and generating a grammar analysis model subunit, which is used for analyzing the grammar description characteristic information and obtaining a corresponding grammar analysis model.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any one of claims 1 to 5.
9. 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 implement the method of any of claims 1 to 5.
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 CN111539200A (en) 2020-08-14
CN111539200B true 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)

Families Citing this family (1)

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

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9092505B1 (en) * 2013-06-25 2015-07-28 Google Inc. Parsing rule generalization by n-gram span clustering
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

Family Cites Families (5)

* 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
US9239710B2 (en) * 2013-03-15 2016-01-19 ArtinSoft Corporation Programming language transformations with abstract syntax tree extensions
CN103631632B (en) * 2013-11-29 2017-08-04 华为技术有限公司 Implantation method and source-to-source compiler
US9886249B2 (en) * 2015-11-16 2018-02-06 Sap Se Universal transcompiling framework
US10671609B2 (en) * 2016-11-18 2020-06-02 Change Healthcare Holdings, Llc Methods and apparatuses for facilitating compilation of measure data

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9092505B1 (en) * 2013-06-25 2015-07-28 Google Inc. Parsing rule generalization by n-gram span clustering
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

Also Published As

Publication number Publication date
CN111539200A (en) 2020-08-14

Similar Documents

Publication Publication Date Title
CN111274760B (en) Rich text data processing method and device, electronic equipment and computer storage medium
CN110543297B (en) Method and apparatus for generating source code
CN111338623B (en) Method, device, medium and electronic equipment for developing user interface
CN111381817A (en) Method, device, medium and electronic equipment for realizing cross-platform multi-language development
CN111736840A (en) Compiling method and running method of applet, storage medium and electronic equipment
CN110780874B (en) Method and device for generating information
CN111813381A (en) Method, device, medium and electronic equipment for generating executable program in cross-platform mode
CN112395253B (en) Index file generation method, terminal device, electronic device and medium
US20150331781A1 (en) Debugging data format conversion
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
JP2023541186A (en) Visualization page rendering method, device, equipment and storage medium
CN111857658A (en) Method, device, medium and electronic equipment for rendering dynamic component
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN114153459A (en) Interface document generation method and device
CN115599386A (en) Code generation method, device, equipment and storage medium
CN110851211A (en) Method, apparatus, electronic device, and medium for displaying application information
CN112527386A (en) Application program issuing method and device
CN111539200B (en) Method, device, medium and electronic equipment for generating rich text
CN113778897A (en) Automatic test method, device, equipment and storage medium of interface
CN111124541B (en) Configuration file generation method, device, equipment and medium
CN113419740A (en) Program data stream analysis method and device, electronic device and readable storage medium
CN111752644A (en) Interface simulation method, device, equipment and storage medium
CN116860286A (en) Page dynamic update method, device, electronic equipment and computer readable medium
CN113138767B (en) Code language conversion method, device, electronic equipment and storage medium
CN111797009A (en) Method and device for detecting code compatibility and electronic equipment

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