CN112307723A - Method and device for generating code document and electronic equipment - Google Patents

Method and device for generating code document and electronic equipment Download PDF

Info

Publication number
CN112307723A
CN112307723A CN202010900453.5A CN202010900453A CN112307723A CN 112307723 A CN112307723 A CN 112307723A CN 202010900453 A CN202010900453 A CN 202010900453A CN 112307723 A CN112307723 A CN 112307723A
Authority
CN
China
Prior art keywords
target
code block
document
user
target code
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.)
Pending
Application number
CN202010900453.5A
Other languages
Chinese (zh)
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010900453.5A priority Critical patent/CN112307723A/en
Publication of CN112307723A publication Critical patent/CN112307723A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/335Filtering based on additional data, e.g. user or group profiles

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The embodiment of the disclosure discloses a method and a device for generating a code document and electronic equipment. One embodiment of the method comprises: receiving the editing operation of the document content executed by a user based on a target code block in the engineering code; generating a target document of a preset format of the target code block based on the document content determined by the editing operation; and storing the target code block and the target document in an associated manner. In the above manner, a target document can be retrieved from the target code block, and a target code block can be retrieved from the target document. In addition, the target document can be generated based on the target code blocks, so that the range of codes of the generated document is expanded, and the range of the codes corresponding to the document is further refined.

Description

Method and device for generating code document and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for generating a code document, and an electronic device.
Background
When the software program development team has a certain scale, some agreed usages, specifications, and some basic component reuse for packaging can be precipitated. The information can be deposited in a document form and shared among teams, and the working efficiency of the teams can be improved.
Disclosure of Invention
This disclosure is provided to introduce concepts in a simplified form that are further described below in the detailed description. This disclosure is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
The embodiment of the disclosure provides a method and a device for generating a code document and electronic equipment.
In a first aspect, an embodiment of the present disclosure provides a method for generating a code document, where the method includes: receiving the editing operation of the document content executed by a user based on a target code block in the engineering code; generating a target document of a preset format of the target code block based on the document content determined by the editing operation; and storing the target code block and the target document in an associated manner.
In a second aspect, an embodiment of the present disclosure provides an apparatus for generating a code document, including: a receiving unit, configured to receive an editing operation of a document content performed by a user based on a target code block in the engineering code; a generating unit, configured to generate a target document in a preset format of the target code block based on the document content determined by the editing operation; and the storage unit is used for storing the target code block and the target document in an associated manner.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to carry out the method of generating a code document according to the first aspect.
In a fourth aspect, the disclosed embodiments provide a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the steps of the method of generating a code document according to the first aspect.
According to the method, the device and the electronic equipment for generating the code document, the editing operation of the document content executed by a user based on the target code block in the engineering code is received; generating a target document of a preset format of the target code block based on the document content determined by the editing operation; and storing the target code block and the target document in an associated manner. The code block and the document can be mutually indexed for positioning; the target document may be retrieved from and through the target code patch. In addition, the target document can be generated based on the target code block, and compared with the related art in which only documents of classes and functions can be generated, the scheme provided by the embodiment can extend the range of codes of the generated document, which is beneficial to further refining the range of codes corresponding to the document.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a flow diagram of one embodiment of a method of generating a code document according to the present disclosure;
FIG. 2 is a flow diagram of another embodiment of a method of generating a code document according to the present disclosure;
FIG. 3 is a schematic block diagram illustration of one embodiment of an apparatus to generate a code document according to the present disclosure;
FIG. 4 an exemplary system architecture to which the method of generating a code document of one embodiment of the present disclosure may be applied.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and its variants, as used herein, are intended to be inclusive, i.e., "including but not limited to. The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Referring to FIG. 1, a flow diagram of one embodiment of a method of generating a code document is shown, in accordance with the present disclosure. The method of generating a code document as shown in fig. 1 includes the steps of:
step 101, receiving the editing operation of the document content executed by the user based on the target code block in the engineering code.
In this embodiment, the engineering code may refer to a code of a software engineering. The program code may include a code corresponding to a function and a class corresponding to the preset item. The functions, classes, may be implemented by multiple pieces of code. The code block may be present in the function or in the class, or may be present outside the function or outside the class. The target code block of this may be a code block edited using the symbol "{ }" in the above engineering code. The user may select a target code block among the above-mentioned engineering codes. The target code block is determined, for example, based on a selection operation performed by a user in the engineering code.
After determining the target code block, the user can edit the target code block in the preset document editing entry
The document contents of the target code block perform editing operations. The editing operation herein may include, for example, an operation of inputting document contents corresponding to the target code block in the document editing entry. In addition, the editing operation may further include: delete operations, modify operations, etc.
The document content herein may include at least one of: words, symbols, letters, etc. The document contents herein may be used to explain the functions, interfaces, etc. of the code blocks.
Code documentation is often a prerequisite in the use and maintenance of code development. A document is a textual entity associated with a code and is a written description of the code. The communication among different developers can be facilitated.
And 102, generating a target document of a preset format of the target code block based on the document content determined by the editing operation.
In this embodiment, the target document may be generated based on the document content determined by the editing operation of the user. For example, the target document of the target code block is generated according to the document content input by the user.
The preset format may be various formats, such as Json format. Or an XHTML-format file for presentation in a page.
And 103, associating and storing the target code block and the target document.
In this embodiment, various association methods may be used to store the target code block in association with the target document.
For example, the name of the target document may be recorded at a preset position of the target code block. Thus, the name of the target document can be browsed to the target code block, and then the target document can be searched through the name of the document.
For another example, the path information of the project code where the target code block is located and the position information of the target code block in the project code may be recorded in the document. So that the target code block can be searched by the target document.
The method for generating the code document provided by the embodiment receives the editing operation of the document content executed by a user based on the target code block in the engineering code; generating a target document of a preset format of the target code block based on the document content determined by the editing operation; the target code block and the target document are stored in a correlated mode, so that the code block and the document can be mutually indexed for positioning; the target document may be retrieved from and through the target code patch. In addition, the target document can be generated based on the target code block, and compared with the document for generating classes and functions in the related art, the scheme provided by the embodiment can expand the range of the codes of the generated document, which is beneficial to further refining the range of the codes corresponding to the document.
In some optional implementations of this embodiment, before step 101, the method for generating a code document further includes: and determining the code block identification corresponding to the target code block. And the step 103 may include the steps of:
firstly, a code block identifier of a target code block is set at a preset position of the target code block.
In these alternative implementations, after the user selects a target code block in the above engineering code, a unique code block identifier may be automatically set for the target code block. The code block identification of a code block is used to distinguish different code blocks. Different code blocks may correspond to different code block identities.
The code block identification may include, but is not limited to, words, numbers, symbols, and/or letters.
The preset position of the target code block may be, for example, a line before the code of the head line of the target code block. Or the next line of the last line of the target code block. In addition, the preset position can be other positions of the target code block specified in advance. The preset position may be set according to a specific application scenario, and is not limited herein.
And secondly, storing the target document by taking the code block identifier as the name of the target document.
In these alternative implementations, a storage area may be preset for the document of the engineering code. In the preset storage area, the code block identifier may be used as an identifier of a target document, and the target document may be stored in the upper preset storage area.
In these alternative implementations, by setting code block identifiers at preset positions of the target code blocks and storing the target code block identifiers in the preset storage area as identifiers of the target documents, an index between the target code blocks and the target documents can be established, which is helpful for improving efficiency of searching between the target code blocks and the target documents.
With further reference to FIG. 2, which illustrates a flow diagram of another embodiment of a method of generating a code document according to the present disclosure, as illustrated in FIG. 2, the method of generating a code document includes the steps of:
step 201, in response to detecting a first preset operation executed on the engineering code by a user, determining a target code block corresponding to the first preset operation.
In this embodiment, whether the real-time monitoring user performs the first preset operation on the engineering code may be determined. The first preset operation may include, for example, a selection operation of the code block by the user. The code block is selected, for example, with a cursor.
After it is monitored that the user performs the first preset operation, the target code block may be determined according to a range of codes corresponding to the first preset operation. The target code block may be determined, for example, from the top line code and the bottom line code involved in the above-described selection operation.
And step 203, displaying an editing window of the document information of the target code block.
In some application scenarios, an editing window of document information may be presented in an upper layer of a window displaying engineering code.
The editing window may be presented above the window displaying the engineering code in a floating window, a pop-up window, or a cover layer.
An editing window of the document contents may be set in the editing window.
Step 204, receiving an editing operation of a user on the target document through the editing window, wherein the editing operation includes at least one of the following: adding text content, modifying historical document content, and deleting at least part of existing document content.
The editing window may include a text content input window. And inputting the new text content matched with the target code block through the text content input window.
In some application scenarios, the target code block may be a target code block determined for the first time by a user. The target code block has no historic document content before. In these application scenarios, the user may input text content corresponding to the target code block through the text content input window.
In some other application scenarios, the target code block may be a target code block that is not first determined by a user. Before which the target code block has corresponding historic document content. In these application scenarios, the user may perform editing operations on the historic document content through the text content input window described above. For example, newly added text content can be added to the history document content through the editing window; for another example, the contents of the history document are modified through the editing window; for another example, at least a portion of the existing document content is deleted through the editing window. At least part of the document content may include a part of the existing document content, or may include all the existing document content.
In some optional implementations of this embodiment, the editing window may include a code editing window. And the step 204 may further include: and copying the current code corresponding to the target code block to the code editing window.
In these alternative implementations, after the target code block is determined according to the first preset operation performed by the user, an edit window of the document information of the target code block may be presented. A code editing window may be included in the editing window. The current code corresponding to the target code block may be automatically copied to the code editing window.
The target code block is adjusted after a certain period of time after the initial creation. If the target code block is created, a user executes a first preset operation in the engineering code to determine the target code block, and a current code corresponding to the target code block is a code corresponding to the target code block when the target code block is initially created. And if the target code block is determined by executing a first preset operation in the engineering code by a user after the target code block is adjusted, the current code of the target code block is the adjusted code of the target code block.
In these alternative implementations, after the target code block is determined according to the first preset operation of the user, the current code of the target code block is automatically copied into the editing window of the target document, and compared with the operation that the user is required to input the current code of the target code block into the editing window line by line, or a copy command is executed on the current code of the target code block and a paste instruction is executed in the editing window, so that the code of the target code block is copied into the editing window, the operation of editing the target document can be simplified, the workload of the user is reduced, and the speed of generating the target document is increased.
Further optionally, the receiving an editing operation of the document content performed by the user based on the target code block in the engineering code further includes: and receiving text information input by a user in the code editing window.
That is, in addition to automatically copying the current code of the target code block to the code editing window, the text information input by the user in the code editing window may be received. The text information may include, but is not limited to, text information, symbol information, and the like. That is, the user can also input text information related to the target code block in the code editing window.
Therefore, the text information associated with the target code block can be added in the code editing window conveniently by a user. The method and the device help to improve the speed of knowing the content of the target code block when the user opens the target document again.
In some optional implementations of this embodiment, the edit window includes a label edit window, and the step 204 may include:
and receiving the editing operation of a user in the label editing window, and determining the label information of the target code block based on the editing operation.
In these alternative implementations, the user may perform various editing operations in the tab editing window described above. The tag information of the target code block may be determined according to an editing operation of a user.
The tag information of the target code block may indicate the classification to which the target code block corresponds, the implemented function, etc. For example, the tag information in the target document corresponding to the target code block for implementing the loading (loading) dialog box may include "User Interface (UI)", and "loading (loading)" of the dialog box.
In some application scenarios, the receiving an editing operation of the user in the tag editing window, and determining tag information of the target code block based on the editing operation may include:
first, the label information input by the user in the label editing window is received.
Next, the tag information input by the user is determined as the tag information of the target code block.
In these application scenarios, the user may directly input tag information in the tag editing window, and the tag input by the user may be newly determined as the tag information of the target code block.
That is, the user can directly input tag information of the target code block in the tag edit window.
In some other application scenarios, the receiving an editing operation of the user in the tag editing window, and determining tag information of the target code block based on the editing operation may include:
firstly, receiving keywords input by a user in the label editing window, and displaying a first candidate label option matched with the keywords.
And secondly, determining the label information of the target code block according to the selection operation of the user on the first candidate label selection item.
In these application scenarios, the user may enter keywords in the tab edit window. At least one first candidate tag selection item matching the keyword may be automatically matched according to the keyword input by the user. And presenting the at least one first candidate tag selection in the tag edit window. For example, after the user enters a keyword in the tag editing window, the at least one first candidate tag option may be presented in a form of a drop-down list in the tag editing window.
The user may perform a selection operation on the presented first candidate tag selection. The tag information of the target code block may be determined according to a selection operation of a user.
In these alternative implementations, by providing the user with the first candidate tag selection determined according to the keyword input by the user, the user may be assisted in inputting the tag of the target code block when the user cannot exactly set the tag of the target code block. The efficiency of setting the label of the target code block by the user is improved.
In some application scenarios, the preset tag list is also displayed in the editing window. The preset tag list comprises at least one second candidate tag selection item. The receiving an editing operation of a user in the tag editing window, and determining tag information of the target code block based on the editing operation includes: and receiving selection operation executed by a user in the displayed preset label list, and determining the label information of the target code block.
In these application scenarios, at least one second candidate tag selection item may be directly presented in the editing window, and the user may select one second candidate tag selection item as a tag of the target code block from the preset tag list. Thereby further improving the efficiency of inputting the target code block by the user.
In some optional implementations of the embodiment, the editing window may include a description information input window. The description information of a code block may for example comprise a definition of the code block of the block. For example, the description information in the target document corresponding to the target code block implementing the loading (loading) dialog box may be "default implementation of loading dialog box".
In these optional implementation manners, the receiving an editing operation of the target document by the user through the editing window includes: and receiving description information which is input in a description information input window by a user and is used for describing the target code block.
The user can input the description information of the target code block through the displayed description information input window.
And step 205, generating a target document of a preset format of the target code block based on the document content determined by the editing operation.
And step 206, associating and storing the target code block and the target document.
Step 205 and step 206 may be the same as or similar to step 102 and step 103 in the embodiment shown in fig. 1, and are not described herein again.
In some optional implementation manners of this embodiment, before the step 203, the method for generating a document code may further include the following step 202:
step 202, determining a code block identifier corresponding to the target code block.
After the target code block is determined in step 201, the target code block may be automatically assigned its corresponding code block identity. This code block identification can be used to distinguish between different code blocks. The code block identifiers may include, but are not limited to: words, symbols, letters, and/or numbers.
In some optional implementation manners of this embodiment, the editing window may further include a code block identifier display window of the target code block. The code block identification display window can display the code block identification of the target code block determined according to the first preset operation executed on the engineering code by the user.
In these alternative implementations, a code block identifier corresponding to the target code block may be set at a preset position of the target code block in the engineering code. The preset position may be, for example, a line before a first line code of the target code block.
In these optional implementation manners, by allocating a code block identifier to the target code block, displaying the code block identifier at a preset position of the target code block, displaying the code block identifier in the editing window, and setting the code block identifier at the preset position of the target code block, a user is facilitated to identify whether the edited editing window is matched with the target code block according to the code block identifier.
In some application scenarios, the step 201 may include a first preset operation performed by a user on a code block identifier of a target code block shown in the engineering code, where the first preset operation may be a selection operation. The target code block may be determined according to the first preset operation described above. A code block identification of the target code block is further determined. After the code block identifier corresponding to the first preset operation is determined, an editing window of the document information corresponding to the code block identifier may be displayed. The edit window may present a historical object document of the object code block. Therefore, the function of inquiring the target document of the target code block through the code block identification of the engineering code is realized.
Further optionally, the step 206 may include setting a code block identifier of the target code block at a preset position of the target code block, taking the code block identifier of the target document as a name of the target document, and storing the target code block in association with the target document.
Step 205 and step 206 may be the same as or similar to step 102 and step 103, respectively, in the embodiment shown in fig. 1, and are not repeated here.
It should be noted that the editing window of the target document and the engineering code may be both disposed in the same integrated editing environment. In this way, after the user edits the engineering code in the integrated editing environment, the first preset operation can be directly executed on the engineering code. The integrated editing environment can determine a target code block in the engineering code according to a first preset operation of a user. After the target code block is determined, a code block identifier may be allocated to the target code block by the integrated editing environment. After determining the code block identifier, the integrated editing environment may set the code block identifier at a preset position of the target code block. And then displaying an editing window for editing the target document above the code editing window of the engineering code. The user can perform the editing operation of the target document as described above in the editing window described above. The integrated editing environment can determine a target document of the target code block according to the editing operation of the user in the editing window. Therefore, the user can finish the editing operation of the target document corresponding to the target code block in the integrated editing environment, and convenience is provided for the user to edit the code document.
Compared with the embodiment shown in fig. 1, the present embodiment highlights the steps of determining a target code block in the engineering code and editing the target document using the editing window, which can provide convenience for the user to edit the target document of the target code block. The efficiency of a user editing a document of code may be improved.
In some optional implementations of embodiments of the present disclosure, step 102 of the method of generating a code document of the embodiment shown in fig. 1 and step 205 of the method of generating a code document of the embodiment shown in fig. 2 may further include: and generating a target document conforming to a first preset format based on the document content.
The first predetermined format may be a text format, such as a Json format.
The target document using the first preset format may be conveniently stored and conveniently referred to by a user.
In some application scenarios, after generating the target document conforming to the first preset format based on the document content, step 102 of the method for generating a code document of the embodiment shown in fig. 1 and step 205 of the method for generating a code document of the embodiment shown in fig. 2 may further include: and generating a visual target document in a second preset format according to a second preset operation executed on the target document by the user.
In these application scenarios, the user may perform the second preset operation on the target document in the first preset format. The second preset operation may be an operation for instructing to convert the target document into a visualization format. As an implementation manner, the second preset operation may be, for example, to open the target document in the first format by using a preset application for opening a document in a second preset format.
In these application scenarios, after the user performs a second preset operation on the target document, a visualized target document in a second preset format may be generated. For example, after the target document is opened in the preset application, the target document in the second preset format may be automatically generated.
As another implementation manner, the second preset operation may be, for example, an operation performed on the target document in the first preset format to instruct to convert the format of the target document. The second predetermined format may be any visual format, such as Markdown format. Markdown is a lightweight markup language that allows people to compose documents using a plain text format that is easy to read and write, and then convert to valid XHTML documents.
The format of the target document is converted from a first preset format of text to a visual second preset format, and compared with the target document in the first preset format, the readability of the target document in the second preset format is better, and the user experience can be improved.
In some optional implementation manners of the embodiments of the disclosure, the target document in the method of generating a code document of the embodiment shown in fig. 1 and the embodiment shown in fig. 2 may include first location information of the target code block. The first location information may include path information of the engineering code and location information of the target code block in the engineering code block.
In these alternative implementations, the first location information corresponding to the target code block may be set in the target document, so that a user may conveniently locate the target code block in the engineering code through the first location information. The method is favorable for improving the speed of determining the target code blocks in the engineering codes through the target documents.
In some optional implementations of embodiments of the present disclosure, step 103 of the method for generating a code document of the embodiment shown in fig. 1 and step 206 of the method for generating a code document of the embodiment shown in fig. 2 may further include: and storing the target document into a preset distribution version control system.
The distributed version control system may be, for example, a Git system.
The distributed version control system is a version control system. And by adopting a distributed version bitter mode, a version library can be established locally. Can be submitted to the server later after local submission. In the distributed version library described above, different versions of target documents of multiple target code blocks may be included. For a new version of the target document, the change information of the new version of the target document based on the previous version of the target document may be recorded in the distributed version control system.
The distributed version control system supports stand-alone operation. The user can build a document library of the engineering code documents in his own computer. After the target document of the target code block is generated, the target document may be saved in a local document library. After the computer is networked, a local document library can be uploaded to a server related to the engineering code so as to be used by other users of the engineering code. The user refers to the change record of the target document of the target code block in the warehouse.
In these alternative implementations, by storing the target document in the distributed version control system, the change records of the target document and the target code block can be queried in the distributed version control system, which is beneficial to maintaining the engineering code.
With further reference to fig. 3, as an implementation of the method shown in the above figures, the present disclosure provides an embodiment of an apparatus for generating a code document, which corresponds to the embodiment of the method shown in fig. 1, and which is particularly applicable in various electronic devices.
As shown in fig. 3, the apparatus for generating a code document of the present embodiment includes: a receiving unit 301, a generating unit 302 and a storing unit 303. The receiving unit 301 is configured to receive an editing operation of document content performed by a user based on a target code block in the engineering code; a generating unit 302, configured to generate a target document in a preset format of the target code block based on the document content determined by the editing operation; and the storage unit 303 is configured to store the target code block and the target document in an associated manner.
In this embodiment, specific processing of the receiving unit 301, the generating unit 302, and the storing unit 303 of the apparatus for generating a code document and technical effects brought by the processing can refer to related descriptions of step 101, step 102, and step 103 in the corresponding embodiment of fig. 1, which are not described herein again.
In some optional implementations of the embodiment, the apparatus for generating a code document further includes a first determining unit (not shown in the figure). The determining unit is configured to, before the receiving unit 301 receives an editing operation of a document content performed by a user based on a target code block in an engineering code, determine, in response to detecting a first preset operation performed on the engineering code by the user, a target code block corresponding to the first preset operation. And the receiving unit 301 is further configured to: an editing window for displaying the document information of the target code block; receiving an editing operation of a user on the target document through the editing window, wherein the editing operation comprises at least one of the following operations: adding text content, modifying historical document content, and deleting at least part of existing document content.
In some optional implementations of this embodiment, the edit window includes a code edit window; the receiving unit 301 is further configured to: and copying the current code corresponding to the target code block to the code editing window.
In some optional implementation manners of this embodiment, the receiving unit 301 receives text information input by a user in the code editing window after copying the current code content of the target code block to the code editing window in response to detecting the first preset operation.
In some optional implementations of this embodiment, the edit window includes a label edit window, and the receiving unit 301 is further configured to: and receiving the editing operation of a user in the label editing window, and determining the label information of the target code block based on the editing operation.
In some optional implementations of this embodiment, the receiving unit 301 is further configured to: receiving label information input by the user in the label editing window; and determining label information input by a user as the label information of the target code block.
In some optional implementations of this embodiment, the receiving unit 301 is further configured to: receiving keywords input by a user in the label editing window, and displaying a first candidate label option matched with the keywords; and determining the label information of the target code block according to the selection operation of the user on the first candidate label selection item.
In some optional implementations of this embodiment, the receiving unit is further configured to: and receiving selection operation executed by a user in a displayed preset label list, and determining label information of the target code block, wherein the preset label list comprises at least one second candidate label option.
In some optional implementations of this embodiment, the editing window includes a description information input window; and the receiving unit 301 is further configured to: and receiving description information which is input in a description information input window by a user and is used for describing the target code block.
In some optional implementations of this embodiment, the generating unit 302 is further configured to: and generating a target document conforming to a first preset format based on the document content.
In some optional implementations of the embodiment, the apparatus for generating a code document further includes a second determining unit (not shown in the figure). The second determining unit is configured to: and determining a code block identifier corresponding to a target code block in the engineering code before the receiving user performs the editing operation of the document content based on the target code block. The storage unit 303 is further configured to: setting code block identification of the target code block at a preset position of the target code block, taking the code block identification as the name of a target document of the target document, and storing the target code block and the target document in a correlation manner.
In some optional implementations of this embodiment, the storage unit 303 is further configured to: and storing the target document into a preset distributed version control system.
In some optional implementations of the embodiment, the generating unit 303, after generating the target document conforming to the first preset format based on the document content, is further configured to: and generating a visual target document in a second preset format according to a second preset operation executed on the target document by the user.
In some optional implementations of this embodiment, the target document includes first location information of the target code block, where the first location information includes path information corresponding to the engineering code and location information of the target code block in the engineering code.
Referring to FIG. 4, FIG. 4 illustrates an exemplary system architecture in which a method of generating a code document of one embodiment of the present disclosure may be applied.
As shown in fig. 4, the system architecture may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 serves as a medium for providing communication links between the terminal devices 401, 402, 403 and the server 405. Network 404 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 401, 402, 403 may interact with a server 405 over a network 404 to receive or send messages or the like. The terminal devices 401, 402, and 403 may have various client applications installed thereon, such as a web browser application, a search application, a news application, a shopping application, an online office application, and the like. The client application in the terminal device 401, 402, 403 may receive the instruction of the user, and complete the corresponding function according to the instruction of the user, for example, edit the target document for the target code block according to the instruction of the user.
The terminal devices 401, 402, and 403 may be hardware or software. When the terminal devices 401, 402, and 403 are hardware, they may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg compressed tag Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg compressed tag Audio Layer 4), laptop portable computers, desktop computers, and the like. When the terminal devices 401, 402, and 403 are software, they can be installed in the electronic devices listed above. It may be implemented as a plurality of software or software modules (e.g., software or software modules used to provide distributed services) or as a single software or software module. And is not particularly limited herein.
The server 405 may provide various services, such as receiving a target document sent by the terminal device 401, 402, 403, and saving information of the target document.
It should be noted that the method for generating a code document provided by the embodiment of the present disclosure may be executed by a terminal device, and accordingly, a device for generating a code document may be disposed in the terminal device 401, 402, 403.
It should be understood that the number of terminal devices, networks, and servers in fig. 4 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The following shows a structure of an electronic device (e.g., a terminal device in fig. 4) suitable for implementing an embodiment of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The illustrated electronic device is merely an example and should not impose any limitations on the functionality or scope of use of embodiments of the present disclosure.
An electronic device may include a processing means (e.g., a central processing unit, a graphics processor, etc.) that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM) or a program loaded from a storage means into a Random Access Memory (RAM). In the RAM, various programs and data necessary for the operation of the electronic apparatus are also stored. The processing device, the ROM, and the RAM are connected to each other by a bus. An input/output (I/O) interface is also connected to the bus.
Generally, the following devices may be connected to the I/O interface: input devices including, for example, touch screens, touch pads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, and the like; output devices including, for example, Liquid Crystal Displays (LCDs), speakers, vibrators, and the like; storage devices including, for example, magnetic tape, hard disk, etc.; and a communication device. The communication means may allow the electronic device to communicate wirelessly or by wire with other devices to exchange data. While an electronic device having various means is shown, it is not required that all of the illustrated means be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means, or installed from the storage means, or installed from the ROM. The computer program, when executed by a processing device, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: receiving the editing operation of the document content executed by a user based on a target code block in the engineering code; generating a target document of a preset format of the target code block based on the document content determined by the editing operation; and storing the target code block and the target document in a related manner.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The name of a unit does not in some cases constitute a limitation on the unit itself, and for example, the receiving unit may also be described as a "unit that receives an editing operation of document contents performed by a user based on a target code block in the engineering code".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), application specific tag products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium may include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) technical features having similar functions disclosed in the present disclosure are mutually replaced to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (17)

1. A method of generating a code document, comprising:
receiving the editing operation of the document content executed by a user based on a target code block in the engineering code;
generating a target document of a preset format of the target code block based on the document content determined by the editing operation;
and storing the target code block and the target document in an associated manner.
2. The method of claim 1, wherein prior to the editing operation of the document content performed by the receiving user based on the target code block in the engineering code, the method further comprises:
in response to detecting a first preset operation executed on the engineering code by a user, determining a target code block corresponding to the first preset operation; and
the receiving user edits the document content based on the target code block in the engineering code, and the receiving user edits the document content based on the target code block in the engineering:
an editing window for displaying the document information of the target code block;
receiving an editing operation of a user on the target document through the editing window, wherein the editing operation comprises at least one of the following operations: adding text content, modifying historical document content, and deleting at least part of existing document content.
3. The method of claim 2, wherein the editing window comprises a code editing window; and
the receiving user edits the document content based on the target code block in the engineering code, and the receiving user further comprises:
and in response to the detection of the first preset operation, copying the current code corresponding to the target code block to the code editing window.
4. The method of claim 3, wherein after copying the current code content of the target code block to the code editing window in response to detecting the first preset operation, the receiving a user's editing operation of the document content performed based on the target code block in the engineering code further comprises:
and receiving text information input by a user in the code editing window.
5. The method of claim 2, wherein the editing window comprises a tab editing window, and
the receiving user edits the document content based on the target code block in the engineering code, and the receiving user edits the document content based on the target code block in the engineering:
and receiving the editing operation of a user in the label editing window, and determining the label information of the target code block based on the editing operation.
6. The method of claim 5, wherein the receiving an editing operation of a user in the tag editing window, and determining tag information of the target code block based on the editing operation comprises:
receiving label information input by the user in the label editing window;
and determining the label information input by the user as the label information of the target code block.
7. The method of claim 5, wherein the receiving an editing operation of a user in the tag editing window, and determining tag information of the target code block based on the editing operation comprises:
receiving keywords input by a user in the label editing window, and displaying a first candidate label option matched with the keywords;
and determining the label information of the target code block according to the selection operation of the user on the first candidate label selection item.
8. The method of claim 5, wherein the receiving an editing operation of a user in the tag editing window, and determining tag information of the target code block based on the editing operation comprises:
and receiving selection operation executed by a user in a displayed preset label list, and determining label information of the target code block, wherein the preset label list comprises at least one second candidate label selection item.
9. The method of claim 2, wherein the editing window comprises a description information input window; and
the receiving of the editing operation of the user on the target document through the editing window includes:
and receiving description information which is input in a description information input window by a user and is used for describing the target code block.
10. The method according to claim 1, wherein the generating of the target document in the preset format of the target code block based on the document content determined by the editing operation comprises:
and generating a target document conforming to a first preset format based on the document content.
11. The method according to one of claims 1 to 10, wherein prior to the editing operation of the document content performed by the receiving user based on the target code block in the engineering code, the method further comprises:
determining a code block identifier corresponding to the target code block; and
the associating and storing the target code block and the target document comprises:
setting code block identification of the target code block at a preset position of the target code block, taking the code block identification as the name of a target document of the target document, and storing the target code block and the target document in a correlation manner.
12. The method of claim 11, wherein associating saves the target code patch and the target document, comprising:
and storing the target document into a preset distributed version control system.
13. The method according to claim 10, wherein after the generating of the target document conforming to the first preset format based on the document content, the generating of the target document of the preset format of the target code block based on the document content determined by the editing operation further comprises:
and generating a visual target document in a second preset format according to a second preset operation executed on the target document by the user.
14. The method of claim 11, wherein the target document comprises first location information of the target code block, and wherein the first location information comprises path information corresponding to the engineering code and location information of the target code block in the engineering code.
15. An apparatus for generating a code document, comprising:
a receiving unit, configured to receive an editing operation of a document content performed by a user based on a target code block in the engineering code;
a generating unit, configured to generate a target document in a preset format of the target code block based on the document content determined by the editing operation;
and the storage unit is used for storing the target code block and the target document in an associated manner.
16. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-14.
17. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-14.
CN202010900453.5A 2020-08-31 2020-08-31 Method and device for generating code document and electronic equipment Pending CN112307723A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010900453.5A CN112307723A (en) 2020-08-31 2020-08-31 Method and device for generating code document and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010900453.5A CN112307723A (en) 2020-08-31 2020-08-31 Method and device for generating code document and electronic equipment

Publications (1)

Publication Number Publication Date
CN112307723A true CN112307723A (en) 2021-02-02

Family

ID=74483788

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010900453.5A Pending CN112307723A (en) 2020-08-31 2020-08-31 Method and device for generating code document and electronic equipment

Country Status (1)

Country Link
CN (1) CN112307723A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024066995A1 (en) * 2022-09-29 2024-04-04 华为技术有限公司 Text code editing method and system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010074232A (en) * 2001-04-12 2001-08-04 박우경 Method and system for authoring of wireless contents/site
CN101464799A (en) * 2009-01-16 2009-06-24 天津大学 MPI parallel programming system based on visual modeling and automatic skeleton code generation method
CN107341014A (en) * 2017-06-27 2017-11-10 乐视致新电子科技(天津)有限公司 Electronic equipment, the generation method of technical documentation and device
CN108255714A (en) * 2018-01-02 2018-07-06 深圳壹账通智能科技有限公司 Interface document builds test method and terminal device
CN110825431A (en) * 2019-11-14 2020-02-21 京东数字科技控股有限公司 Interface document processing method, device, system, storage medium and electronic equipment
CN110955416A (en) * 2019-10-12 2020-04-03 平安普惠企业管理有限公司 Interface document generation method, device, equipment and computer storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010074232A (en) * 2001-04-12 2001-08-04 박우경 Method and system for authoring of wireless contents/site
CN101464799A (en) * 2009-01-16 2009-06-24 天津大学 MPI parallel programming system based on visual modeling and automatic skeleton code generation method
CN107341014A (en) * 2017-06-27 2017-11-10 乐视致新电子科技(天津)有限公司 Electronic equipment, the generation method of technical documentation and device
CN108255714A (en) * 2018-01-02 2018-07-06 深圳壹账通智能科技有限公司 Interface document builds test method and terminal device
CN110955416A (en) * 2019-10-12 2020-04-03 平安普惠企业管理有限公司 Interface document generation method, device, equipment and computer storage medium
CN110825431A (en) * 2019-11-14 2020-02-21 京东数字科技控股有限公司 Interface document processing method, device, system, storage medium and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024066995A1 (en) * 2022-09-29 2024-04-04 华为技术有限公司 Text code editing method and system

Similar Documents

Publication Publication Date Title
CN112528595B (en) Document processing method and device and electronic equipment
WO2023040443A1 (en) Method and device for drawing canvas
CN111400625B (en) Page processing method and device, electronic equipment and computer readable storage medium
WO2022218034A1 (en) Interaction method and apparatus, and electronic device
CN115757400B (en) Data table processing method, device, electronic equipment and computer readable medium
WO2024099171A1 (en) Video generation method and apparatus
CN111857720B (en) User interface state information generation method and device, electronic equipment and medium
CN112307375A (en) Page display method and device, electronic equipment and computer readable medium
CN112183045A (en) Online document processing method and device and electronic equipment
CN111273830A (en) Data display method and device, electronic equipment and computer readable medium
CN110148024B (en) Method and device for providing comment input mode
CN110825481A (en) Method and device for displaying page information corresponding to page tag and electronic equipment
CN114995691B (en) Document processing method, device, equipment and medium
CN112256370A (en) Information display method and device and electronic equipment
WO2023160578A1 (en) Information processing method and apparatus, and terminal and storage medium
CN112307723A (en) Method and device for generating code document and electronic equipment
CN111310086A (en) Page jump method and device and electronic equipment
CN111400581A (en) System, method and apparatus for annotating samples
CN112307393A (en) Information issuing method and device and electronic equipment
CN112395109B (en) Clipboard content processing method and device
CN112114735B (en) Method and device for managing tasks
CN110568976B (en) Method, device, equipment and storage medium for controlling application display
CN114239501A (en) Contract generation method, apparatus, device and medium
CN114626332A (en) Content display method and device and electronic equipment
CN113221554A (en) Text processing method and device, electronic equipment and storage medium

Legal Events

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