Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In order to solve the problems mentioned in the background art, in the embodiment of the application, when the content of the electronic document is to be rearranged, the content of the electronic document does not need to be directly modified, but the content of the electronic document can be extracted from the electronic document, and the extracted content of the electronic document is rearranged and displayed. The following is a detailed description.
Fig. 1 is a process of a method for displaying electronic document contents according to an embodiment of the present application, where an execution subject of the process may be a terminal or a server. The terminal includes but is not limited to: personal computers, cell phones, tablet computers, smart watches, vehicle-mounted mobile stations, and the like; the server includes but is not limited to: personal computers, mid-and large-sized computers, computer clusters, and the like. The execution subject is not limited to the present application, and for convenience of description, the execution subject is exemplified as the terminal in each embodiment corresponding to fig. 1.
In the embodiment of the present application, the process may be performed for one electronic document, and in this case, by performing the process, the content in the electronic document may be rearranged and displayed; the process may also be performed for a plurality of electronic documents, in which case by performing the process, the content in the plurality of electronic documents may be re-arranged together, i.e. may be mixed.
The process may specifically comprise the steps of:
s101: acquiring arrangement information generated in advance according to the electronic document, wherein the arrangement information comprises an index of the content of the electronic document and a new arrangement sequence different from the original arrangement sequence of the content of the electronic document.
In the embodiment of the present application, the electronic document may be an electronic book, a web page in various formats, and documents in DOC, PPT, TXT, and other formats. The format of the electronic document is not limited in the embodiment of the present application.
In the embodiment of the present application, the content of the electronic document may be a part of or the whole content in the electronic document. The electronic document content has an original arrangement order, which may be a reading order of the electronic document content recommended to the user by default. The original arrangement sequence is described by taking an electronic book and a webpage as examples respectively.
For example, for e-book content, one original sort order may be: the electronic book comprises a front cover, a front introduction, a catalog, a text (containing a plurality of chapters with correct logic sequence), a back sequence, a back cover and the like which are connected in sequence; another original arrangement sequence may be a sequential connection relationship of a plurality of sentence contents or a plurality of paragraph contents in the electronic book with correct logic sequence; and so on.
For another example, for web page content, one original arrangement order may be: according to the layout of the web page, the correct positions of the elements of the web page in the web page and the association relationship among the positions.
In the embodiment of the present application, the layout information may include information (e.g., the index) describing the content of the electronic document to be rearranged, and at least one layout order different from the original layout order of the content of the electronic document, that is, the new layout order. The terminal can extract the contents of the electronic document according to the arrangement information, and rearrange and display the extracted contents of the electronic document without modifying the electronic document.
The arrangement information may be generated by the terminal, or may be generated by any device other than the terminal. The generated arrangement information can be stored on local equipment, and also can be stored on remote equipment such as a server, a cloud storage device and the like, so as to be conveniently acquired by a terminal.
S102: and acquiring the electronic document content corresponding to the index according to the index contained in the arrangement information.
In the embodiment of the present application, the layout information may generally include a plurality of indexes. Each index may be used to describe and index a portion of content in an electronic document (i.e., the content of the electronic document to be rearranged), which may be a chapter, or a paragraph, or an element of a web page, etc. Further, each index may include at least a path of the content corresponding to the index, and may include, among other things, a name of the content, a profile of the content, other identifiers, and so on.
For example, in a practical application scenario, the index corresponding to the cover content of a certain electronic book can be represented by the following Extensible Markup Language (XML) code:
in this example, the index contains the name "cover" of the cover content, and the path "mythical-man-month" src ═ coverage. The terminal may obtain the content of the electronic document corresponding to the index, that is, the content included in the webpage named "coverpage.
In practical application, if the electronic document is stored locally, the terminal can directly acquire the electronic document content corresponding to each index from the electronic document, so that the acquisition speed can be increased, and the network flow consumption can be reduced; otherwise, the terminal may obtain the electronic document content corresponding to each index from a remote device (e.g., a download server of the electronic document), which is highly flexible.
S103: and arranging and displaying the obtained electronic document content according to the new arrangement sequence contained in the arrangement information.
In this embodiment of the application, the new arrangement order included in the arrangement information may specifically be: at least one sort order different from the original sort order.
Generally, since indexes correspond to electronic document contents, the indexes may be sequentially arranged such that the sequence of the electronic document contents corresponding to the arranged indexes is different from the original arrangement sequence, and the arranged sequence of the indexes or the sequence of the electronic document contents corresponding to the arranged indexes may be used as a new arrangement sequence. In this case, similarly to the above example, the resetting of the new sort order can also be expressed in XML code.
It should be noted that, in the embodiment of the present application, the representation manner of the layout information is not limited, and the layout information may be represented by information in other formats such as JSON character strings, besides XML codes.
In the embodiment of the present application, for the rearranged electronic document content, the terminal may store the rearranged electronic document content in the cache only for the display of this time, or store the rearranged electronic document content locally as a new electronic document, so as to be used repeatedly.
By the method, the electronic document content to be rearranged can be obtained from the electronic document according to the pre-generated arrangement information, and the obtained electronic document content can be rearranged and displayed, so that the electronic document can be displayed not only in the original arrangement sequence in the existing mode, but also in the new arrangement sequence, and the problems in the background art are solved.
To facilitate understanding, the steps in fig. 1 are further described below.
In this embodiment of the application, for step S101, the terminal or any other designated device may generate the layout information in advance according to the following method: acquiring the content of the electronic document according to the electronic document; dividing the obtained electronic document content into at least two content blocks to be arranged by adopting at least one content dividing mode; and generating the arrangement information according to each divided content block to be arranged and a specified arrangement rule, wherein the arrangement information comprises an index of the content of the electronic document and a new arrangement sequence different from the original arrangement sequence of the content of the electronic document.
The layout rule may be specified by a user, may be specified by a producer of the electronic document, may be automatically generated by generating layout information according to a predetermined set logic, and the like. The editing rule may reflect how to re-edit the content of the electronic document, and is still described by taking the electronic book and the web page as examples.
For example, for an electronic book, a specified certain orchestration rule may indicate the following: adjusting the subsequent order of the ebook to immediately follow the preamble, and removing the content of the third chapter and the fourth chapter.
For another example, for a web page, a specified certain orchestration rule may indicate the following: and (3) centrally covering the webpage elements corresponding to the LOGO (LOGO) in the webpage on the webpage elements applied by the specified Banner (Banner) pair, and adjusting certain three webpage elements which are adjacent in the transverse direction into the longitudinal direction.
It should be noted that, for convenience of description, the layout rule is described in natural language in the above example, in practical applications, the layout rule may have a specified representation format and may be described in a specified programming language, and the representation format and the description manner adopted in the embodiment of the present application are not limited.
Further, the content division method includes, but is not limited to, the following two methods, which are described below:
first, the content is divided according to a preset association relationship inside the content. For example, if a certain number of sentences are organized in a logical order to form a paragraph, the logical order of the several sentences may be a preset association relationship, and if a certain number of paragraphs are organized in a logical order to form a chapter, the logical order of the several paragraphs may also be a preset association relationship, and so on.
Based on the first way, the electronic book can be divided into chapters, paragraphs, and even sentences; the web page can be divided according to the web page elements; and so on. Because the original logic sequence relation of the contents of the electronic document is considered in the dividing mode, the contents to be arranged are not divided randomly, each divided content to be arranged can be a piece of content which is relatively independent and complete and has higher readability, and therefore user experience can be improved.
Second, the content is divided according to a preset content granularity. Here, the content granularity may refer to a data size of the content to be divided, a size of a display area occupied by the content to be divided when displayed, or the like.
In practical application, the data amount may be represented by the number of bytes, and based on the second manner, the electronic book may be divided according to the number of bytes, and each divided content to be programmed may include the specified number of bytes; the web page can also be divided according to the size of the web page area, and each divided content to be programmed comprises each web page element contained in the corresponding web page area with the specified size. The division mode is more suitable for the task of averagely dividing a plurality of devices in the distributed environment, and can improve the load balance degree in the distributed environment in the application scene of parallel processing of the electronic document.
In addition to the two manners exemplified above, there may be other content division manners. In practical application, a content division mode more suitable for the current scene can be selected according to the current scene.
In the present application embodiment, for the above-mentioned steps: and generating the arrangement information according to each divided content block to be arranged and the appointed arrangement rule. The step may specifically include: respectively establishing corresponding indexes for each divided content block to be edited, and taking each established index as the index of the content of the electronic document; generating a new arrangement sequence which is different from the original arrangement sequence of the electronic document contents and is used for arranging the content blocks to be arranged corresponding to the indexes according to the appointed arrangement rule; and taking the index of the electronic document content and the new arrangement sequence as the generated arrangement information. For convenience of understanding, a piece of layout information generated for two electronic books in practical application is described, where the names of the two electronic books are: mythical-man-month, and refactoring. The layout information is still represented in XML code as follows:
in the above codes, the dependencides tag describes the two electronic books on which the arrangement information depends, the navMap tag describes the generated indexes, and the order of rearranging the electronic book contents is based on the indexes. The electronic book content is divided by the first method, and each divided content block to be arranged sequentially comprises the following steps according to the original arrangement sequence: cover (coverpage) of "human myth", chapter1 (chapter1) of "human myth", chapter2 (chapter2) of "human myth", and chapter8 (chapter8) of "reconstruction". Note that, here, not all the contents in the electronic book are used, but only a part of the contents are used.
According to the arrangement information, based on each index, the sequence of each content block to be rearranged is: cover of "ren Yue Shen Jie", Chapter2 of "ren Yue Shen Jie", Chapter1 of "ren Yue Shen Jie", and Chapter8 of "restructuring".
Further, as to step S103, editing and displaying the obtained electronic document content according to the new editing sequence included in the editing information, specifically, the editing may include: and arranging and displaying the content blocks to be arranged corresponding to the indexes according to the new arrangement sequence contained in the arrangement information.
Continuing with the above example, the terminal can acquire the layout information by executing steps S101 to S102, and acquire the front cover and the chapter contents described above based on the indexes included in the layout information. Furthermore, the terminal may rearrange the acquired e-book content according to the new arrangement order. Further explanation is provided with reference to fig. 2 and 3.
Fig. 2 is a schematic diagram illustrating contents of the two electronic books respectively displayed on a display screen.
Fig. 3 is a schematic diagram illustrating the two electronic book contents displayed on the display screen after being rearranged.
The e-book contents shown in fig. 2 are displayed according to the original arrangement sequence, and the e-book contents shown in fig. 3 are displayed after the partial contents in the two e-books are adjusted in sequence and mixed.
It should be noted that, in practical applications, any content block to be laid out (i.e. any front cover or any chapter) included in fig. 2 and fig. 3 may not be displayed on a display screen completely on a single screen, and in order to facilitate understanding of the sequence between the contents of each block, the contents of each block are represented in a thumbnail manner and displayed on the single screen, and the actual display effect is not completely reflected. The higher the position within the single screen, the higher the order of arrangement of the contents in fig. 2 and 3.
Based on the same idea, the electronic document content display method provided by the embodiment of the present application further provides an electronic document content processing method, that is, a method for generating layout information.
Fig. 4 is a process of an electronic document content processing method provided by an embodiment of the present application, and an execution subject of the process may be a terminal or any other device (e.g., a server). The execution subject is not limited to the present application, and for convenience of description, the embodiment corresponding to fig. 4 is described by taking the example that the execution subject is a server. The process may specifically comprise the steps of:
s401: and acquiring the content of the electronic document according to the electronic document.
S402: generating layout information according to the electronic document content, wherein the layout information comprises an index of the electronic document content and a new layout sequence different from the original layout sequence of the electronic document content.
S403: and storing the arrangement information so that a designated device can acquire the arrangement information, acquiring the electronic document content corresponding to the index according to the index contained in the arrangement information, and arranging and displaying the acquired electronic document content according to the new arrangement sequence contained in the arrangement information.
By the method, the server can generate one or more arrangement information respectively corresponding to different reading habits for the electronic document according to the reading habits of different users for rearranging the content of the electronic document, so that the convenience and the flexibility of displaying the content of the electronic document by the terminal for the user can be improved.
The problems that can be solved by the method for displaying and processing the electronic document content provided by the embodiment of the application are not limited to the problems mentioned in the background technology. Taking an electronic book as an example, by the method, because the layout file can be used for replacing a new version for repackaging and releasing the modified electronic document, compared with the new version, the data volume of the layout file and the occupied storage space are much smaller, therefore, the repackaging and releasing cost problem brought by modifying the electronic book can be reduced, the resource consumption in packing, releasing, storing and other aspects brought by maintaining a plurality of versions can be reduced, the copyright problem brought by deleting or sequentially adjusting the content of the electronic book can be avoided, the flexible layout capability can be provided, the reading sequence can be adjusted according to the reading user and the scene, the user can also read the content layout according to the preference of the user, and the like.
For convenience of understanding, an electronic book is still taken as an example below, and a specific implementation process of the method provided in the embodiment of the present application is simply organized in an actual application scenario, assuming that the method corresponding to fig. 4 is implemented by an electronic book download server, and the method corresponding to fig. 1 is implemented by a smartphone. The specific implementation process is as shown in fig. 5 and fig. 6.
FIG. 5 shows steps performed by the electronic book download server, including the following:
s501: and acquiring the electronic book.
S502: according to the electronic book, editing and generating layout information by adopting a specified editing tool so as to be used for rearranging partial content or all content in the electronic book.
S503: and storing the arrangement information in a cloud or other storage media so as to be conveniently acquired by other equipment.
Fig. 6 shows the steps performed by the smartphone, including the following:
s601: the electronic book reading application is started.
S602: through the application, the arrangement information is downloaded.
S603: and acquiring the content of the electronic book according to the arrangement information.
S604: and rearranging the acquired electronic book content according to the arrangement information.
S605: the application renders and displays the re-arranged e-book content.
Based on the same idea, the electronic document content display and processing method provided in the embodiment of the present application further provides a corresponding electronic document content display and processing device, as shown in fig. 7 and 8.
Fig. 7 is a schematic structural diagram of an electronic document content display device provided in an embodiment of the present application, which specifically includes:
a first obtaining module 701, configured to obtain layout information generated in advance according to the electronic document, where the layout information includes an index of the content of the electronic document and a new layout sequence different from an original layout sequence of the content of the electronic document;
a second obtaining module 702, configured to obtain, according to the index included in the layout information obtained by the first obtaining module 701, an electronic document content corresponding to the index;
the layout displaying module 703 is configured to layout and display the acquired electronic document content according to the new layout sequence included in the layout information acquired by the first acquiring module 701.
By the device, the electronic document content to be rearranged can be acquired from the electronic document according to the pre-generated arrangement information, and the acquired electronic document content can be rearranged and displayed.
The apparatus may further include:
a generating module 704, configured to obtain the content of the electronic document according to the electronic document; dividing the obtained electronic document content into at least two content blocks to be arranged by adopting at least one content dividing mode; and generating the arrangement information according to each divided content block to be arranged and a specified arrangement rule, wherein the arrangement information comprises an index of the content of the electronic document and a new arrangement sequence different from the original arrangement sequence of the content of the electronic document.
It should be noted that the generating module 704 may also be included in the apparatus, but may be included in any other apparatus, in which case the first obtaining module 701 may need to establish a remote network connection with the generating module 704 to be able to obtain the schedule information.
The content division manner may include: dividing the content according to a preset incidence relation in the content, or dividing the content according to a preset content granularity, wherein the content granularity refers to the data size of the content to be divided; and so on.
The generating module 704 is specifically configured to: respectively establishing corresponding indexes for each divided content block to be edited, and taking each established index as the index of the content of the electronic document; generating a new arrangement sequence which is different from the original arrangement sequence of the electronic document contents and is used for arranging the content blocks to be arranged corresponding to the indexes according to the appointed arrangement rule; and taking the index of the electronic document content and the new arrangement sequence as the generated arrangement information.
The layout display module 703 is specifically configured to: and arranging and displaying the content blocks to be arranged corresponding to the indexes according to the new arrangement sequence contained in the arrangement information.
The specific device shown in fig. 7 may be located on a terminal or a server.
Fig. 8 is a schematic structural diagram of an electronic document content display device provided in an embodiment of the present application, which specifically includes:
an obtaining module 801, configured to obtain content of the electronic document according to the electronic document;
a generating module 802, configured to generate layout information according to the electronic document content acquired by the acquiring module 801, where the layout information includes an index of the electronic document content and a new layout sequence different from an original layout sequence of the electronic document content;
a saving module 803, configured to save the layout information generated by the generating module 802, so that a designated device can obtain the layout information, obtain the electronic document content corresponding to the index according to the index included in the layout information, and arrange and display the obtained electronic document content according to the new layout sequence included in the layout information.
By the device, aiming at the electronic document, the server can generate one or more arrangement information respectively corresponding to different reading habits for the electronic document according to the reading habits of different users, and the arrangement information is used for rearranging the content of the electronic document, so that the convenience and the flexibility of displaying the content of the electronic document by the terminal for the user can be improved.
The specific device shown in fig. 8 may be located on a terminal or a server.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.