E-book typesetting style code generation method, device, equipment and storage medium

By obtaining and modifying the layout style code of e-books, the problem of inconsistent layout styles of e-books on different platforms is solved, the consistency of layout styles in manufacturers' e-book reading applications and browsers is achieved, and the user's reading experience is improved .

CN114638200BActive Publication Date: 2025-02-11ZHANGYUE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210293450.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-23
Publication Date
2025-02-11
Estimated Expiration
2042-03-23

AI Technical Summary

Technical Problem

The typesetting styles displayed by e-books in manufacturers' e-book reading applications and browsers are different, resulting in inconsistent reading experiences.

Method used

By obtaining the e-book file of the e-book, determining its layout style on the browser, the difference between it and the standard layout style, modifying the code file to make the layout style consistent, and storing it in association.

Benefits of technology

It realizes the consistency of the layout style displayed in the manufacturer's e-book reading application and browser, and improves the user's reading experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114638200B_ABST
    Figure CN114638200B_ABST
Patent Text Reader

Abstract

The present disclosure relates to a method, device, equipment and storage medium for generating e-book typesetting style codes. In the embodiment of the present disclosure, an e-book file of an e-book is obtained, wherein the e-book file includes a code file of a standard typesetting style of the e-book; a first typesetting style of the e-book on a browser is determined based on the code file; based on the difference between the first typesetting style and the standard typesetting style, a code corresponding to the difference part style in the code file is modified so that the typesetting style of the e-book on the browser is the same as the standard typesetting style, and a target code corresponding to the difference part style is obtained; the target code and the difference part style are stored in association, so that the typesetting style displayed by the browser based on the target code of the e-book is the same as the typesetting style in the manufacturer's e-book reading application, thereby improving the reading experience of the user.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for generating e-book typesetting style codes. Background Art

[0002] With the continuous development of science and technology and society, e-books have gradually replaced traditional paper books. Various electronic products, such as smart phones, tablets, and e-readers, support the installation of e-reading applications and have e-book reading functions. Epub, as the official standard of the International Digital Publishing Forum (IDPF), has become the mainstream format of e-books because of its advantages such as supporting a variety of complex typesetting and being able to adapt to device screens.

[0003] In order to provide more convenient electronic reading, many e-book manufacturers have developed their own e-book reading applications and Epub e-books adapted to their own e-book reading applications. The typesetting style of the Epub e-book displayed in the manufacturer's e-book reading application is a standard typesetting style. If the Epub e-book of the e-book manufacturer is placed in a browser for display, some typesetting styles cannot be displayed by the browser, resulting in some typesetting styles of the Epub e-book being displayed very well in the manufacturer's e-book reading application, but poorly displayed in the browser. Therefore, there is an urgent need for a technology that can make the typesetting style of the Epub e-book displayed in the manufacturer's e-book reading application and the browser the same, so as to overcome the shortcomings of the existing display effect. Summary of the invention

[0004] In order to solve the above technical problems, the present disclosure provides a method, device, equipment and storage medium for generating e-book typesetting style codes.

[0005] A first aspect of an embodiment of the present disclosure provides a method for generating an electronic book typesetting style code, the method comprising:

[0006] Obtaining an electronic book file of an electronic book, wherein the electronic book file includes a code file of a standard typesetting style of the electronic book;

[0007] Determine the first layout style of the e-book on the browser based on the code file;

[0008] Based on the difference between the first typesetting style and the standard typesetting style, modify the code corresponding to the difference part style in the code file so that the typesetting style of the electronic book on the browser is the same as the standard typesetting style, and obtain the target code corresponding to the difference part style;

[0009] The target code and the difference part style are stored in association.

[0010] A second aspect of an embodiment of the present disclosure provides a device for generating an electronic book typesetting style code, the device comprising:

[0011] An acquisition module is used to acquire an electronic book file of an electronic book, wherein the electronic book file includes a code file of a standard typesetting style of the electronic book;

[0012] A determination module, used for determining the first typesetting style of the e-book on the browser based on the code file;

[0013] A first modification module is used to modify the code corresponding to the difference part style in the code file based on the difference between the first typesetting style and the standard typesetting style, so that the typesetting style of the electronic book on the browser is the same as the standard typesetting style, and obtain the target code corresponding to the difference part style;

[0014] The storage module is used for associating and storing the target code and the difference part style.

[0015] A third aspect of an embodiment of the present disclosure provides a computer device, which includes: a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method for generating electronic book typesetting style codes according to the first aspect is implemented.

[0016] A fourth aspect of the embodiments of the present disclosure provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method for generating an e-book typesetting style code according to the first aspect is implemented.

[0017] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0018] The disclosed embodiment obtains an e-book file of an e-book, wherein the e-book file includes a code file of a standard typesetting style of the e-book; determines a first typesetting style of the e-book on a browser based on the code file; modifies a code corresponding to a difference part style in the code file based on a difference between the first typesetting style and the standard typesetting style, so that the typesetting style of the e-book on the browser is the same as the standard typesetting style, and obtains a target code corresponding to the difference part style; and stores the target code and the difference part style in an associated manner, so that the typesetting style displayed by the browser based on the target code of the e-book is the same as the typesetting style in the manufacturer's e-book reading application, thereby improving the user's reading experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0021] Figure 1 is a flow chart of a method for generating an e-book typesetting style code provided by an embodiment of the present disclosure;

[0022] Figure 2 is a flow chart of another method for generating e-book typesetting style codes provided by an embodiment of the present disclosure;

[0023] Figure 3 It is a structural schematic diagram of an electronic book typesetting style code generation device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0024] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0025] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0026] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0027] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0028] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0029] The e-book typesetting style code generation method provided by the embodiment of the present disclosure can be executed by a computer device, which can be understood as any device with processing and computing capabilities. The computer device can include but is not limited to mobile terminals such as smart phones, laptops, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), wearable devices, etc., as well as fixed electronic devices such as digital TVs and desktop computers.

[0030] The typesetting style of the e-book in the embodiment of the present disclosure can be understood as the display method of each text data in the e-book, telling the computer device how to display the content therein, for example, where the text is located, how the screen is arranged, how the picture is displayed, font display attributes such as font, font size, font color, etc.

[0031] In view of the defects of related technologies in displaying e-book typesetting styles, the embodiments of the present disclosure provide a method, apparatus, device and storage medium for generating e-book typesetting style codes, which can make the typesetting style displayed by the browser based on the target code of the e-book the same as the typesetting style in the manufacturer's e-book reading application, thereby improving the user's reading experience.

[0032] In order to better understand the inventive concept of the embodiments of the present disclosure, the technical solutions of the embodiments of the present disclosure are described below in conjunction with exemplary embodiments.

[0033] Figure 1 1 is a flow chart of a method for generating an e-book typesetting style code provided by an embodiment of the present disclosure, and the method can be executed by a computer device. Figure 1 As shown, the method for generating e-book typesetting style code provided in this embodiment includes the following steps:

[0034] Step 101: Obtain an e-book file of an e-book, wherein the e-book file includes a code file of a standard typesetting style of the e-book.

[0035] The electronic book file in the disclosed embodiment can be understood as an electronic book file in an electronic publication format (Electronic Publication, Epub), an electronic book file that conforms to a standard format specification, or an electronic book file that conforms to a format specification in a specific electronic book reading application. The text data in the Epub file can be displayed in a manner that is most suitable for reading based on the characteristics of the reading device and the typesetting style.

[0036] The standard typesetting style in the embodiment of the present disclosure may be understood as the typesetting style displayed by the e-book file in the manufacturer's e-book reading application.

[0037] The code file in the embodiment of the present disclosure can be understood as a source file of the typesetting style of the e-book written by the programmer in the language supported by the development tool, wherein the code can be a set of clear rules that represent information in discrete form by characters, symbols or signal code elements.

[0038] The electronic book file in the embodiment of the present disclosure may include a code file of the standard typesetting style of the electronic book and an electronic book logo, but is not limited thereto.

[0039] In some embodiments, the computer device may receive an electronic book file of an electronic book uploaded by a user, and obtain the electronic book file of the electronic book.

[0040] In other embodiments, the computer device may respond to a code generation request sent by a user, the code generation request includes an electronic book identifier, and the computer device searches for an electronic book file of the electronic book from a reading resource server according to the electronic book identifier. The reading resource server stores electronic book files corresponding to multiple electronic book identifiers, and the electronic book identifier can be understood as identification information that can uniquely identify the electronic book, and may include information such as the International Standard Book Number (ISBN) of the electronic book.

[0041] In some embodiments of the present disclosure, after obtaining the e-book file of an e-book, the computer device can decompress the e-book file, obtain a code file of a standard typesetting style in the e-book file, run the code file, calculate a standard typesetting tree corresponding to the code file, and obtain the standard typesetting style of the e-book based on the standard typesetting tree.

[0042] The layout tree in the embodiment of the present disclosure can be understood as all the data contained in the electronic book file. The layout tree includes a resource management file and multiple resource files. Each part of the file corresponds to a different position of the layout tree, and each resource file corresponds to a file type. Among them, the resource file may include a directory file, a chapter file, an image file, and a layout style file.

[0043] It should be noted that each file in the typesetting tree is a code file, that is, the typesetting tree is composed of multiple different code files.

[0044] The resource management file is a file named content with the suffix .OPF, which is used to store various resource management information in Epub e-books. Resource management information may include at least one of basic book information, resource list (manifest) and spine information (spine). The basic book information may include the title (title), creator (creator), subject (subject), content description (description), contributor (contributor), publication date (date), type (type), format (format), identifier (identifier), source (source), language (language), related information (relation), coverage (covergae), rights description (rights) and at least one of other extensible information. The basic book information is embodied in the form of metadata (Metadata). In the resource management file, the resource list lists the storage location and file format type of all resource files included in the Epub e-book. The spine information is used to store the linear reading order of the Epub e-book.

[0045] The table of contents file is a file named toc with the suffix .ncx, which is used to store the table of contents of the Epub e-book. The table of contents usually adopts a hierarchical structure, which can include nested content, chapters and sections.

[0046] Chapter files are stored in the Text folder, usually with the suffix .html or .xhtml. Chapter files store the main text of the Epub e-book.

[0047] Image files are files of various possible image formats stored in the Images folder. Image files store various images required for Epub e-books.

[0048] The typesetting style file is usually a file with the suffix .css. The typesetting style file stores the typesetting style information of various text data of the Epub e-book, for example, it may include at least one of the text size, text font, file format, etc.

[0049] The layout tree specifies the display structure and form of each part of the e-book on the screen. Therefore, the computer device can calculate the layout style of the e-book based on the e-book's layout tree.

[0050] In some other embodiments of the present disclosure, a manufacturer's e-book reading application can be integrated into a computer device and run. After obtaining the e-book file of the e-book, the computer device can decompress the e-book file to obtain a code file of the standard typesetting style in the e-book file, and load the code file into the e-book reading application. The e-book reading application runs the code file and displays the standard typesetting style of the e-book on the e-book reading application. The computer device can identify the standard typesetting style displayed by the e-book reading application through image recognition and other technologies, and then obtain the standard typesetting style of the e-book on the e-book reading application.

[0051] Step 102: Determine the first layout style of the electronic book on the browser based on the code file.

[0052] The browser in the disclosed embodiment can be understood as an application used to retrieve, display and transmit Internet information resources. Internet information resources are marked by Uniform Resource Identifiers (URIs), which can be a web page, a picture, a video or any content presented on the Internet. Users can browse information on the Internet through a browser with the help of hyperlinks. The browser can be installed in a computer device and can be run in the computer device.

[0053] The first typesetting style in the embodiment of the present disclosure may be understood as a typesetting style obtained after a code file of a standard typesetting style of an e-book file is run on a browser.

[0054] In some embodiments, after the computer device obtains the code file of the standard typesetting style of the electronic book file, determining the first typesetting style of the electronic book on the browser based on the code file may include steps 1021-1022:

[0055] Step 1021: Load the code file into the browser to obtain the layout tree corresponding to the code file on the browser.

[0056] In the disclosed embodiment, after obtaining the code file of the standard typesetting style of the e-book, the computer device can send the code file to the browser. The browser runs the code file to obtain the typesetting tree corresponding to the code file on the browser, and the browser sends the typesetting tree to the computer device.

[0057] Step 1022: Determine the first layout style of the electronic book on the browser based on the layout tree.

[0058] In the disclosed embodiment, since the layout tree specifies the display structure and form of each part of the content of the e-book on the screen, the computer device can calculate the layout style of the e-book based on the layout tree of the e-book without displaying the layout style. The computer device can calculate the display structure and form of each part of the content of the e-book on the browser based on the layout tree corresponding to the code file on the browser, which may include the background, font, width, position, margin, special effects, etc. of each part of the content when displayed on the browser. That is to say, through the layout tree, the computer device can obtain the first layout style of the e-book on the browser.

[0059] In some embodiments, after the computer device obtains the layout tree of the electronic book, it parses the layout tree to obtain the first layout style of the electronic book on the browser.

[0060] In other embodiments, after obtaining the code file of the standard typesetting style of the e-book file, the computer device can load the code file into the browser, so that the browser displays the first typesetting style based on the code file, and the computer device then obtains the first typesetting style of the e-book on the browser. Specifically, after obtaining the code file of the standard typesetting style of the e-book, the computer device can send the code file to the built-in browser, and the browser runs the code file and displays the first typesetting style of the e-book on the browser. The computer device can identify the first typesetting style displayed on the browser through image recognition and other technologies, and then obtain the first typesetting style of the e-book on the browser.

[0061] Step 103: based on the difference between the first typesetting style and the standard typesetting style, modify the code corresponding to the difference part style in the code file so that the typesetting style of the e-book on the browser is the same as the standard typesetting style, and obtain the target code corresponding to the difference part style.

[0062] In the disclosed embodiment, after obtaining the standard typesetting style of the e-book and the first typesetting style of the e-book in the browser, the computer device can search for the difference part style between the first typesetting style and the standard typesetting style, and the difference part style can be one or more. For example, the standard typesetting style of all the contents in a page of the e-book is centered, while the first typesetting style in the browser is at the top of the page. Centering is the difference part style between the first typesetting style and the standard typesetting style of the page of the e-book. This is only an exemplary description of the difference between the typesetting styles, not the only description.

[0063] In some embodiments, based on the difference between the first typesetting style and the standard typesetting style, the computer device modifies the code corresponding to the difference part style in the code file so that the typesetting style of the electronic book on the browser is the same as the standard typesetting style, and obtains the target code corresponding to the difference part style, which may include steps 1031-1033:

[0064] Step 1031: Based on the mapping relationship between the first layout style and the layout tree of the browser, determine the position of the difference part style in the layout tree.

[0065] In the disclosed embodiment, the typesetting style of the e-book is composed of the typesetting styles of the various parts of the e-book, and the e-book file typesetting tree of the e-book is also composed of the typesetting trees of the various parts of the e-book. The typesetting tree of each part has a certain position in the typesetting tree of the e-book, and the typesetting style of each part of the e-book corresponds one-to-one to the typesetting tree of the part.

[0066] The computer device can find the typesetting tree corresponding to the difference part style based on the mapping relationship between the first typesetting style and the typesetting tree of the browser, and determine the position of the typesetting tree of the difference part style in the typesetting tree of the browser.

[0067] Step 1032: Based on the mapping relationship between the layout tree and the code, determine the code corresponding to the style of the difference part in the code file.

[0068] In the disclosed embodiment, the typeset tree of each part of the electronic book has a specific code, and the code of each part is used to represent the content of the typeset tree of that part. The typeset tree of each part corresponds one-to-one to the code of the typeset tree of that part, and the codes of the typeset trees of each part can constitute the code file of the entire typeset tree.

[0069] After determining the position of the difference part style in the typesetting tree, the computer device can find the code corresponding to the typesetting tree at that position, that is, the code that determines the difference part style in the code file.

[0070] Step 1033: Modify the code corresponding to the difference part style in the code file to obtain the target code corresponding to the difference part style.

[0071] In the disclosed embodiment, the computer device can store the identifiers of different browsers and the code writing rules corresponding to each browser. After finding the code corresponding to the difference part style in the code file, the computer device can determine the code writing rules of the browser based on the identifier of the browser, and modify the code of the difference part style with the code adapted to the browser according to the code writing rules of the browser, so that the typesetting style of the difference part code in the browser is the same as the standard typesetting style. After the code modification is completed, the target code is obtained, so that the typesetting style of the e-book on the browser is the same as the standard typesetting style. Among them, the identifier of the browser can be understood as the name, version number, memory serial number, IP address (Internet Protocol Address), network card MAC address (Media Access Control Address) and other identification information that can uniquely identify the browser.

[0072] In some other embodiments, the computer device modifies the code corresponding to the difference part style in the code file based on the difference between the first typesetting style and the standard typesetting style, so that the typesetting style of the electronic book on the browser is the same as the standard typesetting style, and obtains the target code corresponding to the difference part style, which may include steps 1033-1035:

[0073] Step 1033: Based on the typesetting tree of the standard typesetting style of the electronic book file and the typesetting tree of the first typesetting style in the browser, determine the difference between the typesetting tree of the first typesetting style and the typesetting tree of the standard typesetting style.

[0074] In an embodiment of the present disclosure, a computer device can identify the difference between the typesetting tree of the first typesetting style and the typesetting tree of the standard typesetting style based on the typesetting tree of the standard typesetting style of the e-book file obtained in the above steps 101 and 102 and the typesetting tree of the first typesetting style in the browser, and determine the difference between the typesetting tree of the first typesetting style and the typesetting tree of the standard typesetting style without displaying the typesetting style.

[0075] Step 1034: Based on the mapping relationship between the layout tree and the code, determine the code corresponding to the style of the difference part in the code file.

[0076] The contents of the embodiment of the present disclosure may refer to the above step 1032 and will not be repeated here.

[0077] Step 1035: Modify the code corresponding to the difference part style in the code file to obtain the target code corresponding to the difference part style.

[0078] The contents of the embodiment of the present disclosure may refer to the above step 1033 and will not be repeated here.

[0079] The disclosed embodiment determines the difference between a typesetting tree of a first typesetting style and a typesetting tree of a standard typesetting style based on a typesetting tree of a standard typesetting style of an e-book file and a typesetting tree of a first typesetting style in a browser; determines the code corresponding to the difference style in a code file based on a mapping relationship between the typesetting tree and the code; modifies the code corresponding to the difference style in the code file to obtain a target code corresponding to the difference style, and can directly obtain the difference in typesetting style based on the typesetting tree without displaying the typesetting style, thereby improving the efficiency of actually obtaining the difference in typesetting style and thereby improving the speed of generating the target code.

[0080] In other embodiments, since the typesetting style displayed by the browser based on the target code may be different from the standard typesetting style, after the computer device sends the target code to the browser, it can monitor the typesetting style displayed by the browser for the first time based on the target code. If it is detected that the typesetting style of the browser is different from the standard typesetting style, step 103 is repeated until the typesetting style of the browser is the same as the standard typesetting style.

[0081] Step 104: store the target code and the difference part style in association with each other.

[0082] In the disclosed embodiment, after obtaining the target code corresponding to the difference part style, the computer device can associate and store the browser's identifier, the target code and the difference part style, and generate an association relationship between the browser's identifier, the target code and the difference part style. The association relationship can be stored in a local storage space or in a reading resource server outside the computer device, and there is no limitation here.

[0083] In other embodiments, after obtaining the target code corresponding to the style of the difference part, the computer device can generate an e-book file containing the target code, and store the e-book file containing the target code, the e-book identifier, and the browser identifier in an associated manner, thereby generating an association relationship between the e-book file containing the target code, the e-book identifier, and the browser identifier, which can be stored in a local storage space or in a reading resource server outside the computer device, and there is no limitation here.

[0084] The disclosed embodiment obtains an e-book file of an e-book, wherein the e-book file includes a code file of a standard typesetting style of the e-book; determines a first typesetting style of the e-book on a browser based on the code file; modifies a code corresponding to a difference part style in the code file based on a difference between the first typesetting style and the standard typesetting style, so that the typesetting style of the e-book on the browser is the same as the standard typesetting style, and obtains a target code corresponding to the difference part style; and stores the target code and the difference part style in an associated manner, so that the typesetting style displayed by the browser based on the target code of the e-book is the same as the typesetting style in the manufacturer's e-book reading application, thereby improving the user's reading experience.

[0085] In the above Figure 1 After obtaining the target code corresponding to the style of the difference part, it can also be applied to another e-book typesetting style code generation method, such as Figure 2 As shown, Figure 2 FIG. 1 is a flowchart of another method for generating an electronic book typesetting style code provided by an embodiment of the present disclosure, and the method can be executed by a computer device. Figure 2 As shown, the method for generating e-book typesetting style code provided in this embodiment includes the following steps:

[0086] Step 201: receiving a reading request sent by an electronic device equipped with a browser, wherein the reading request includes an identifier of the electronic book and an identifier of the browser.

[0087] The electronic device in the embodiments of the present disclosure can be understood as a device with processing and computing capabilities, and the electronic device can include but is not limited to mobile terminals such as smart phones, laptops, personal digital assistants (PDAs), tablet computers (PADs), portable multimedia players (PMPs), wearable devices, etc., and fixed electronic devices such as digital TVs, desktop computers, etc. The electronic device can be equipped with a browser application and run.

[0088] In the disclosed embodiment, a user clicks on an e-book in a browser of an electronic device equipped with a browser, and the electronic device generates and sends a reading request to a computer device, wherein the reading request includes an identifier of the e-book and an identifier of the browser.

[0089] Step 202: Based on the electronic book identifier, search and obtain a first electronic book file corresponding to the electronic book identifier.

[0090] The electronic book file in the embodiment of the present disclosure may be understood as an electronic book file in an electronic publication format (Electronic Publication, Epub).

[0091] In the disclosed embodiment, the computer device may store an e-book file with a standard typesetting style of the e-book and an identification of the e-book, which may be stored in a local storage space or in a reading resource server outside the computer device, and there is no limitation here. After the computer device receives a reading request from an electronic device equipped with a browser, in response to the reading request, based on the identification of the e-book and the identification of the browser, the computer device searches for a first e-book file corresponding to the identification of the e-book from the stored e-book files, the first e-book file being an e-book file with a standard typesetting style of the e-book, and sends the first e-book file to the electronic device, and after the electronic device receives the first e-book file, the electronic device sends the first e-book file to the browser equipped with the e-book.

[0092] Step 203: In response to the standard typesetting style of the first electronic book file, based on the identifier of the browser, a different part style in the standard typesetting style and a target code corresponding to the different part style are searched and obtained.

[0093] In the embodiment of the present disclosure, after obtaining the first e-book file of the standard typesetting style of the e-book, the computer device can decompress the first e-book file to obtain the standard typesetting style of the e-book, and search for the difference part style in the standard typesetting style, and then search for the target code corresponding to the difference part style in the browser based on the stored browser identifier, target code and the association relationship between the difference part style.

[0094] Step 204: based on the target code, modify the code of the different part style in the first electronic book file to obtain the second electronic book file.

[0095] In the disclosed embodiment, after obtaining the target code corresponding to the difference part style, the computer device can modify the code of the difference part style in the first electronic book file to obtain the second electronic book file corresponding to the first electronic book file.

[0096] Step 205: Send the second electronic book file to the electronic device so that the browser in the electronic device displays the standard typesetting style of the electronic book.

[0097] In the disclosed embodiment, after obtaining the second e-book file, the computer device may send the second e-book file to the electronic device, and the electronic device may send the second e-book file to the browser installed thereon so that the browser may display the e-book in a standard typesetting style.

[0098] The disclosed embodiment receives a reading request sent by an electronic device equipped with a browser, wherein the reading request includes an identifier of an electronic book and an identifier of a browser; based on the identifier of the electronic book, searches for a first electronic book file corresponding to the identifier of the electronic book; in response to a standard typesetting style of the first electronic book file, based on the identifier of the browser, searches for a difference part style in the standard typesetting style and a target code corresponding to the difference part style; based on the target code, modifies a code of the difference part style in the first electronic book file to obtain a second electronic book file; and sends the second electronic book file to the electronic device so that the browser in the electronic device displays the standard typesetting style of the electronic book, so that the typesetting style displayed by the browser is the same as the typesetting style in the manufacturer's electronic book reading application, thereby improving the user's reading experience.

[0099] In other embodiments of the present disclosure, after receiving a reading request from an electronic device equipped with a browser, the computer device can search for a corresponding electronic book file from a stored electronic book file containing a target code based on the identification of the electronic book and the identification of the browser in response to the reading request, and send the electronic book file to the electronic device. After receiving the electronic book file, the electronic device sends the electronic book file to the equipped browser, so that the browser displays the standard typesetting style of the electronic book based on the electronic book file. In the embodiments of the present disclosure, an electronic book file corresponding to the standard typesetting style displayed by the browser can be quickly obtained.

[0100] Figure 3 Schematic diagram of the structure of an electronic book typesetting style code generation device provided by the embodiment of the present disclosure, which can be understood as the above-mentioned computer device or part of the functional modules in the above-mentioned computing device. Figure 3 As shown, the electronic book typesetting style code generating device 300 may include:

[0101] An acquisition module 301 is used to acquire an electronic book file of an electronic book, wherein the electronic book file includes a code file of a standard typesetting style of the electronic book;

[0102] A determination module 302, configured to determine a first typesetting style of the electronic book on the browser based on the code file;

[0103] The first modification module 303 is used to modify the code corresponding to the difference part style in the code file based on the difference between the first typesetting style and the standard typesetting style, so that the typesetting style of the electronic book on the browser is the same as the standard typesetting style, and obtain the target code corresponding to the difference part style;

[0104] The storage module 304 is used to store the target code and the difference part style in association.

[0105] The disclosed embodiment is based on an apparatus for generating e-book typesetting style codes, and acquires an e-book file of an e-book through an acquisition module, wherein the e-book file includes a code file of a standard typesetting style of the e-book; a determination module determines a first typesetting style of the e-book on a browser based on the code file; a first modification module modifies a code corresponding to a difference part style in the code file based on a difference between the first typesetting style and the standard typesetting style, so that the typesetting style of the e-book on the browser is the same as the standard typesetting style, and a target code corresponding to the difference part style is obtained; a storage module is used to associate and store the target code with the difference part style, so that the typesetting style displayed by the browser based on the target code of the e-book is the same as the typesetting style in the manufacturer's e-book reading application, thereby improving the user's reading experience.

[0106] Optionally, the determination module 302 includes:

[0107] The first loading submodule is used to load the code file into the browser and obtain the typesetting tree corresponding to the code file on the browser;

[0108] The first determination submodule is used to determine the first layout style of the electronic book on the browser based on the layout tree.

[0109] Optionally, the determination module 302 includes:

[0110] The second loading submodule is used to load the code file into the browser so that the browser displays the first typesetting style based on the code file.

[0111] Optionally, the modification module 303 includes:

[0112] A second determination submodule is used to determine the position of the difference part style in the typesetting tree based on the mapping relationship between the first typesetting style and the typesetting tree of the browser;

[0113] The third determination submodule is used to determine the code corresponding to the difference part style in the code file based on the mapping relationship between the typesetting tree and the code;

[0114] The modification submodule is used to modify the code corresponding to the difference part style in the code file to obtain the target code corresponding to the difference part style.

[0115] Optionally, the electronic book typesetting style code generating device 300 includes:

[0116] A receiving module, used to receive a reading request sent by an electronic device equipped with a browser, wherein the reading request includes an identifier of the electronic book and an identifier of the browser;

[0117] A first search module, used for searching for a first electronic book file corresponding to the electronic book identifier based on the electronic book identifier;

[0118] A second search module is used for searching and obtaining a difference part style in the standard typesetting style and a target code corresponding to the difference part style based on the identifier of the browser in response to the standard typesetting style of the first electronic book file;

[0119] A second modification module is used to modify the code of the different part style in the first electronic book file based on the target code to obtain a second electronic book file;

[0120] The sending module is used to send the second electronic book file to the electronic device so that the browser in the electronic device displays the standard typesetting style of the electronic book.

[0121] The embodiments of the present disclosure also provide a computer device, which includes a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method of any of the above embodiments can be implemented, and its execution method and beneficial effects are similar and will not be repeated here.

[0122] An embodiment of the present disclosure provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any of the above embodiments can be implemented. The execution method and beneficial effects are similar and will not be repeated here.

[0123] The above-mentioned computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0124] The computer program may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the disclosed embodiments, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0125] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating an electronic book typesetting style code, characterized in that: include: Obtaining an electronic book file of an electronic book, wherein the electronic book file includes a code file of a standard typesetting style of the electronic book; Determine a first typesetting style of the electronic book on the browser based on the code file; Based on the difference between the first typesetting style and the standard typesetting style, modify the code corresponding to the difference part style in the code file so that the typesetting style of the electronic book on the browser is the same as the standard typesetting style, and obtain the target code corresponding to the difference part style; The target code and the difference portion style are stored in association.

2. The method according to claim 1, characterized in that The determining the first typesetting style of the electronic book on the browser based on the code file comprises: Loading the code file to the browser to obtain a layout tree corresponding to the code file on the browser; Based on the layout tree, a first layout style of the electronic book on the browser is determined.

3. The method according to claim 1, characterized in that The determining the first typesetting style of the electronic book on the browser based on the code file comprises: The code file is loaded onto the browser, so that the browser displays a first layout style based on the code file.

4. The method according to any one of claims 1 to 3, characterized in that The method of modifying the code corresponding to the difference part style in the code file based on the difference between the first typesetting style and the standard typesetting style, so that the typesetting style of the electronic book on the browser is the same as the standard typesetting style, and obtaining the target code corresponding to the difference part style includes: Based on the mapping relationship between the first typesetting style and the typesetting tree of the browser, determining the position of the different partial style in the typesetting tree; Based on the mapping relationship between the typesetting tree and the code, determine the code corresponding to the style of the difference part in the code file; The code corresponding to the difference part style in the code file is modified to obtain the target code corresponding to the difference part style.

5. The method according to claim 1, characterized in that After the target code and the difference portion pattern are stored in association, the method includes: Receiving a reading request sent by an electronic device equipped with the browser, wherein the reading request includes an identifier of the electronic book and an identifier of the browser; Based on the identifier of the electronic book, searching for a first electronic book file corresponding to the identifier of the electronic book; In response to the standard typesetting style of the first electronic book file, based on the identifier of the browser, searching for a different part style in the standard typesetting style and a target code corresponding to the different part style; Based on the target code, modify the code of the style of the difference part in the first electronic book file to obtain a second electronic book file; The second electronic book file is sent to the electronic device so that the browser in the electronic device displays the standard typesetting style of the electronic book.

6. An electronic book typesetting style code generation device, characterized in that: include: An acquisition module, used for acquiring an electronic book file of an electronic book, wherein the electronic book file includes a code file of a standard typesetting style of the electronic book; A determination module, used for determining a first typesetting style of the electronic book on a browser based on the code file; A first modification module is used to modify the code corresponding to the difference part style in the code file based on the difference between the first typesetting style and the standard typesetting style, so that the typesetting style of the electronic book on the browser is the same as the standard typesetting style, and obtain the target code corresponding to the difference part style; A storage module is used to associate and store the target code and the difference part style.

7. The device according to claim 6, characterized in that The determination module comprises: A first loading submodule, used for loading the code file into the browser to obtain a layout tree corresponding to the code file on the browser; The first determination submodule is used to determine a first layout style of the electronic book on the browser based on the layout tree.

8. The device according to claim 6, characterized in that The determination module comprises: The second loading submodule is used to load the code file into the browser so that the browser displays a first typesetting style based on the code file.

9. The device according to any one of claims 6 to 8, characterized in that The modification module comprises: A second determination submodule is used to determine the position of the difference partial style in the typesetting tree based on the mapping relationship between the first typesetting style and the typesetting tree of the browser; A third determination submodule is used to determine the code corresponding to the style of the difference part in the code file based on the mapping relationship between the typesetting tree and the code; The modification submodule is used to modify the code corresponding to the difference part style in the code file to obtain the target code corresponding to the difference part style.

10. The device according to claim 6, characterized in that The device also includes: A receiving module, configured to receive a reading request sent by an electronic device equipped with the browser, wherein the reading request includes an identifier of the electronic book and an identifier of the browser; A first search module, configured to search for a first electronic book file corresponding to the electronic book identifier based on the electronic book identifier; A second search module is used for searching for a difference part style in the standard typesetting style and a target code corresponding to the difference part style based on the identifier of the browser in response to the standard typesetting style of the first electronic book file; A second modification module, configured to modify the code of the style of the difference portion in the first electronic book file based on the target code to obtain a second electronic book file; The sending module is used to send the second electronic book file to the electronic device so that the browser in the electronic device displays the standard typesetting style of the electronic book.

11. A computer device, characterized in that: include: A memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the method for generating an electronic book typesetting style code as described in any one of claims 1 to 5 is implemented.

12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the method for generating an electronic book typesetting style code according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method for converting webpage into electronic book, electronic equipment and storage medium

    CN109558123A

  • Method and device for generating electronic publication file

    CN113505567A