CN112925515A - Editing control method, device, equipment and storage medium - Google Patents

Editing control method, device, equipment and storage medium Download PDF

Info

Publication number
CN112925515A
CN112925515A CN202110265945.6A CN202110265945A CN112925515A CN 112925515 A CN112925515 A CN 112925515A CN 202110265945 A CN202110265945 A CN 202110265945A CN 112925515 A CN112925515 A CN 112925515A
Authority
CN
China
Prior art keywords
code
edited
control
instruction
tag
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.)
Granted
Application number
CN202110265945.6A
Other languages
Chinese (zh)
Other versions
CN112925515B (en
Inventor
李朕
刘子波
朱丽娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Yidu Huida Education Technology Co ltd
Original Assignee
Beijing Yidu Huida Education 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 Yidu Huida Education Technology Co ltd filed Critical Beijing Yidu Huida Education Technology Co ltd
Priority to CN202110265945.6A priority Critical patent/CN112925515B/en
Publication of CN112925515A publication Critical patent/CN112925515A/en
Application granted granted Critical
Publication of CN112925515B publication Critical patent/CN112925515B/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/33Intelligent editors

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

The application provides an editing control method, an editing control device, electronic equipment and a storage medium. The specific implementation scheme is as follows: scanning a code to be edited to obtain a control label in the code to be edited; determining a control range of a marked content area in the code to be edited according to the control tag; and executing a control function corresponding to the control label aiming at the code to be edited in the control range. The method and the device for controlling the editing modes of the codes to be edited can control the functions of displaying or editing the codes to be edited within a specified range, so that a user can arrange the control tags in the codes to be edited according to actual needs, the editing modes of the codes to be edited can be conveniently limited through the control tags, and the preset control purpose is achieved.

Description

Editing control method, device, equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to an editing control method, apparatus, device, and storage medium.
Background
With the development of computer technology, programming is increasingly recognized as a fundamental requisite skill. In part of provinces and cities of China, programming courses are used as necessary courses for primary and secondary schools. The existing online programming teaching system can meet the requirement of online compiling running codes. But the existing code editor can not flexibly and conveniently control the code editing.
Some tutorial code provides fixed methods or logic, such as during the tutorial programming process. The teacher asks the students to write the code according to the provided method or logical structure. The teacher needs to control the key code when placing the programming job. For example, it is desirable to control that the key code is not deleted or modified and to allow the student to edit portions of the code. However, in the editing control method of the existing code editor, only all read-only or all modification is allowed. The editing control mode enables teachers not to arrange programming operation according to actual teaching requirements, and great inconvenience is brought to programming teaching.
Disclosure of Invention
The embodiment of the application provides an editing control method, an editing control device, electronic equipment and a storage medium, which are used for solving the problems in the related art, and the technical scheme is as follows:
in a first aspect, an embodiment of the present application provides an editing control method, including:
scanning a code to be edited to obtain a control label in the code to be edited;
determining a control range of a marked content area in the code to be edited according to the control tag;
and executing a control function corresponding to the control label aiming at the code to be edited in the control range.
In one embodiment, the control tag comprises an edit tag; aiming at the code to be edited in the control range, executing the control function corresponding to the control label, wherein the control function comprises the following steps:
under the condition that the control label is an editing label, acquiring the position coordinate of the current cursor and the coordinate area of the control range;
under the condition that the position coordinate of the current cursor is in the coordinate area of the control range, forbidding the editing function of the code to be edited;
and in the case that the position coordinate of the current cursor is out of the coordinate area of the control range, enabling the editing function of the code to be edited.
In one embodiment, the control tag comprises a hidden tag; aiming at the code to be edited in the control range, executing the control function corresponding to the control label, wherein the control function comprises the following steps:
and under the condition that the control tag is a hidden tag, hiding the code to be edited within the control range in the current editing interface.
In one embodiment, scanning a code to be edited to obtain a control tag in the code to be edited includes:
and matching the code to be edited by using the regular expression to obtain a control label in the code to be edited.
In one embodiment, determining a control range of a marked content area in a code to be edited according to a control tag includes:
acquiring position information of the mark content of the control label in the code to be edited;
and obtaining the control range of the code to be edited according to the position information.
In one embodiment, the method further comprises:
before scanning a code to be edited, acquiring a function configuration parameter;
and under the condition that the function configuration parameters meet preset conditions, executing a step of scanning the code to be edited.
In one embodiment, the method further comprises:
and responding to the code calling instruction, processing the code to be edited to obtain a return code corresponding to the code calling instruction.
In one embodiment, the code fetch instruction includes a store code instruction; the method comprises the following steps:
and under the condition that the code calling instruction is a code storage instruction, splicing the code to be edited within the control range and the code to be edited outside the control range to obtain a return code corresponding to the code storage instruction.
In one embodiment, a code fetch instruction includes executing a code instruction; the method further comprises the following steps:
and under the condition that the code calling instruction is an execution code instruction, replacing the control label in the spliced code by using the regular expression to obtain a return code corresponding to the execution code instruction.
In one embodiment, the code fetch instruction comprises a show code instruction; the method comprises the following steps:
and under the condition that the code calling instruction is a code displaying instruction, obtaining a return code corresponding to the code displaying instruction according to the function configuration parameters.
In a second aspect, an embodiment of the present application provides an editing control apparatus, including:
the scanning unit is used for scanning the code to be edited to obtain a control label in the code to be edited;
the determining unit is used for determining the control range of the marked content area in the code to be edited according to the control label;
and the execution unit is used for executing the control function corresponding to the control label aiming at the code to be edited in the control range.
In one embodiment, the control tag comprises an edit tag; the execution unit is to:
under the condition that the control label is an editing label, acquiring the position coordinate of the current cursor and the coordinate area of the control range;
under the condition that the position coordinate of the current cursor is in the coordinate area of the control range, forbidding the editing function of the code to be edited;
and in the case that the position coordinate of the current cursor is out of the coordinate area of the control range, enabling the editing function of the code to be edited.
In one embodiment, the control tag comprises a hidden tag; the execution unit is to:
and under the condition that the control tag is a hidden tag, hiding the code to be edited within the control range in the current editing interface.
In one embodiment, the scanning unit is configured to:
and matching the code to be edited by using the regular expression to obtain a control label in the code to be edited.
In one embodiment, the determination unit is configured to:
acquiring position information of the mark content of the control label in the code to be edited;
and obtaining the control range of the code to be edited according to the position information.
In one embodiment, the apparatus further comprises a control unit configured to:
before scanning a code to be edited, acquiring a function configuration parameter;
and under the condition that the function configuration parameters meet preset conditions, executing a step of scanning the code to be edited.
In one embodiment, the apparatus further comprises a processing unit configured to:
and responding to the code calling instruction, processing the code to be edited to obtain a return code corresponding to the code calling instruction.
In one embodiment, the code fetch instruction includes a store code instruction; the processing unit is used for:
and under the condition that the code calling instruction is a code storage instruction, splicing the code to be edited within the control range and the code to be edited outside the control range to obtain a return code corresponding to the code storage instruction.
In one embodiment, a code fetch instruction includes executing a code instruction; the processing unit is further configured to:
and under the condition that the code calling instruction is an execution code instruction, replacing the control label in the spliced code by using the regular expression to obtain a return code corresponding to the execution code instruction.
In one embodiment, the code fetch instruction comprises a show code instruction; the processing unit is used for:
and under the condition that the code calling instruction is a code displaying instruction, obtaining a return code corresponding to the code displaying instruction according to the function configuration parameters.
In a third aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor. Wherein the memory and the processor are in communication with each other via an internal connection path, the memory is configured to store instructions, the processor is configured to execute the instructions stored by the memory, and the processor is configured to perform the method of any of the above aspects when the processor executes the instructions stored by the memory.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, which stores a computer program, and when the computer program runs on a computer, the method in any one of the above-mentioned aspects is executed.
The advantages or beneficial effects in the above technical solution at least include: the functions of displaying or editing the code to be edited and the like can be controlled within the specified range, so that a user can arrange a control label in the code to be edited according to actual needs, the editing mode of the code to be edited can be conveniently limited through the control label, and the preset control purpose is achieved.
The foregoing summary is provided for the purpose of description only and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, further aspects, embodiments, and features of the present application will be readily apparent by reference to the drawings and following detailed description.
Drawings
In the drawings, like reference numerals refer to the same or similar parts or elements throughout the several views unless otherwise specified. The figures are not necessarily to scale. It is appreciated that these drawings depict only some embodiments in accordance with the disclosure and are therefore not to be considered limiting of its scope.
Fig. 1 is a flowchart of an edit control method according to an embodiment of the present application;
FIG. 2 is a flow diagram of a partial read-only control of an edit control method according to another embodiment of the present application;
fig. 3 is a flowchart of determining a control range of an edit control method according to another embodiment of the present application;
fig. 4 is a flowchart of function switching of an edit control method according to another embodiment of the present application;
FIG. 5 is a schematic structural diagram of an editing control apparatus according to an embodiment of the present application;
FIG. 6 is a schematic structural diagram of an editing control device according to another embodiment of the present application;
FIG. 7 is a block diagram of an electronic device used to implement embodiments of the present application.
Detailed Description
In the following, only certain exemplary embodiments are briefly described. As those skilled in the art will recognize, the described embodiments may be modified in various different ways, all without departing from the spirit or scope of the present application. Accordingly, the drawings and description are to be regarded as illustrative in nature, and not as restrictive.
Fig. 1 is a flowchart of an editing control method according to an embodiment of the present application. As shown in fig. 1, the editing control method may include:
step S110, scanning a code to be edited to obtain a control label in the code to be edited;
step S120, determining the control range of the marked content area in the code to be edited according to the control label;
step S130, executing a control function corresponding to the control tag for the code to be edited within the control range.
In an application scenario of editing a code, a user needs to flexibly and conveniently control the code editing by using a code editor. For example, during the programming of teaching, some tutorial codes require that a particular method or structure be locked in. The teacher needs to control the code, so that the student cannot edit or delete the code. The teacher sends the codes to be edited to the students and can need to do read-only control at multiple places. And the read-only position in the code to be edited also needs to be configurable, so that the teacher can conveniently carry out read-only configuration on part of the code. The student develops the finished code and needs to check the code running result. For example, in the course of programming teaching, some teaching plan codes are not related to the teaching content of the lesson, and teachers need to hide and control the codes to make the codes invisible to students, so that the students concentrate on learning the codes related to the teaching content of the lesson.
By taking read-only control as an example, before teaching is programmed, when a teacher makes teaching plan codes, all codes can be edited, and the start-stop position of a read-only control range can be configured at the code part needing to be read only. The start-stop position of the read-only control range can be any position in the self-defined code to be edited. In the course of teaching, the student can not modify and delete the code in the read-only control range, but can modify and delete the code outside the read-only control range. And, allowing the student to run the code and view the code running result. After the teaching process is finished, the teacher checks and corrects the student homework, the codes need to display the complete codes completed in the teaching process of the students, and the non-read-only part can correct the codes.
In one example, a user may mark a read-only portion of code to be edited with control tags of a particular extensible markup language. The read-only part of the code to be edited can be marked, for example, with the tag < xiaohou-lock > </xiaohou-lock >. < xiaohou-lock > for marking the start position of the read-only control range; </xiaohou-lock > is used to mark the end of the read-only control range. The code to be edited in the middle of < xiaohou-lock > and </xiaohou-lock > is a read-only code that does not allow editing. The above-mentioned tag < xiaohou-lock > </xiaohou-lock > is referred to as a first editing tag.
In yet another example, a user may mark an editable portion of code to be edited with a control tag of a particular extensible markup language. The editable part of the code to be edited can be marked, for example, with the tag < xiaohou-blank > </xiaohou-blank >. < xiaohou-blank > for marking the start position of the editable portion; </xiaohou-blank > is used to mark the termination position of the editable portion. The code to be edited between < xiaohou-blank > and </xiaohou-blank > is a code allowing editing. Except for the editable portion, other codes in the code to be edited are read-only codes. The above-mentioned tag < xiaohou-blank > </xiaohou-blank > is referred to as a second editing tag.
Taking hidden control as an example, a user may mark a hidden portion of a code to be edited with a control tag of a particular extensible markup language. The hidden part of the code to be edited can be marked, for example, with the tag < xiaohou-hide > </xiaohou-hide >. < xiaohou-hide > for marking the start position of the hidden control range; the </xiaohou-hide > is used to mark the end position of the hidden control range. The code to be edited in the middle of < xiaohou-hide > and </xiaohou-hide > is a hidden code. In the case where the control tab is active, the hidden code is not displayed in the editing interface of the editor. The above-mentioned tag < xiaohou-hide > </xiaohou-hide > is referred to as a hidden tag.
In order to solve the problem that part of codes are controlled in a code editor in the programming teaching process, the function of the editor is expanded, and the editor is packaged. Scanning and primary compiling functions are added to the packaging layer, so that the packaged editor supports a specific extensible markup language.
Taking an application scenario of programming teaching as an example, a teacher may control editing or displaying of a code to be edited by using one of the first editing tag, the second editing tag, and the hidden tag. And the student edits the codes to be edited, which are arranged by the teacher, on the editor.
In step S110, the editor scans the code to be edited to obtain the control tag in the code to be edited. The control tags may include a first edit tag, a second edit tag, or a hide tag. The above three labels can be used in one of the following ways: the first editing label and the hidden label are used in combination; the second editing label and the hidden label are used in combination; the first editing tag is used alone; the second editing tag is used independently; the hidden tag is used alone.
In one example, in the code to be edited sent by the teacher to the student, the teacher may mark the read-only part of the code with a first editing tag; and for the hidden part, the teacher can mark the hidden part by using the hidden label. The first editing label and the hidden label are combined for use, and the control label can be flexibly and conveniently arranged in the code to be edited according to actual needs so as to achieve the preset control purpose.
In step S120, the control range of the marked content area in the code to be edited can be determined according to the scanned control tag. For example, the code to be edited in the middle of < xiaohou-lock > and </xiaohou-lock > is a read-only code that does not allow editing.
In step S130, the code to be edited within the control range is controlled, and the control function corresponding to the control tag is executed.
For example, if the control tag scanned in step S110 is the first editing tag, the editing function is masked for the code to be edited in the middle of < xiaohou-lock > and </xiaohou-lock >.
For another example, if the control tag scanned in step S110 is the second editing tag, the editing function is turned on for the code to be edited between < xiaohou-blank > and </xiaohou-blank >, and the editing function is blocked for other codes in the code to be edited. In other words, the editing function is shielded for a section of code with </xiaohou-blank > as the starting position and < xiaohou-blank > as the ending position, namely the code to be edited between </xiaohou-blank > and < xiaohou-blank >.
For another example, if the control tag scanned in step S110 is a hidden tag, the code to be edited in the middle of < xiaohou-hide > and </xiaohou-hide > is not displayed in the editing interface of the editor.
The method and the device for controlling the editing modes of the codes to be edited can control the functions of displaying or editing the codes to be edited within a specified range, so that a user can arrange the control tags in the codes to be edited according to actual needs, the editing modes of the codes to be edited can be conveniently limited through the control tags, and the preset control purpose is achieved.
Fig. 2 is a flowchart of a part of read-only control of an editing control method according to another embodiment of the present application. As shown in FIG. 2, in one embodiment, the control tags include an edit tag; in step S130 in fig. 1, for a code to be edited within the control range, executing a control function corresponding to the control tag may specifically include:
step S210, acquiring the position coordinate of the current cursor and the coordinate area of the control range under the condition that the control tag is an editing tag;
step S220, under the condition that the position coordinate of the current cursor is in the coordinate area of the control range, forbidding the editing function of the code to be edited;
in step S230, in the case that the position coordinate of the current cursor is outside the coordinate area of the control range, the editing function of the code to be edited is enabled.
In the embodiment of the application, in order to realize the control of the editing function of the code to be edited within the specified range under the condition that the control tag is the editing tag, an editor can be added to monitor the cursor event so as to obtain the position coordinate of the current cursor. It is checked whether the position coordinates of the current cursor are within the coordinate area of the control range according to the control range determined in step S120. And if the coordinate area is judged to be in the coordinate area of the control range, the global editing is forbidden. If the judgment result is outside the coordinate area of the control range, the global editing is started.
For example, if the control tag scanned in step S110 is the first editing tag, the control range is the code to be edited between < xiaohou-lock > and </xiaohou-lock >. If the current cursor position is intermediate between < xiaohou-lock > and </xiaohou-lock >, then global editing is disabled. That is, for a section of code with < xiaohou-lock > as the starting position and </xiaohou-lock > as the ending position in the code to be edited, the editing function is disabled, and for other codes in the code to be edited, the editing function is allowed to be used.
For another example, if the control tag scanned in step S110 is the second editing tag, the control range is the code to be edited between the fraiohou-blank > and the fraiohou-blank >. If the current cursor position is intermediate between </xiaohou-blank > and < xiaohou-blank >, global editing is disabled. That is, for a section of code with </xiaohou-blank > as the starting position or < xiaohou-blank > as the ending position in the code to be edited, the editing function is disabled, and for other codes in the code to be edited, the editing function is allowed to be used.
The method and the device for editing the code can control the code to be edited in a partially read-only mode. The editing control mode enables teachers to arrange programming operation according to actual teaching requirements, and great convenience is brought to programming teaching.
In addition, after the teaching process is finished, the teacher checks and corrects the student homework, the codes need to display the complete codes completed in the teaching process of the students, and the non-read-only part can correct the codes. In this case, the teacher may be restricted from performing correction only in a non-read place by the control tag.
In one embodiment, the control tag comprises a hidden tag; aiming at the code to be edited in the control range, executing the control function corresponding to the control label, wherein the control function comprises the following steps:
and hiding the code to be edited within the control range in the current editing interface under the condition that the control tag is the hidden tag.
If the control tag scanned in step S110 is a hidden tag, the control range is a code to be edited between < xiaohou-hide > and </xiaohou-hide >. The code to be edited in between < xiaohou-hide > and </xiaohou-hide > is not displayed in the current editing interface of the editor.
The method and the device for editing the code can control the code to be edited to be presented in a current editing interface of an editor in a partial display mode. The display control mode enables a teacher to make the code to be edited partially visible according to the actual teaching requirements, thereby being beneficial to highlighting the teaching key point and bringing great convenience to programming teaching.
In an embodiment, in step S110 in fig. 1, scanning a code to be edited to obtain a control tag in the code to be edited may specifically include:
and matching the code to be edited by using the regular expression to obtain a control label in the code to be edited.
A regular expression is a logical formula that operates on a string of characters. When the regular expression is used, a plurality of specific characters which are defined in advance and a combination of the specific characters can be used for forming a 'regular character string'. This "regular string" is used to express a filtering logic for strings. Regular expressions are typically used to retrieve, replace, text that conforms to a certain pattern or a certain rule.
A regular expression may be a text pattern that describes one or more strings of characters to be matched when scanning text. Given one regular expression and another string, the following operations may be performed:
1. and judging whether the given character string conforms to the filtering logic of the regular expression. The process of the above determination may be referred to as "matching".
2. The desired specific portion may be obtained from the character string by a regular expression.
In one example, regular expressions describe a pattern of string matches (pattern) that can be used to check whether a string contains a certain substring. Specific examples are as follows:
matching example 1: with the regular expression "runooo + b", runoob, runooob, or the like can be matched. Where the character "+" indicates that the preceding character must appear at least once. As another example, the regular expression "ab +" describes the feature "a ' and any number ' b ', and then ab, abb, and abbbbbbbbbbbb all conform to this feature.
Matching example 2: with the regular expression "runoo b", runoob, runooooob or the like can be matched. Wherein, the character 'x' represents that the former character may not appear, and may appear once or more times. For example, the preceding character may appear 0 times, 1 time, or more times.
Matching example 3: with the regular expression "color", either color or color can be matched. Wherein, the character? "represents that the preceding character can only appear once at most. That is, the preceding character may appear 0 or 1 times.
Referring to the above example, a regular expression is a text pattern that can be composed of normal characters as well as special characters. Special characters are also referred to as "meta characters". For example, the characters "+" and the characters "? All belong to the meta character. Common characters may include all printable and non-printable characters that are not explicitly specified as meta-characters, such as characters a through z. Common characters may include all upper and lower case letters, all numbers, all punctuation marks, or some other symbol. Common characters in a regular expression, when matching a string, can be used to represent matching the same one of the characters. In the regular expression, the mode description is carried out by combining special characters and common characters, so that the aim of text matching is fulfilled. In addition, in the matching process, the matching position can be obtained by using a regular expression under the condition that the matching is successful. Examples are as follows:
matching example 4: the regular expression is "c", and when the character string "abcde" is matched, the matching result is: success is achieved; the matched contents are: "c"; the matched positions are: starting at 2 and ending at 3. Whether the subscript used to indicate the matching position starts with 0 or 1 may vary depending on the current programming language. In the above example, the subscript for indicating the matching position is from 0, and the character "c" is the 2 nd character in the character string "abcde".
Matching example 5: the regular expression "bcd", when matching the character string "abcde", the matching result is: success is achieved; the matched contents are: "bcd"; the matched positions are: starting at 1 and ending at 4. In the above example, the subscript used to indicate the matching position also starts from 0. The 0 th character in the character string "abcde" is "a". The character "bcd" starts from the 1 st character in the string "abcde".
In another example, there are some representation methods in regular expressions that can match any of a variety of characters. For example, the expression "\ d" can match any one number. Although any of a plurality of characters can be matched, only one character can be matched, and a plurality of characters cannot be matched.
Matching example 6: the regular expression "\\ \ d \ d", when matching the string "abc 123", the result of the match is: success is achieved; the matched contents are: "12"; the matched positions are: starting at 3 and ending at 5.
Matching example 7: the regular expression "a \ d", when matching the character string "aaa 100", the result of the matching is: success is achieved; the matched contents are: "a 1"; the matched positions are: starting at 2 and ending at 4.
In yet another example, brackets [ ] may be used in regular expressions to contain a series of characters, any one of which can be matched. It is possible to use [ < lambda > to contain a series of characters, and then match any character other than the characters therein. Similarly, although any one of the characters can be matched, only one character can be matched, and a plurality of characters cannot be matched. For example, the regular expression "[ ab5@ ]" may be used to match "a", "b", "5", or "@"; the regular expression "[ ^ abc ]" can be used for matching any character except for "a", "b" and "c"; the regular expression "[ f-k ]" can be used for matching any character between "f" to "k"; the regular expression "[ ^ A-F0-3 ]" can be used for matching any character except "A" to "F" and "0" to "3".
Matching example 8: the regular expression "[ bcd ] [ bcd ]", when matching the string "abc 123", the result of the match is: success is achieved; the matched contents are: "bc"; the matched positions are: starting at 1 and ending at 3.
In yet another example, some symbols in a regular expression may affect relationships between sub-expressions within the expression. For example, the character "|" in a regular expression functions to represent the relationship of "or" between expressions on its left and right sides. That is, expressions to the left of the matching character "|" or expressions to the right of the matching character "|".
Matching example 9: when the regular expression "Tom | Jack" matches the character string "I'm Tom, he is Jack", the matching result is: success is achieved; when the expression on the left side of the character "|" is matched, the matched content is as follows: "Tom"; the matched positions are: starting at 4 and ending at 7. When the expression on the right of the character "|" is matched, the matching result is: success is achieved; the matched contents are: "Jack"; matching the position: beginning at 15 and ending at 19. In the matching string "I'm Tom, he is Jack" of the above example, there is a comma "followed by a space, so that the matching position of the matching content" Jack "is started at 15.
In this embodiment of the application, if the control tag obtained by scanning in step S110 is the first editing tag, the editor scans whether the code to be edited includes the tag < xiaohou-lock > </xiaohou-lock > of the specific extension markup language, and the following regular expressions can be used to match the code to be edited:
/<xiaohou-lock>([^]*?)<\/xiaohou-lock>/igm
where "i" in "igm" indicates case indifference, "g" in "igm" indicates a global in-range match, and "m" in "igm" indicates a cross-row match.
And obtaining the control tags in the codes to be edited and the code content contained in the control tags through matching. In one example, the read-only content value sets preserves may be preset, and the code content obtained by matching may be stored in the preset read-only content value sets preserves.
Fig. 3 is a flowchart of determining a control range of an editing control method according to another embodiment of the present application. As shown in fig. 3, in an embodiment, in step S120 in fig. 1, determining a control range of a marked content area in a code to be edited according to a control tag may specifically include:
step S310, acquiring the position information of the mark content of the control label in the code to be edited;
and step S320, obtaining the control range of the code to be edited according to the position information.
In step S310, according to the control tag scanned in step S110, the position information of the mark content of the control tag in the code to be edited can be determined. For example, the range of the marked content in the editor can be searched according to the read-only content value sets preserves. In step S320, a control range including an anchor point may be generated according to the position information of the mark content. Wherein the start-stop position of the control range in the editor can be marked with an anchor point. In editing code using an editor, for example, adding or deleting characters, the absolute position of the anchor point may change as the editing content changes, but the relative position of the anchor point always corresponds to the starting position of the control tag. In one example, a read-only start-stop range array preservedanchrs may be preset, and the generated control range including the anchor point may be stored in the preset read-only start-stop range array preservedanchrs.
Fig. 4 is a flowchart of function switching of an editing control method according to another embodiment of the present application. As shown in fig. 4, in one embodiment, the method further includes:
step S410, before scanning the code to be edited, acquiring function configuration parameters;
step S420, if the function configuration parameter meets the preset condition, executing the step of scanning the code to be edited.
In this embodiment, the initial value of the function configuration parameter markup may be preconfigured for controlling whether the recognition of a specific extensible markup language is enabled. For example, if the teacher sends codes to be edited to students, which need to do partial read-only control, the initial value of the function configuration parameter markup is set to true; if the teacher does not need to do partial read-only control, the initial value of the function configuration parameter markup is set to false. When the packaged editor is called to be mounted in a page, the initial value of markup is firstly checked in the initialization method of the editor so as to detect whether the function of identifying a specific extensible markup language is enabled. If the markup is false, the specific extensible markup language is not enabled to be identified, the control tag does not function, and the code editing mode in the editor is not limited. If the value of markup is true, the specific extensible markup language is enabled to be identified, and the editing mode of the code to be edited can be limited through the control tag. For example, in step S420, if the value of markup is true, the function configuration parameter satisfies the preset condition. In this case, the step of scanning the code to be edited is performed, the specific extensible markup language is identified, and the editing mode of the code to be edited is limited by the control tag.
In the related art, a conventional processing manner may be to previously set a read-only area in a document and store position information of the read-only area in the document. And searching the stored position information for read-only control during editing control. In contrast, on one hand, the control tag for marking the read-only part of the code in the embodiment of the application is directly written in the code, and the position information of the read-only area does not need to be additionally stored, so that the storage organization mode of the code file is simple and easy to implement. On the other hand, in the embodiment of the application, the initial value of the parameter markup is configured in advance, and whether the specific extensible markup language is started to be identified is controlled, so that the function switching mode is simple and easy to implement. Compared with the scheme of the related technology, if the limitation of partial read-only is not made, the set read-only area must be removed, and the mode of function switching is relatively complicated.
In one embodiment, the method further comprises:
and responding to the code calling instruction, processing the code to be edited to obtain a return code corresponding to the code calling instruction.
The method and the device for calling the editor package have the advantages that a layer of calling method is packaged based on the editor, and the packaged editor supports the specific extensible markup language. The packaged editor may return three types of editor values: 1) code currently presented in the editor; 2) a full-scale code including a specific extensible markup language; 3) executable code for a particular extensible markup language is not included.
The editor may respond to different external calls to corresponding code invocation requests. And responding to the code calling instruction, processing the code to be edited to obtain a return code corresponding to the code calling instruction. In one example, when code needs to be stored, an external call needs to obtain the full amount of code that contains a particular extensible markup language. In which case the editor will receive the store code instruction from an external call. In another example, when code needs to be executed, an external call needs to obtain executable code that does not contain a particular extensible markup language. In which case the editor will receive instructions to execute code from an external call. In yet another example, the external call requires that the code currently being exposed within the editor be acquired when information related to the front-end exposure needs to be acquired. In which case the editor will receive the show code instructions from an external call.
In one embodiment, the code fetch instruction includes a store code instruction; the method comprises the following steps:
and under the condition that the code calling instruction is a code storage instruction, splicing the code to be edited within the control range and the code to be edited outside the control range to obtain a return code corresponding to the code storage instruction.
When code needs to be stored, an external call needs to get the full amount of code that contains a particular extended markup language. Except that the full amount of codes containing specific extension markup languages are required to be acquired by external calling when the codes are stored, after the teaching process is finished, a teacher checks and corrects the homework of students, and the complete codes finished by the students in the teaching process can also be required to be displayed. In this case, it is also necessary to acquire the full-size code including the specific extended markup language.
When external calling needs to acquire a full code containing a specific extension markup language, code contents within and outside a control range can be acquired according to a read-only start-stop range array preservedAnchors respectively, and then a part of a code to be edited, which is subjected to read-only control, and a part of the code not subjected to read-only control are spliced in an inserting manner, so that the full code corresponding to the code to be edited can be acquired.
Taking programming teaching as an example, when an external call needs to acquire a full amount of codes containing a specific extension markup language, whether a student edits a code to be edited in an editor can be detected. If the student does not perform editing operation, the above-mentioned step of inserting and assembling does not need to be executed, and the full code containing the specific extended markup language corresponding to the code to be edited can be directly used as the return code. And if the student edits the code to be edited, executing the inserting and assembling steps, and taking the full code corresponding to the code to be edited obtained by inserting and assembling as a return code of the code calling instruction.
In one embodiment, a code fetch instruction includes executing a code instruction; the method further comprises the following steps:
and under the condition that the code calling instruction is an execution code instruction, replacing the control label in the spliced code by using the regular expression to obtain a return code corresponding to the execution code instruction.
In the example of programming teaching, a student develops completed code and needs to view the code execution results. The external call then needs to obtain executable code that does not contain the specific extensible markup language. The editor receives the execution code instructions from an external call. In response to the code execution instruction, the above-mentioned inserting and assembling steps can be executed first to obtain the full code corresponding to the code to be edited. Then using the regular expression/\/? The xiaohou- \ w \/ig replaces the part successfully matched with the control label with null, namely, the control label is replaced, namely, the executable code without the specific extensible markup language, namely the executable code corresponding to the code to be edited is obtained. The executable code may be treated as return code corresponding to the execution code instructions.
In one embodiment, the code fetch instruction comprises a show code instruction; the method comprises the following steps:
and under the condition that the code calling instruction is a code displaying instruction, obtaining a return code corresponding to the code displaying instruction according to the function configuration parameters.
When the external call needs to acquire the code currently displayed in the editor, the editor receives a code display instruction from the external call. In response to the display code instruction, the editor may obtain the display code of the current editing interface according to the value of the function configuration parameter markup. First look at the value of the function configuration parameter markup. If the value of markup is false, then the presentation code of the current editing interface is returned without the control tag. If the value of markup is true, then the presentation code of the current editing interface containing the control tag is returned. The above-described show code may be taken as a return code corresponding to the show code instruction.
In the embodiment of the application, codes comprising different information can be acquired according to different external requirements, for example, under various different scenes such as storage, editing and debugging of code files. For example, full code is fetched at store time and executable code is fetched at debug time. The mode enables the storage, the editing and the debugging of the code file to be more flexible and convenient, and can meet the code calling requirements under different scenes.
In an application scenario of program teaching, an ace editor is usually used to edit a code to be edited. The ace is an open source, stand-alone, browser-based code editor that can be embedded into any web page or JavaScript application. An exemplary procedure for performing a partial read-only control of a code to be edited using a first editing tag < xiaohou-lock > </xiaohou-lock > is as follows:
first, an ace instantiation method is packaged into a layer of calling method. In the calling method, the initial value of the function configuration parameter markup can be configured. The function configuration parameter markup is used for controlling whether the ace editor is enabled to recognize a specific extensible markup language. In addition, a read-only content value array preserveds and a read-only start-stop range array preservedanchos can also be defined. The packaged editor may return three types of editor values: 1) the code editorValue currently being exposed within the editor; 2) a currValue code containing a specific extensible markup language; 3) executable code execvlue of a specific extensible markup language is not included.
Second, when the packaged editor component is mounted in the page, the initialization method first detects whether the specific extensible markup language is enabled. If the value of markup is false, the function of identifying the particular extensible markup language is not enabled. If the value of markup is true, then functionality is enabled to identify the particular extensible markup language.
Thirdly, when the value of markup is true, the editor scans whether the global code of the code to be edited contains the specific extensible markup language < xiaohou-lock > </xiaohou-lock >. The method can match codes to be edited by utilizing a regular expression, and store the codes matched between the < xiaohou-lock > and the </xiaohou-lock > into a preset read-only content value array preserves.
And fourthly, setting the full code containing the specific extensible markup language as an editor value. In this step, a code to be edited is input into the editor.
Fifthly, searching the rank range of the first editing label in the editor according to the read-only content value array preserves, calling a function editor.
Sixth, utilizing the regular expression/<'? The xiaohou-lock >/igm replaces the specific extension markup language in each element in preserves, i.e. the first edit tag is removed in the content value array preserves. The student does not display the first edit tab when editing the code with the ace editor, so the first edit tab is removed in this step.
And seventhly, calling new Range () according to the line Range obtained in the fifth step, and creating a read-only line Range object which does not contain the specific extension markup language. The "read-only line range not containing the specific extensible markup language" does not include the first edit tag. And calling a function editor.getSession ().doc.createAnchor () according to the read-only line range which does not contain the specific extension markup language to generate a control range with an anchor point. And storing the generated control range with the anchor point into a preset read-only starting-stopping range array preservedAnchors. And taking the read-only starting and stopping range as a control range of the code to be edited.
And eighthly, the addition editor monitors cursor events. And when the position of the cursor changes, triggering an event and calling a callback function. The callback function is encapsulated by setTimeout, so that the callback function is added into an execution queue as a task. Where setTimeout () can accept two parameters, the first being the callback function and the second being the number of milliseconds to defer execution. The meaning of setTimeout () is to add an event at the tail of the task queue and execute the callback function after the existing events of the synchronization task and the task queue are processed. For example, the callback function is executed after the enter key operation is detected. The specific function of the callback function is to check whether the current cursor position is within the read-only start-stop range. If the current cursor position is judged to be within the read-only starting and stopping range, then the edit is called, and the global editing is forbidden; if the current cursor position is judged to be out of the read-only start-stop range, the edge.
And ninthly, when external calling is carried out, acquiring a full code containing a specific extensible markup language, and inserting and splicing code contents in a read-only start-stop range and code contents outside the read-only start-stop range. The code content in the read-only start-stop range can be obtained by using a loop structure call editor. The code content in a read-only start-stop range can be acquired in a loop body of the loop structure. Determining the execution times of the loop body according to the following conditions: (1) reading a start-stop range array preservedAnchors; (2) whether the starting point of the first range of the read-only starting-stopping range array is the starting point of the whole document or not; (3) whether the last dead point of the read-only start-stop range array is the dead point of the entire document. And after the loop execution is finished, obtaining the full code containing the specific extensible markup language.
Tenth, when the external call is made, the executable code not containing the specific extensible markup language needs to be obtained, the full-scale code containing the specific extensible markup language needs to be obtained according to the ninth step, and then the regular expression/\/? xiaohou- \ w \/ig replaces the part where the matching was successful with null, i.e. obtains executable code that does not contain a specific extended markup language.
Eleventh, when the external call is performed, the code displayed in the current edit box needs to be acquired, and the function edit. And determining whether the display code of the current editing interface contains a control tag according to the value of the function configuration parameter markup. If markup is false, the display code of the current editing interface does not contain a control tag. If the value of markup is true, the display code of the current editing interface contains a control label.
An exemplary procedure for performing a partial read-only control of the code to be edited using the second editing tag < xiaohou-blank > </xiaohou-blank > is as follows:
first, an ace instantiation method is packaged into a layer of calling method. In the calling method, the initial value of the function configuration parameter markup can be configured. The function configuration parameter markup is used for controlling whether the ace editor is enabled to recognize a specific extensible markup language. In addition, a blank content value array blanks, a blank-to-blank content array blankGaps and a blank start-stop range array blankAnchors can be defined. The packaged editor may return three types of editor values: 1) the code editorValue currently being exposed within the editor;
2) a currValue code containing a specific extensible markup language; 3) executable code execvlue of a specific extensible markup language is not included.
In the second step, when the packaged editor component is hung in the page, whether the specific extensible markup language is enabled or not is firstly detected in the initialization method. If the value of markup is false, the function of identifying the particular extensible markup language is not enabled. If the value of markup is true, then functionality is enabled to identify the particular extensible markup language.
Thirdly, when the value of markup is true, the editor scans whether the global code of the code to be edited contains the specific extensible markup language < xiaohou-blank > </xiaohou-blank >. Codes to be edited can be matched by using a regular expression/< xiaohou-blank > ([ ] is. The code content in the blank content value sets blanks is allowed to be edited.
Fourth, the code to be edited can be matched using the regular expression/< xiaohou-blank > ([ ^ ]. And cutting the position where the matching is successful into a front part and a rear part:
1) < xiaohou-blank > and comprises < xiaohou-blank >;
2) (ii) a code between and including </xiaohou-blank > and < xiaohou-blank >;
3) (iii) the code following (and including) the </xiaohou-blank >.
And forming an array by using a plurality of partial codes obtained by truncation, and storing the array into a content array blanket Gaps between preset blanks. The code content in the content array blank Gaps between blank and blank is read-only.
And fifthly, setting the full code containing the specific extensible markup language as an editor value.
And sixthly, searching the line range of the content between the blank and the blank in the code to be edited in the editor according to the blank and blank content array blankGaps, and simultaneously obtaining the line range of the content at the blank in the code to be edited. Get session (). addMarker (range, 'blank-highlight') is called and the blank is set with a highlight pattern.
Seventh step, utilizing the regular expression/<'? The xiaohou-blank >/igm replaces the specific extension markup language in each element in blanks, i.e. the first edit tag is removed in the content value array preserves.
And eighthly, calling new Range () according to the line Range of the blank content obtained in the sixth step, and creating a blank line Range object which does not contain the specific extended markup language. The "blank line range not including the specific extensible markup language" does not include the second edit tag. And calling edge. And storing the generated range with the anchor point into a preset blank starting and stopping range array blank anchors. And determining the control range of the code to be edited according to the blank starting and stopping range.
And ninthly, adding an editor to monitor the cursor event. And when the position of the cursor changes, triggering an event and calling a callback function. The callback function is encapsulated by setTimeout, so that the callback function is added into an execution queue as a task. The callback function has the specific function of checking whether the current cursor position is within the blank starting and stopping range. If the blank start-stop range is judged to be within the blank start-stop range, the edge. If the blank start-stop range is judged to be out of the blank start-stop range, an edge.
And tenth, when external calling is carried out, acquiring a full code containing a specific extensible markup language, and inserting and splicing the content between the blank and the content at the blank. Content within the blank start-stop range may be obtained using a loop structure call editor. And determining the number of times of loop execution according to the length of the blank start-stop range array blankAnchors. After the loop execution is completed, the contents between the last blank and the blank are added, and then the full code containing the specific extensible markup language is obtained.
Eleventh, when the external call is made, the executable code not containing the specific extensible markup language needs to be obtained, the full-scale code containing the specific extensible markup language needs to be obtained according to the tenth step, and then the regular expression/\/? xiaohou- \ w \/ig replaces the part where the matching was successful with null, i.e. obtains executable code that does not contain a specific extended markup language.
Twelfth, when the external call is performed, the code displayed in the current edit box needs to be acquired, and the code displayed in the current edit box can be acquired by directly calling the edit. And determining whether the display code of the current editing interface contains a control tag according to the value of the function configuration parameter markup.
Fig. 5 is a schematic structural diagram of an editing control apparatus according to an embodiment of the present application. As shown in fig. 5, the apparatus may include:
the scanning unit 100 is configured to scan a code to be edited to obtain a control tag in the code to be edited;
a determining unit 200, configured to determine a control range of a marked content area in the code to be edited according to the control tag;
and the execution unit 300 is configured to execute a control function corresponding to the control tag for the code to be edited within the control range.
In one embodiment, the control tag comprises an edit tag; the execution unit 300 is configured to:
under the condition that the control label is an editing label, acquiring the position coordinate of the current cursor and the coordinate area of the control range;
under the condition that the position coordinate of the current cursor is in the coordinate area of the control range, forbidding the editing function of the code to be edited;
and in the case that the position coordinate of the current cursor is out of the coordinate area of the control range, enabling the editing function of the code to be edited.
In one embodiment, the control tag comprises a hidden tag; the execution unit 300 is configured to:
and hiding the code to be edited within the control range in the current editing interface under the condition that the control tag is the hidden tag.
In one embodiment, the scanning unit 100 is configured to:
and matching the code to be edited by using the regular expression to obtain a control label in the code to be edited.
In one embodiment, the determining unit 200 is configured to:
acquiring position information of the mark content of the control label in the code to be edited;
and obtaining the control range of the code to be edited according to the position information.
Fig. 6 is a schematic structural diagram of an editing control device according to another embodiment of the present application. As shown in fig. 6, in an embodiment, the apparatus further includes a control unit 105, and the control unit 105 is configured to:
before scanning a code to be edited, acquiring a function configuration parameter;
and under the condition that the function configuration parameters meet preset conditions, executing a step of scanning the code to be edited.
In an embodiment, the apparatus further comprises a processing unit 400, the processing unit 400 is configured to:
and responding to the code calling instruction, processing the code to be edited to obtain a return code corresponding to the code calling instruction.
In one embodiment, the code fetch instruction includes a store code instruction; the processing unit 400 is configured to:
and under the condition that the code calling instruction is a code storage instruction, splicing the code to be edited within the control range and the code to be edited outside the control range to obtain a return code corresponding to the code storage instruction.
In one embodiment, a code fetch instruction includes executing a code instruction; the processing unit 400 is further configured to:
and under the condition that the code calling instruction is an execution code instruction, replacing the control label in the spliced code by using the regular expression to obtain a return code corresponding to the execution code instruction.
In one embodiment, the code fetch instruction comprises a show code instruction; the processing unit 400 is configured to:
and under the condition that the code calling instruction is a code displaying instruction, obtaining a return code corresponding to the code displaying instruction according to the function configuration parameters.
The functions of each module and each unit in each apparatus in the embodiment of the present application may refer to the corresponding description in the above method, and are not described herein again.
FIG. 7 is a block diagram of an electronic device used to implement embodiments of the present application. As shown in fig. 7, the electronic apparatus includes: a memory 910 and a processor 920, the memory 910 having stored therein computer programs operable on the processor 920. The processor 920 implements the editing control and image generation method in the above-described embodiments when executing the computer program. The number of the memory 910 and the processor 920 may be one or more.
The electronic device further includes:
and a communication interface 930 for communicating with an external device to perform data interactive transmission.
If the memory 910, the processor 920 and the communication interface 930 are implemented independently, the memory 910, the processor 920 and the communication interface 930 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 7, but this is not intended to represent only one bus or type of bus.
Optionally, in an implementation, if the memory 910, the processor 920 and the communication interface 930 are integrated on a chip, the memory 910, the processor 920 and the communication interface 930 may complete communication with each other through an internal interface.
Embodiments of the present application provide a computer-readable storage medium, which stores a computer program, and when the program is executed by a processor, the computer program implements the method provided in the embodiments of the present application.
The embodiment of the present application further provides a chip, where the chip includes a processor, and is configured to call and execute the instruction stored in the memory from the memory, so that the communication device in which the chip is installed executes the method provided in the embodiment of the present application.
An embodiment of the present application further provides a chip, including: the system comprises an input interface, an output interface, a processor and a memory, wherein the input interface, the output interface, the processor and the memory are connected through an internal connection path, the processor is used for executing codes in the memory, and when the codes are executed, the processor is used for executing the method provided by the embodiment of the application.
It should be understood that the processor may be a Central Processing Unit (CPU), other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or any conventional processor or the like. It is noted that the processor may be an advanced reduced instruction set machine (ARM) architecture supported processor.
Further, optionally, the memory may include a read-only memory and a random access memory, and may further include a nonvolatile random access memory. The memory may be either volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The non-volatile memory may include a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. Volatile memory can include Random Access Memory (RAM), which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available. For example, Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), double data rate synchronous SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM), and direct memory bus RAM (DR RAM).
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the present application are generated in whole or in part when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process. And the scope of the preferred embodiments of the present application includes other implementations in which functions may be performed out of the order shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. All or part of the steps of the method of the above embodiments may be implemented by hardware that is configured to be instructed to perform the relevant steps by a program, which may be stored in a computer-readable storage medium, and which, when executed, includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module may also be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. The storage medium may be a read-only memory, a magnetic or optical disk, or the like.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various changes or substitutions within the technical scope of the present application, and these should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (22)

1. An editing control method, comprising:
scanning a code to be edited to obtain a control label in the code to be edited;
determining the control range of the marked content area in the code to be edited according to the control label;
and executing a control function corresponding to the control label aiming at the code to be edited in the control range.
2. The method of claim 1, wherein the control tag comprises an edit tag; and executing a control function corresponding to the control label aiming at the code to be edited in the control range, wherein the control function comprises the following steps:
under the condition that the control tag is the editing tag, acquiring the position coordinate of the current cursor and the coordinate area of the control range;
under the condition that the position coordinate of the current cursor is within the coordinate area of the control range, forbidding the editing function of the code to be edited;
and enabling the editing function of the code to be edited under the condition that the position coordinate of the current cursor is out of the coordinate area of the control range.
3. The method of claim 1, wherein the control tag comprises a hidden tag; and executing a control function corresponding to the control label aiming at the code to be edited in the control range, wherein the control function comprises the following steps:
and hiding the code to be edited in the control range in the current editing interface under the condition that the control tag is the hidden tag.
4. The method according to any one of claims 1 to 3, wherein scanning a code to be edited to obtain a control tag in the code to be edited comprises:
and matching the code to be edited by using a regular expression to obtain a control label in the code to be edited.
5. The method according to claim 4, wherein determining the control range of the marked content area in the code to be edited according to the control tag comprises:
acquiring position information of the mark content of the control label in the code to be edited;
and obtaining the control range of the code to be edited according to the position information.
6. The method according to any one of claims 1 to 3, further comprising:
before scanning the code to be edited, acquiring a function configuration parameter;
and under the condition that the function configuration parameters meet preset conditions, executing the step of scanning the code to be edited.
7. The method of claim 6, further comprising:
and responding to a code calling instruction, processing the code to be edited to obtain a return code corresponding to the code calling instruction.
8. The method of claim 7, wherein the code invocation instruction comprises a store code instruction; the method comprises the following steps:
and under the condition that the code calling instruction is a code storage instruction, splicing the code to be edited in the control range and the code to be edited outside the control range to obtain a return code corresponding to the code storage instruction.
9. The method of claim 8, wherein the code fetch instruction comprises an execute code instruction; the method further comprises the following steps:
and under the condition that the code calling instruction is an execution code instruction, replacing the control label in the spliced code by using a regular expression to obtain a return code corresponding to the execution code instruction.
10. The method of claim 7, wherein the code invocation instruction comprises a show code instruction; the method comprises the following steps:
and under the condition that the code calling instruction is a display code instruction, obtaining a return code corresponding to the display code instruction according to the function configuration parameters.
11. An editing control apparatus, comprising:
the scanning unit is used for scanning a code to be edited to obtain a control label in the code to be edited;
the determining unit is used for determining the control range of the marked content area in the code to be edited according to the control label;
and the execution unit is used for executing the control function corresponding to the control label aiming at the code to be edited in the control range.
12. The apparatus of claim 11, wherein the control tag comprises an edit tag; the execution unit is to:
under the condition that the control tag is the editing tag, acquiring the position coordinate of the current cursor and the coordinate area of the control range;
under the condition that the position coordinate of the current cursor is within the coordinate area of the control range, forbidding the editing function of the code to be edited;
and enabling the editing function of the code to be edited under the condition that the position coordinate of the current cursor is out of the coordinate area of the control range.
13. The apparatus of claim 11, wherein the control tag comprises a hidden tag; the execution unit is to:
and hiding the code to be edited in the control range in the current editing interface under the condition that the control tag is the hidden tag.
14. The apparatus of any of claims 11 to 13, wherein the scanning unit is configured to:
and matching the code to be edited by using a regular expression to obtain a control label in the code to be edited.
15. The apparatus of claim 14, wherein the determining unit is configured to:
acquiring position information of the mark content of the control label in the code to be edited;
and obtaining the control range of the code to be edited according to the position information.
16. The apparatus according to any one of claims 11 to 13, further comprising a control unit for:
before scanning the code to be edited, acquiring a function configuration parameter;
and under the condition that the function configuration parameters meet preset conditions, executing the step of scanning the code to be edited.
17. The apparatus of claim 16, further comprising a processing unit to:
and responding to a code calling instruction, processing the code to be edited to obtain a return code corresponding to the code calling instruction.
18. The apparatus of claim 17, wherein the code fetching instruction comprises a store code instruction; the processing unit is configured to:
and under the condition that the code calling instruction is a code storage instruction, splicing the code to be edited in the control range and the code to be edited outside the control range to obtain a return code corresponding to the code storage instruction.
19. The apparatus of claim 18, wherein the code fetch instruction comprises an execute code instruction; the processing unit is further to:
and under the condition that the code calling instruction is an execution code instruction, replacing the control label in the spliced code by using a regular expression to obtain a return code corresponding to the execution code instruction.
20. The apparatus of claim 17, wherein the code invocation instruction comprises a show code instruction; the processing unit is configured to:
and under the condition that the code calling instruction is a display code instruction, obtaining a return code corresponding to the display code instruction according to the function configuration parameters.
21. An electronic device comprising a processor and a memory, the memory having stored therein instructions that are loaded and executed by the processor to implement the method of any of claims 1 to 10.
22. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 10.
CN202110265945.6A 2021-03-11 2021-03-11 Editing control method, device, equipment and storage medium Active CN112925515B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110265945.6A CN112925515B (en) 2021-03-11 2021-03-11 Editing control method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110265945.6A CN112925515B (en) 2021-03-11 2021-03-11 Editing control method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112925515A true CN112925515A (en) 2021-06-08
CN112925515B CN112925515B (en) 2024-06-21

Family

ID=76172672

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110265945.6A Active CN112925515B (en) 2021-03-11 2021-03-11 Editing control method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112925515B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023279699A1 (en) * 2021-07-06 2023-01-12 上海商汤智能科技有限公司 Experiment generation methods and apparatus, electronic device, storage medium and program

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3728710A (en) * 1969-12-01 1973-04-17 Hendrix Wire & Cable Corp Character display terminal
JPH07152734A (en) * 1993-11-30 1995-06-16 Sharp Corp Document information processor
US20040213275A1 (en) * 2003-04-28 2004-10-28 International Business Machines Corp. Packet classification using modified range labels
US20090292548A1 (en) * 2008-05-20 2009-11-26 Fuze Digital Solutions, Llc Method, system, and program product for information editorial controls
CN103777935A (en) * 2012-10-24 2014-05-07 阿里巴巴集团控股有限公司 Webpage processing method and device
CN105117205A (en) * 2015-07-24 2015-12-02 北京奇虎科技有限公司 Web page editing method and web page editing device
CN107797794A (en) * 2017-10-17 2018-03-13 北京华航唯实机器人科技股份有限公司 Edit methods, device, storage medium, processor and the terminal of program code
CN110659526A (en) * 2018-06-29 2020-01-07 珠海金山办公软件有限公司 Document processing method and device and electronic equipment
CN111273899A (en) * 2020-01-17 2020-06-12 北京达佳互联信息技术有限公司 Code processing method and device, electronic equipment and storage medium
CN111767563A (en) * 2020-08-03 2020-10-13 腾讯科技(深圳)有限公司 Method, device, terminal and storage medium for setting authority of online document

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3728710A (en) * 1969-12-01 1973-04-17 Hendrix Wire & Cable Corp Character display terminal
JPH07152734A (en) * 1993-11-30 1995-06-16 Sharp Corp Document information processor
US20040213275A1 (en) * 2003-04-28 2004-10-28 International Business Machines Corp. Packet classification using modified range labels
US20090292548A1 (en) * 2008-05-20 2009-11-26 Fuze Digital Solutions, Llc Method, system, and program product for information editorial controls
CN103777935A (en) * 2012-10-24 2014-05-07 阿里巴巴集团控股有限公司 Webpage processing method and device
CN105117205A (en) * 2015-07-24 2015-12-02 北京奇虎科技有限公司 Web page editing method and web page editing device
CN107797794A (en) * 2017-10-17 2018-03-13 北京华航唯实机器人科技股份有限公司 Edit methods, device, storage medium, processor and the terminal of program code
CN110659526A (en) * 2018-06-29 2020-01-07 珠海金山办公软件有限公司 Document processing method and device and electronic equipment
CN111273899A (en) * 2020-01-17 2020-06-12 北京达佳互联信息技术有限公司 Code processing method and device, electronic equipment and storage medium
CN111767563A (en) * 2020-08-03 2020-10-13 腾讯科技(深圳)有限公司 Method, device, terminal and storage medium for setting authority of online document

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2023279699A1 (en) * 2021-07-06 2023-01-12 上海商汤智能科技有限公司 Experiment generation methods and apparatus, electronic device, storage medium and program

Also Published As

Publication number Publication date
CN112925515B (en) 2024-06-21

Similar Documents

Publication Publication Date Title
US7143350B2 (en) Method and system for character sequence checking according to a selected language
KR102150779B1 (en) Method and device for positioning pages about incorrectly entered information
US20050193330A1 (en) Methods and systems for eBook storage and presentation
US20080098302A1 (en) Method for Spell-Checking Location-Bound Words Within a Document
US6119136A (en) Manuscript text composition system featuring a parameter table for specifying template parameters and characters
CN108170660B (en) Multi-language typesetting display method, device, browser, terminal and medium
JPH04229364A (en) Method and system for changing emphasizing characteristic
JP2007141123A (en) Link of same character strings in different files
CN111291533B (en) Sentence segment to be displayed display method and device, computer equipment and storage medium
CN112925515B (en) Editing control method, device, equipment and storage medium
Krause Introducing Bootstrap 4
CN113220738A (en) Business rule generation method, device, equipment and storage medium
CN113919287B (en) Entity relationship labeling method and device combining RPA and AI and electronic equipment
JP2005322082A (en) Document attribute input device and method
JP2007233630A (en) Browser screen-display device, and program for the same
JP2005251127A (en) Pattern system construction device and pattern application device
JP2870375B2 (en) Sentence correction device
JPH0128974B2 (en)
JPH10269203A (en) Automatic linking device
Story The AcroTEX eDucation Bundle
Story The AcroTEX eDucation Bundle (AeB)
JPS6050573A (en) Electronic grammer learning machine
CN118113861A (en) Writing assisting method, writing assisting device, electronic equipment, medium and product
JP3050811B2 (en) Parsing tree database construction support device
JP2940921B2 (en) Electronic learning machine

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