CN106951270B - Code processing method, system and server - Google Patents

Code processing method, system and server Download PDF

Info

Publication number
CN106951270B
CN106951270B CN201710220120.6A CN201710220120A CN106951270B CN 106951270 B CN106951270 B CN 106951270B CN 201710220120 A CN201710220120 A CN 201710220120A CN 106951270 B CN106951270 B CN 106951270B
Authority
CN
China
Prior art keywords
code
client
server
editor
format
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
CN201710220120.6A
Other languages
Chinese (zh)
Other versions
CN106951270A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201710220120.6A priority Critical patent/CN106951270B/en
Publication of CN106951270A publication Critical patent/CN106951270A/en
Application granted granted Critical
Publication of CN106951270B publication Critical patent/CN106951270B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/52Binary to binary

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a code processing method, a code processing system and a code processing server, which are applied to a system comprising a first client used by a sharer, a second client used by a user and the server. In the embodiment of the invention, a first client acquires a first code of a sharer; the first client sends the first code to the server; the server determines a corresponding second format according to the first format adopted by the first code, and performs format conversion on the first code based on the second format to obtain a second code; the server sends the second code to the second client; the second client outputs the second code. The technical scheme provided by the embodiment of the invention is used for solving the problem that codes cannot be repeatedly utilized among multiple users in the prior art.

Description

Code processing method, system and server
[ technical field ] A method for producing a semiconductor device
The present invention relates to the field of computer technologies, and in particular, to a code processing method, system, and server.
[ background of the invention ]
Open source toolkits for front-end development, such as Bootstrap, frozenUI and the like, are all third-party code open source libraries, and a user can obtain needed codes from the open source toolkits according to requirements in a project development process, and the obtained codes can be directly used or can be rewritten according to requirements.
However, in the prior art, different users respectively rewrite the codes acquired from the third-party code open source library, and the rewritten codes of different users have certain universality, but the rewritten codes cannot be reused among multiple users at present, so that the waste of the codes is caused.
[ summary of the invention ]
In view of this, embodiments of the present invention provide a code processing method, system and server, so as to solve the problem in the prior art that codes cannot be reused among multiple users.
In one aspect, an embodiment of the present invention provides a code processing method, applied to a system including a first client used by a sharer, a second client used by a user, and a server, including:
the first client acquires a first code of a sharer;
the first client sends the first code to the server;
the server determines a corresponding second format according to the first format adopted by the first code, and performs format conversion on the first code based on the second format to obtain a second code;
the server sends the second code to the second client;
the second client outputs the second code.
The above-described aspect and any possible implementation manner further provide an implementation manner, where the second client is a browser;
before the server sends the second code to the second client, the method further includes: the browser sends a data request aiming at the second code to the server in response to the request of the first user; the server responds to the data request and obtains a page template;
the server sending the second code to the second client, including: the server sends the second code and the page template to the browser;
the second client outputs the second code, including: and the browser displays a specified page according to the second code and the page template.
The above-described aspect and any possible implementation further provide an implementation, where the content of the designated page includes: and at least one of the second code and a rendered display interface of the second code.
The above-mentioned aspect and any possible implementation manner further provide an implementation manner, before the second client presents the specified page according to the second code and the page template, the method further includes: the server sends the first code to the browser;
the content of the specified page comprises:
at least one of the second code and a rendered display interface of the second code; and the number of the first and second groups,
the first code.
The above-described aspects and any possible implementations further provide an implementation, and the method further includes: the first client sends the first code to the server and simultaneously sends a configuration file to the server, wherein the configuration file comprises at least one of the name of the second code and the component category of the second code;
the server acquiring the page template comprises the following steps: and the server acquires the page template according to at least one of the name of the second code and the component category of the second code.
The above-described aspect and any possible implementation further provides an implementation, where the second client is an editor used by a user; before the server sends the second code to the second client, the method further includes:
the editor receives keywords input by a user and sends the keywords to the server;
the server acquires a second code matched with the keyword;
the server sends the name of each second code in the second codes matched with the keyword to the editor;
the editor displays the names of the second codes matched with the keywords;
the editor responds to the name of a second code selected by a user according to the name of each second code in the second codes matched with the keyword, and sends a downloading request of the second code to the server;
the server sending the second code to the second client, including: the server sends the second code to the editor in response to the download request.
The above-described aspects and any possible implementations further provide an implementation, and the method further includes: the server sends the second code to the editor, and simultaneously sends the first code corresponding to the second code to the editor;
the second client outputs the second code, including: the editor presents the second code and the first code.
The above-mentioned aspects and any possible implementation further provide an implementation, where the second client is an editor used by a user; before the second client outputs the second code, the method further includes:
the editor receives keywords input by a user and acquires second codes matched with the keywords;
the editor displays the name of each second code in the second codes matched with the keyword;
the second client outputs the second code, including: and the editor responds to the name of the second code selected by the user according to the name of each second code in the second codes matched with the keyword, and displays the second code.
The above-described aspects and any possible implementations further provide an implementation, and the method further includes:
the server sends the second code to the editor and simultaneously sends a first code corresponding to the second code to the editor;
and the editor simultaneously presents the first code in the page presenting the second code.
The above aspect and any possible implementation manner further provide an implementation manner, where performing format conversion on the first code based on the second format to obtain a second code includes:
the server extracts the respective data of each field from the first code in the first format;
and the server stores the extracted data of each field in a second format to obtain a second code.
In another aspect, an embodiment of the present invention provides a code processing method, executed in a server, including:
receiving a first code of a sharer sent by a first client;
determining a corresponding second format according to the first format adopted by the first code, and performing format conversion on the first code based on the second format to obtain a second code;
and sending the second code to a second client so as to facilitate the second client to output the second code.
In one embodiment, the second client is a browser;
before sending the second code to the second client, the method further includes: receiving a data request for the second code sent by the browser in response to a request of a first user; responding to the data request, and acquiring a page template;
sending the second code to the second client, including: and sending the second code and the page template to the browser.
The above-described aspect and any possible implementation further provides an implementation, where the second client is an editor used by a user; before sending the second code to the second client, the method further includes:
receiving keywords input by a user and sent by the editor;
acquiring a second code matched with the keyword;
sending the name of each second code in the second codes matched with the keyword to the editor so that the editor can display the name of each second code in the second codes matched with the keyword;
receiving a downloading request of the second codes sent to the server by the editor in response to the names of the second codes selected by the user according to the names of the second codes in the second codes matched with the keywords;
sending the second code to the second client, including: sending the second code to the editor in response to the download request.
In another aspect, an embodiment of the present invention provides a code processing system, including: the system comprises a first client used by a sharer, a second client used by a user and a server;
the first client is used for acquiring a first code of a sharer;
the first client is further used for sending the first code to the server;
the server is used for determining a corresponding second format according to the first format adopted by the first code and performing format conversion on the first code based on the second format to obtain a second code;
the server is further used for sending the second code to the second client;
the second client is used for outputting the second code.
In another aspect, an embodiment of the present invention provides a server, including:
the receiving unit is used for receiving a first code of a sharer sent by a first client;
the processing unit is used for determining a corresponding second format according to the first format adopted by the first code and performing format conversion on the first code based on the second format to obtain a second code;
and the sending unit is used for sending the second code to a second client so that the second client can output the second code conveniently.
One of the above technical solutions has the following beneficial effects:
in the technical scheme provided by the embodiment of the invention, the sharer obtains the second code after format conversion through the first code provided by the first client, and the second code can be further provided for the second client used by the user by the server, so that the user can obtain the second code. The code can be shared among multiple users, so that the code is recycled, and the waste of the code is avoided. In practical application, for example, when a plurality of developers develop projects, the developers can share codes with each other, a code library provided by a third party is not passively used any more, code precipitation and accumulation are realized, and development efficiency is improved to a certain extent.
In addition, in the embodiment of the invention, the idea of modular shared codes is used, a large number of modular codes can be reused and shared, other users can rewrite the modular shared codes on the basis, and the development efficiency is improved to a certain extent. Compared with the mode of using a third-party code library, development time can be saved by more than 30% by using shared codes. Moreover, after the shared code is shared for multiple times and rewritten for multiple times, the reliability of the code is continuously improved, so that the probability of the abnormal operation of the code is reduced, and the code quality is higher and higher as the time is longer.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a diagram illustrating an exemplary system to which a code processing method according to an embodiment of the present invention is applied;
FIG. 2 is a schematic diagram illustrating an interaction flow of a code processing method according to an embodiment of the present invention;
FIG. 3 is an exemplary diagram of format conversion of a first code provided by an embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating another interaction flow of a code processing method according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating an example of a second code being presented by a browser used by a user according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating another example of a second code being presented by a browser used by a user according to an embodiment of the present invention;
FIG. 7 is a schematic diagram illustrating another interaction flow of a code processing method according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating an example of an editor interface provided by an embodiment of the invention;
FIG. 9 is a schematic diagram illustrating another interaction flow of a code processing method according to an embodiment of the present invention;
FIG. 10 is a flow chart of a code processing method provided by an embodiment of the invention on a use side;
FIG. 11 is a flow chart of a code processing method on a server side according to an embodiment of the present invention;
FIG. 12 is a block diagram of a code processing system according to an embodiment of the present invention;
fig. 13 is a functional block diagram of a server according to an embodiment of the present invention.
[ detailed description ] A
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all 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 invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
It should be understood that although the terms first, second, etc. may be used to describe clients in embodiments of the present invention, these clients should not be limited by these terms. These terms are only used to distinguish clients from each other. For example, a first client may also be referred to as a second client, and similarly, a second client may also be referred to as a first client, without departing from the scope of embodiments of the present invention.
The word "if" as used herein may be interpreted as "at 8230; \8230;" or "when 8230; \8230;" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
Aiming at the problem of code waste caused by the fact that codes cannot be repeatedly utilized among multiple users in the prior art, the embodiment of the invention provides a corresponding solution idea: the sharer uploads the code to the server by using the client, and the server processes the code and then further provides the code to other clients, so that the code is shared among multiple users, the aim of recycling is fulfilled, code waste is avoided, and code development efficiency is improved.
Please refer to fig. 1, which is a diagram illustrating an exemplary system to which the code processing method according to the embodiment of the present invention is applied, and as shown in fig. 1, the embodiment of the present invention may be applied to a system including a first client used by a sharer, a second client used by a user, and a server, where the server may be integrated on a network side.
Referring to fig. 2, it is a schematic view of an interaction flow of the code processing method according to the embodiment of the present invention, and as shown in the figure, the method includes the following steps:
201. the first client acquires a first code of the sharer.
In a feasible implementation scheme, when a sharer wants to share a code (referred to as a first code in an embodiment of the present invention) to another user, the first code may be directly input on a used client (referred to as a first client in an embodiment of the present invention), or a code file including the first code is uploaded to the used client, so that the first client may receive the first code input by the user, or may further extract the code from the code file after receiving the code file, thereby implementing acquisition of the first code of the sharer.
In addition, the sharer can also upload the configuration file, so that the first client can also obtain the configuration file. The configuration file may include at least one of a name of the first code converted code (referred to as a second code in the embodiment of the present invention) and a component category of the first code converted code (referred to as a second code in the embodiment of the present invention). It should be noted that if the name is named using a component type, the configuration file may not include the component type, or if the name is not named using a component type, the configuration file needs to include the component type. For example, component categories may include: an Input box (Input), a Button (Button), a List (List), and the like, which are not particularly limited in the embodiments of the present invention.
In an embodiment of the present invention, the first code of the sharer may be a code in any one of the following formats: java language based Agent Development Framework (JADE), syntax stacking styles sheet (SCSS), or script (JavaScript, JS).
In this embodiment of the present invention, the first code may be a single line of codes, or may also be multiple lines of codes, which is not particularly limited in this embodiment of the present invention.
202. And the first client sends the first code to the server.
The first client sends the first code of the sharer to the server, and if the first client also obtains the configuration file, the configuration file also needs to be sent to the server. The configuration file and the first code may be sent together, or may be sent separately, which is not particularly limited in this embodiment of the present invention.
203. The server determines a corresponding second format according to the first format adopted by the first code, and performs format conversion on the first code based on the second format to obtain a second code.
In a particular implementation, the server extracts the respective data of each field from a first code in a first format; then determining a second format according to the first format; and the server stores the extracted data of each field in a second format to obtain a second code.
In one possible implementation, the first format employed by the first code may be determined from a filename suffix of a code file containing the first code.
In a possible implementation, a mapping relationship between the first format and the second format may be established in advance, so that the corresponding second format may be determined according to the first format adopted by the first code. Referring to fig. 3, which is an exemplary diagram of format conversion performed on a first code according to an embodiment of the present invention, as shown in fig. 3, for example, if the first code adopts a JADE format, the second format may be a hypertext Markup Language (HTML) format, and respective data of each field in the first code is stored in the HTML format to obtain the second code. Or, for another example, if the first code adopts the SCSS format, the second format may be a Cascading Style Sheets (CSS) format, and the respective data of each field in the first code is stored in the CSS format to obtain the second code. Alternatively, for example, if the first code is in the JS format, the second format may be in the JS format, and therefore, the first code may be directly used as the second code without being converted, or the second code may be obtained by converting the first code.
It should be noted that, for the first code in the JADE format and the first code in the SCSS format, the browser cannot directly render the first code, and for the codes in the HTML format, the CSS format, and the JSs format, the browser may directly render the first code. Therefore, in the embodiment of the present invention, the first code in the JADE format or the first code in the SCSS format needs to be subjected to format conversion (which may also be referred to as compiling), and the first code and the second code are respectively converted into codes in a format that can be directly rendered by a browser.
Further, after obtaining the second code, the server may store the second code in a local designated file. Alternatively, the server may store both the first code and the corresponding second code in the designated file. In one possible implementation, the specified file may be a file in a text format, such as a TXT format file or a JS format file.
In the embodiment of the present invention, if the server successfully performs the format conversion on the first code, it indicates that the data of the first code is legal, then step 204 is executed, otherwise, if the server fails to perform the format conversion on the first code, it indicates that the data of the first code is illegal, and the current process is ended.
204. The server sends the second code to the second client.
And after the second code is successfully stored locally, the server sends the second code to a second client used by the user. In a specific implementation scheme, the server may actively push the second code to the second client, or the server may send the second code to the second client according to a request sent by the second client.
205. The second client outputs the second code.
The second client can output the second code after receiving the second code from the server, so that a user using the second client can obtain the second code, and the code can be shared between a sharer and the user.
In the technical scheme provided by the embodiment of the invention, the sharer obtains the second code after format conversion through the first code provided by the first client, and the second code can be further provided for the second client used by the user by the server, so that the user can obtain the second code. The code can be shared among multiple users, so that the code is recycled, and the waste of the code is avoided. In practical application, for example, when a plurality of developers develop projects, the developers can share codes with each other, a code library provided by a third party is not passively used any more, code precipitation and accumulation are realized, and development efficiency is improved to a certain extent.
In addition, in the embodiment of the invention, the format of the first code provided by the sharer is converted to obtain the second code, the second code is stored in the designated file, the idea of modular shared code is used, a large number of modular codes can be reused and shared, other users can rewrite the codes on the basis, and the development efficiency is improved to a certain extent. Compared with the mode of using a third-party code library, development time can be saved by more than 30% by using shared codes. Moreover, after the shared code is shared and rewritten for multiple times, the reliability of the code is continuously improved, so that the probability of the abnormal operation of the code is reduced, and the quality of the code is higher and higher as the time is longer.
Based on the code processing method, the embodiment of the invention provides another feasible implementation scheme. With reference to fig. 1, the second client is a browser in this embodiment. Please refer to fig. 4, which is a schematic view of another interaction flow of a code processing method according to an embodiment of the present invention, as shown in fig. 4, including:
401. the first client acquires a first code of the sharer.
The specific implementation of step 401 can refer to the description of step 201.
402. The first client sends the first code to the server.
The specific implementation of step 402 can be referred to the description of step 202.
403. And the server performs format conversion on the first code to obtain a second code.
The specific implementation of step 403 can refer to the description of step 203.
404. The browser sends a data request for the second code to the server in response to the first user's request.
After obtaining the second code, the server may publish the second code through the web page, so that other users (called first users) may view relevant information of the second code, such as a name, a component category, a partial segment of the second code, and the like, when browsing the web page through the browser. If the first user needs to further obtain the detailed information of the second code, the link of the second code can be clicked, which is equivalent to initiating a request for obtaining the second code to the browser, so that the browser can obtain the request of the first user. Alternatively, the first user may input a Uniform Resource Locator (URL) address of the second code in an address input field of the browser, which corresponds to a request for acquiring the second code from the browser, and thus the browser may acquire the request of the first user. Further, the browser sends a data request for the second code, such as a URL request for the second code, to the server in response to the request of the first user.
405. The server responds to the data request and obtains a page template.
After receiving a data request sent by the browser, the server firstly finds a file for storing the second code according to the data request, then extracts the second code from the file, and then obtains a corresponding page template according to the second code.
In a possible implementation, the first client sends the first code to the server and sends the configuration file to the server at the same time, because the configuration file contains at least one of the name of the second code and the component category of the second code; therefore, the server can obtain the page template corresponding to the second code according to at least one of the name of the second code and the component category of the second code.
It can be understood that a corresponding relationship between the component type and the page template may be pre-established, and if the name of the second code is named according to the component type, the page template may be found from the corresponding relationship according to the name of the second code. If the configuration file contains the component type of the second code, the page template can be found from the corresponding relation according to the component type.
406. The server sends the second code and the page template to the browser.
407. And the browser displays the specified page according to the second code and the page template.
And rendering by the browser based on the second code and the page template to display the specified page.
In one possible implementation, the content of the designated page may include at least one of the second code and a rendered display interface of the second code.
Referring to fig. 5, an exemplary diagram of a browser used by a user to display a second code according to an embodiment of the present invention is shown, and as shown in fig. 5, the designated page shown in fig. 5 does not include the second code itself, but only includes a rendered display interface of the second code, that is, button components in different styles. For example, a second code may comprise a plurality of button components, such that the plurality of button components may be rendered to be displayed in the browser. Alternatively, a second code may only contain a code of a button control, so that a button can be presented in the browser after rendering. The embodiments of the present invention are presented herein by way of example only and are not intended to limit the implementation of the second code presented.
Referring to fig. 6, another exemplary view showing the second code for the browser used by the user according to the embodiment of the present invention is shown, as shown in fig. 6, the designated page shown in fig. 6 includes the second code itself, a rendered display interface of the second code, and various component categories that can be provided by the server and respective names of components under each component category.
In another possible implementation, before the browser presents the specified page according to the second code and the page template, the server may also send the first code to the browser, and accordingly, the content of the specified page may include: at least one of the second code and a rendered display interface of the second code; and, a first code.
It can be understood that some users have a need for the original code before format conversion, so the original code before format conversion of the second code, i.e. the first code, can also be sent to the browser, which can then present it. In the embodiment of the present invention, if the first code and the second code are both stored in the specified file, the server may send the specified file and the page template to the browser together.
It may be understood that, for different content of a specified page, page templates of the specified page may be different, one or more page templates may be configured for the page template corresponding to each component type according to different display content, and when a page template corresponding to a component type is obtained, a default page template may be obtained from multiple corresponding page templates, or one page template may also be obtained according to an instruction of a browser, which is not particularly limited in the embodiment of the present invention.
In this embodiment, when the shared second code is provided to the user, a preview service of the second code may be provided to the user through the browser, the second code itself may be displayed, the first code before conversion may also be displayed, a display interface after rendering of the second code may also be displayed, different types of preview modes are provided, and diversified sharing of the code is achieved. The display interface after the second code rendering is displayed can visually enable the user to feel the application style of the second code, and the user can browse and screen conveniently.
Based on the code processing method, the embodiment of the invention also provides another feasible implementation scheme. With reference to fig. 1, the second client is an editor in this embodiment. Please refer to fig. 7, which is a schematic view of another interaction flow of a code processing method according to an embodiment of the present invention, as shown in fig. 7, including:
701. the first client acquires a first code of the sharer.
The specific implementation of step 701 can refer to the description of step 201.
702. The first client sends the first code to the server.
The specific implementation of step 702 can refer to the description of step 202.
703. And the server performs format conversion on the first code to obtain a second code.
The specific implementation of step 703 can refer to the description of step 203.
704. The editor receives a keyword input by a user and transmits the keyword to the server.
It can be understood that, based on the above process, the server may obtain the second codes of multiple sharers, so as to provide a code search and download service to the editor, so that a user using the editor may obtain the second codes of the sharers, thereby implementing code sharing. When a user needs to search a code, a keyword can be input into a search box provided by the editor, so that the editor can receive the keyword input by the user in the search box and then send a search request to the server, wherein the search request carries the keyword.
Please refer to fig. 8, which is an exemplary diagram of an editor interface according to an embodiment of the present invention, and as shown in fig. 8, a user inputs a keyword "ui" in a search box.
705. The server obtains a second code matching the keyword.
In a possible implementation, for the second code stored in the server, an index table may be established, where the index table includes a mapping relationship between the name of the second code and a storage location of the second code. And after receiving the search request sent by the editor, the server responds to the search request and searches in the names of the second codes of the index table according to the keywords carried by the search request so as to acquire the second codes matched with the keywords.
The second code matching the keyword may be obtained by calculating a correlation between the name of the second code and the keyword, and if the correlation is greater than a preset threshold, the name of the second code may be regarded as the second code matching the keyword, whereas if the correlation is less than the preset threshold, the name of the second code may not be regarded as the second code matching the keyword.
706. And the server sends the name of each second code in the second codes matched with the keyword to the editor.
707. The editor presents the names of the second codes matched with the keywords.
And the editor displays the names of the second codes after acquiring the names of the second codes matched with the keywords from the server so as to facilitate browsing and screening by a user.
As shown in fig. 8, names of a plurality of second codes matching the keyword "ui" such as "ui-btn", "ui-list", "ui-slider", "ui-nowrap", "ui-btn-primary", "ui-btn-danger", and "ui-btn-lg" are displayed in the editor, and since the number of names of second codes matching the keyword "ui" is large, the second codes can be slid up and down by a slider in the display frame so as to view all the names of second codes matching the keyword "ui".
708. The editor responds to the name of the second code selected by the user according to the name of each second code in the second codes matched with the keyword, and sends a downloading request of the second code to the server.
In one possible implementation, the user may select, in the editor, the name of each of the second codes matching the keyword, and then click on the name of the selected second code, so that the editor sends a download request for the selected second code to the server in response to the name of the second code selected by the user according to the name of each of the second codes matching the keyword, where the download request may carry the name of the selected second code.
709. The server transmits the second code to the editor in response to the download request.
In a possible implementation scheme, the server receives a download request sent by the editor, queries in the index table according to a name of the second code carried by the server to obtain a storage location of the second code, reads the second code from the storage location, and sends a download response to the editor.
710. The editor outputs the second code.
In one possible implementation, if the editor only obtains the second code from the server, the second code may be presented directly in its code display area so that the user can browse to the second code. Or, if the server sends the second code to the editor, the first code corresponding to the second code may also be sent to the editor, and the editor may present the second code and the first code in its own code display area.
As shown in fig. 8, the user selects the second code named "ui-btn" among several second codes matching the keyword "ui", and thus, the second code named "ui-btn" is displayed in the interface of the editor shown in fig. 8.
In this embodiment, after the server obtains the second code, the server does not push the second code to the editor, but sends the second code to the editor only when receiving a download request from the editor, so that on the basis of realizing code sharing, the local storage space of the editor can be saved, and code downloading can be realized in a targeted manner.
In the embodiment, when the user needs the code, the code can be searched on the editor, so that the needed code can be obtained, and the code can be timely and efficiently obtained.
Based on the code processing method, the embodiment of the invention also provides another feasible implementation scheme. With reference to fig. 1, the second client is an editor in this embodiment. Please refer to fig. 9, which is a schematic view of another interaction flow of a code processing method according to an embodiment of the present invention, as shown in fig. 9, including:
901. the first client acquires a first code of the sharer.
The specific implementation of step 901 can refer to the description of step 201.
902. The first client sends the first code to the server.
The specific implementation of step 902 can refer to the description of step 202.
903. And the server performs format conversion on the first code to obtain a second code.
The specific implementation of step 903 can refer to the description of step 203.
904. The server sends the second code to the editor.
In one possible implementation, the server may send the second code to one or more editors after obtaining the second code. Alternatively, the server may transmit one or more second codes generated in the time interval with the transmission cycle as the time interval according to the transmission cycle of each editor.
905. The editor receives the keywords input by the user and acquires the second codes matched with the keywords.
In a possible implementation, for the second code stored in the editor, an index table may be established, where the index table includes a mapping relationship between the name of the second code and the storage location of the second code. The editor stores each received second code so that the code search and browsing services can be provided directly to the user.
The editor receives the keyword input by the user through the search box, and then searches the name of the second code of the locally established index table according to the keyword so as to acquire the second code matched with the keyword. For example, as shown in fig. 8, the user inputs the keyword "ui" in the search box.
906. The editor presents the names of the second codes matched with the keywords.
And after the editor obtains the names of the second codes in the second codes matched with the keywords, displaying the names of the second codes so as to facilitate browsing and screening by a user.
As shown in fig. 8, names of a plurality of second codes matching the keyword "ui" such as "ui-btn", "ui-list", "ui-slider", "ui-nowrap", "ui-btn-primary", "ui-btn-danger", and "ui-btn-lg" are displayed in the editor, and since the number of names of second codes matching the keyword "ui" is large, the second codes can be slid up and down by a slider in the display frame so as to view all the names of second codes matching the keyword "ui".
907. And the editor responds to the name of the second code selected by the user according to the name of each second code in the second codes matched with the keyword, and displays the second code.
In one possible implementation scheme, the user may select the name of the second code in the editor according to the name of each second code in the second codes matched with the keyword, then click on the name of the selected second code, and the editor responds to the name of the second code selected by the user according to the name of each second code in the second codes matched with the keyword, queries in the index table according to the name of the second code to obtain the storage location of the second code, and then reads the second code from the storage location.
Further, if the editor only stores the second code locally, the editor may present the second code in its own code display area so that the user can browse the second code. Or, if the server sends the second code to the editor and also sends the first code corresponding to the second code to the editor, the editor may present the second code and the first code in its own code display area at the same time.
As shown in fig. 8, the user selects the second code named "ui-btn" among several second codes matching the keyword "ui", and thus, the second code named "ui-btn" is displayed in the interface of the editor shown in fig. 7.
In this embodiment, after the server obtains the second code, the server may actively push the second code to the editor, and the editor provides the user with the required second code according to the user's requirement, so that, on the basis of implementing code sharing, when providing the second code to the user, the editor does not need to interact with the server any more, downloads the second code from the server, but can directly read and output the second code from the local to the user, and therefore, the output efficiency of the second code can be further improved, and the user experience is improved.
Based on the code processing method, the embodiment of the invention also provides another feasible implementation scheme. With reference to fig. 1, the second client is an editor in this embodiment. Please refer to fig. 10, which is a flowchart illustrating a code processing method according to an embodiment of the present invention on a user side, as shown in fig. 10, including:
1001. the user opens the editor.
1002. Jade, a file is created on the device where the editor is located, e.g. index.
1003. The user enters a keyword "ui" in the editor.
1004. The editor outputs a search result matching the keyword "ui" according to the keyword.
1005. The search result includes a name "ui-btn" of the second code, which the user has selected.
1006. Jade, the editor downloads the second code named "ui-btn" from the server and stores it in the file index.
1007. The editor presents the second code.
An embodiment of the present invention further provides a code processing method, where this embodiment is executed in the server, please refer to fig. 11, which is a schematic flow diagram of the code processing method provided in the embodiment of the present invention on the server side, as shown in fig. 11, including:
1101. and receiving a first code of the sharer sent by the first client.
1102. And determining a corresponding second format according to the first format adopted by the first code, and performing format conversion on the first code based on the second format to obtain a second code.
1103. And sending the second code to a second client so as to facilitate the second client to output the second code.
It should be noted that, for a specific implementation scheme of the operation executed by the server in this embodiment, reference may be made to the relevant description in each embodiment described above, and details are not described here again.
The embodiment of the invention further provides an embodiment of a device for realizing the steps and the method in the embodiment of the method.
Please refer to fig. 12, which is a block diagram illustrating a code processing system according to an embodiment of the present invention. As shown, the code processing system includes: a first client 100 used by a sharer, a second client 200 used by a user, and a server 300;
the first client 100 is configured to obtain a first code of a sharer;
the first client 100 is further configured to send the first code to the server 300;
the server 300 is configured to determine a corresponding second format according to the first format adopted by the first code, and perform format conversion on the first code based on the second format to obtain a second code;
the server 300 is further configured to send the second code to the second client 200;
the second client 200 is configured to output the second code.
In one possible implementation, the second client 200 is a browser 201;
the browser 201 is further configured to send a data request for the second code to the server 300 in response to a request of the first user;
the server 300 is further configured to respond to the data request and obtain a page template;
when the server 300 is configured to send the second code to the second client 200, specifically, to: sending the second code and the page template to the browser 201;
when the second client 200 is configured to output the second code, the second client is specifically configured to: and displaying the specified page according to the second code and the page template.
In one possible implementation, the content of the designated page includes: and at least one of the second code and a rendered display interface of the second code.
In a possible implementation, the server 300 is further configured to send the first code to the browser 201;
correspondingly, the content of the specified page comprises: at least one of the second code and a rendered display interface of the second code; and, the first code.
In a possible implementation, the first client 100 is further configured to send a configuration file to the server 300 while sending the first code to the server, where the configuration file includes at least one of a name of the second code and a component category of the second code;
correspondingly, when the server 300 is used to obtain the page template, it is specifically configured to: and acquiring the page template according to at least one of the name of the second code and the component category of the second code.
In one possible implementation, the second client 200 is an editor 202 used by a user;
the editor 202 is configured to receive a keyword input by a user and send the keyword to the server 300;
the server 300 is further configured to obtain a second code matched with the keyword;
the server 300 is further configured to send names of second codes in the second codes matched with the keyword to the editor 202;
the editor 202 is further configured to display names of second codes in the second codes matched with the keyword;
the editor 202 is further configured to send a request for downloading the second code to the server in response to the name of the second code selected by the user according to the name of each second code in the second codes matched with the keyword;
when the server 300 is configured to send the second code to the second client, the server is specifically configured to: sending the second code to the editor in response to the download request.
In a possible implementation, the server 300 is further configured to send the second code to the editor and send a first code corresponding to the second code to the editor 202;
when the second client 200 outputs the second code, the method is specifically configured to: the editor 202 presents the second code and the first code.
In one possible implementation, the second client is an editor 202 used by the user;
the editor 202 is configured to receive a keyword input by a user, and acquire a second code matched with the keyword;
the editor 202 is configured to display names of second codes in the second codes matched with the keywords;
the second client 200, when configured to output the second code, is specifically configured to: the editor 202 presents the second code in response to the name of the second code selected by the user from the names of the second codes matching the keyword.
In a possible implementation scheme, the server 300 is further configured to send the second code to the editor 202 at the same time of sending the first code corresponding to the second code to the editor;
the editor 202 is configured to simultaneously present the first code in a page where the second code is presented.
In a possible implementation, the server 300 is specifically configured to:
extracting respective data of each field from a first code in a first format;
and storing the extracted respective data of each field in a second format to obtain a second code.
Since each unit in the present embodiment can perform the method shown in fig. 1 to 11, reference may be made to the related description of fig. 1 to 11 for a part not described in detail in the present embodiment.
Please refer to fig. 13, which is a block diagram illustrating a server according to an embodiment of the present invention. As shown, the server includes:
a receiving unit 301, configured to receive a first code of a sharer sent by a first client;
the processing unit 302 is configured to determine a corresponding second format according to a first format adopted by the first code, and perform format conversion on the first code based on the second format to obtain a second code;
a sending unit 303, configured to send the second code to a second client, so that the second client outputs the second code.
Since each unit in the present embodiment can perform the method shown in fig. 1 to 11, reference may be made to the related description of fig. 1 to 11 for a part not described in detail in the present embodiment.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (15)

1. A code processing method applied to a system including a first client used by a sharer, a second client used by a user, and a server, the method comprising:
the first client acquires a first code of a sharer;
the first client sends the first code to the server;
the server determines a first format adopted by a first code according to a file name suffix of a code file containing the first code, determines a corresponding second format according to the first format adopted by the first code, extracts respective data of each field from the first code adopting the first format, and stores the extracted respective data of each field in the second format to obtain a second code; the second code is a code of a format which the second client supports direct rendering;
the server sends the second code to the second client;
the second client outputs the second code.
2. The method of claim 1, wherein the second client is a browser;
before the server sends the second code to the second client, the method further includes: the browser sends a data request aiming at the second code to the server in response to the request of the first user; the server responds to the data request and obtains a page template;
the server sending the second code to the second client, including: the server sends the second code and the page template to the browser;
the second client outputs the second code, including: and the browser displays a specified page according to the second code and the page template.
3. The method of claim 2, wherein the specifying the content of the page comprises: and at least one of the second code and a rendered display interface of the second code.
4. The method of claim 2, wherein before the second client presents the specified page according to the second code and the page template, further comprising: the server sends the first code to the browser;
the content of the specified page comprises:
at least one of the second code and a rendered display interface of the second code; and the number of the first and second groups,
the first code.
5. The method of claim 2,
the method further comprises the following steps: the first client sends the first code to the server and simultaneously sends a configuration file to the server, wherein the configuration file comprises at least one of the name of the second code and the component category of the second code;
the server acquiring the page template comprises the following steps: and the server acquires the page template according to at least one of the name of the second code and the component category of the second code.
6. The method of claim 1, wherein the second client is an editor used by a user; before the server sends the second code to the second client, the method further includes:
the editor receives keywords input by a user and sends the keywords to the server;
the server acquires a second code matched with the keyword;
the server sends the name of each second code in the second codes matched with the keyword to the editor;
the editor displays the name of each second code in the second codes matched with the keyword;
the editor responds to the name of a second code selected by a user according to the name of each second code in the second codes matched with the keyword, and sends a downloading request of the second code to the server;
the server sending the second code to the second client, including: the server sends the second code to the editor in response to the download request.
7. The method of claim 6, further comprising: the server sends the second code to the editor, and simultaneously sends the first code corresponding to the second code to the editor;
the second client outputs the second code, including: the editor presents the second code and the first code.
8. The method of claim 1, wherein the second client is an editor used by a user; before the second client outputs the second code, the method further includes:
the editor receives keywords input by a user and acquires second codes matched with the keywords;
the editor displays the name of each second code in the second codes matched with the keyword;
the second client outputs the second code, including: and the editor responds to the name of the second code selected by the user according to the name of each second code in the second codes matched with the keyword, and displays the second code.
9. The method of claim 8, further comprising:
the server sends the second code to the editor and simultaneously sends a first code corresponding to the second code to the editor;
and the editor simultaneously presents the first code in the page presenting the second code.
10. A code processing method, executed in a server, the method comprising:
receiving a first code of a sharer sent by a first client;
determining a first format adopted by a first code according to a file name suffix of a code file containing the first code, determining a corresponding second format according to the first format adopted by the first code, extracting respective data of each field from the first code adopting the first format, and storing the extracted respective data of each field in the second format to obtain a second code; the second code is a code of a format which is supported by the second client side to be directly rendered;
sending the second code to the second client to facilitate the second client in outputting the second code.
11. The method of claim 10, wherein the second client is a browser;
before sending the second code to the second client, the method further includes: receiving a data request for the second code sent by the browser in response to a request of a first user; responding to the data request, and acquiring a page template;
sending the second code to the second client, including: and sending the second code and the page template to the browser.
12. The method of claim 10, wherein the second client is an editor used by a user; before sending the second code to the second client, the method further includes:
receiving keywords input by a user and sent by the editor;
acquiring a second code matched with the keyword;
sending the name of each second code in the second codes matched with the keyword to the editor so that the editor can display the name of each second code in the second codes matched with the keyword;
receiving a downloading request of the second codes sent to the server by the editor in response to the names of the second codes selected by the user according to the names of the second codes in the second codes matched with the keywords;
sending the second code to the second client, including: sending the second code to the editor in response to the download request.
13. A code processing system, the system comprising: the system comprises a first client used by a sharer, a second client used by a user and a server;
the first client is used for acquiring a first code of a sharer;
the first client is further used for sending the first code to the server;
the server is used for determining a first format adopted by a first code according to a file name suffix of a code file containing the first code, determining a corresponding second format according to the first format adopted by the first code, extracting respective data of each field from the first code adopting the first format, and storing the extracted respective data of each field in the second format to obtain a second code; the second code is a code of a format which the second client supports direct rendering;
the server is further used for sending the second code to the second client;
the second client is used for outputting the second code.
14. A server, comprising:
the receiving unit is used for receiving a first code of a sharer sent by a first client;
the processing unit is used for determining a first format adopted by a first code according to a file name suffix of a code file containing the first code, determining a corresponding second format according to the first format adopted by the first code, extracting respective data of each field from the first code adopting the first format, and storing the extracted respective data of each field in the second format to obtain a second code; the second code is a code of a format which a second client supports direct rendering;
and the sending unit is used for sending the second code to the second client so as to facilitate the second client to output the second code.
15. A storage medium storing executable instructions for causing a processor to perform the code processing method of any one of claims 1 to 12 when executed.
CN201710220120.6A 2017-04-06 2017-04-06 Code processing method, system and server Active CN106951270B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710220120.6A CN106951270B (en) 2017-04-06 2017-04-06 Code processing method, system and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710220120.6A CN106951270B (en) 2017-04-06 2017-04-06 Code processing method, system and server

Publications (2)

Publication Number Publication Date
CN106951270A CN106951270A (en) 2017-07-14
CN106951270B true CN106951270B (en) 2023-04-07

Family

ID=59474385

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710220120.6A Active CN106951270B (en) 2017-04-06 2017-04-06 Code processing method, system and server

Country Status (1)

Country Link
CN (1) CN106951270B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108446109A (en) * 2018-02-06 2018-08-24 微梦创科网络科技(中国)有限公司 Convert the method and system of front-end template
CN109597947A (en) * 2018-10-09 2019-04-09 中国平安人寿保险股份有限公司 Interface sharing method, device, electronic equipment and storage medium based on big data
CN110231955B (en) * 2019-05-13 2024-05-07 平安科技(深圳)有限公司 Code processing method, device, computer equipment and storage medium
CN113452760A (en) * 2021-06-08 2021-09-28 阿波罗智联(北京)科技有限公司 Verification code synchronization method and device, electronic equipment and storage medium
CN113568701A (en) * 2021-09-28 2021-10-29 深圳市信润富联数字科技有限公司 Modal frame display method, device, equipment and storage medium
CN115291759A (en) * 2022-07-28 2022-11-04 北京字跳网络技术有限公司 Information processing method and device and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10207149A1 (en) * 2002-02-20 2003-08-28 Siemens Ag Method for coding data train convertible from first to second data train format
CN102236708A (en) * 2011-06-30 2011-11-09 内蒙古电力勘测设计院 Method for converting topographic map data format to overhead line format
CN103294652A (en) * 2012-02-27 2013-09-11 腾讯科技(深圳)有限公司 Data conversion method and system
CN103365668A (en) * 2012-03-26 2013-10-23 联想(北京)有限公司 Loading and linking method and device of dynamic link library

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102750281B (en) * 2011-04-19 2015-09-16 腾讯科技(深圳)有限公司 A kind of script processing method of browser and system
CN103093001A (en) * 2013-02-27 2013-05-08 人民搜索网络股份公司 Microblog data analysis method and device
CN104125208B (en) * 2013-10-15 2015-08-12 腾讯科技(深圳)有限公司 Data transmission method and device
CN105468571B (en) * 2015-11-19 2019-04-23 中国地质大学(武汉) It is a kind of for automatically generating the method and device of report

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE10207149A1 (en) * 2002-02-20 2003-08-28 Siemens Ag Method for coding data train convertible from first to second data train format
CN102236708A (en) * 2011-06-30 2011-11-09 内蒙古电力勘测设计院 Method for converting topographic map data format to overhead line format
CN103294652A (en) * 2012-02-27 2013-09-11 腾讯科技(深圳)有限公司 Data conversion method and system
CN103365668A (en) * 2012-03-26 2013-10-23 联想(北京)有限公司 Loading and linking method and device of dynamic link library

Also Published As

Publication number Publication date
CN106951270A (en) 2017-07-14

Similar Documents

Publication Publication Date Title
CN106951270B (en) Code processing method, system and server
CN107622135B (en) Method and apparatus for displaying information
US20190251143A1 (en) Web page rendering method and related device
KR101317972B1 (en) Method and system for transferring web browser data between web browsers
CN110708346B (en) Information processing system and method
US7917755B1 (en) Identification of localized web page element
US20110035435A1 (en) Method and system for converting desktop application to web application
CN108399088B (en) Page display method, user terminal, page server and style configuration server
CN110955428A (en) Page display method and device, electronic equipment and medium
US7844897B1 (en) Blog template generation
EP3316149A1 (en) Information acquiring method and apparatus, device, and computer storage medium
CN101427229A (en) Technique for modifying presentation of information displayed to end users of a computer system
CN109558199B (en) Information pushing method, device, equipment and storage medium
CN112100550A (en) Page construction method and device
US20170192941A1 (en) Computer-Automated Generation of Application Deep Links
CN103678704A (en) Picture recognition method, system, equipment and device based on picture information
CN104090887A (en) Music search method and device
US8195762B2 (en) Locating a portion of data on a computer network
US20150161160A1 (en) Application Localization
US20160328110A1 (en) Method, system, equipment and device for identifying image based on image
TWI519980B (en) Method and device for displaying web page and computer-readable storage medium
CN108573053B (en) Information pushing method, device and system
US20150207867A1 (en) Information processing terminal and control method
CN116820635A (en) Document block sharing method, device, system and storage medium
CN104699836A (en) Multi-keyword search prompting method and multi-keyword search prompting device

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