You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Edit Tags.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,13 @@ If you press the button, you will be greeted with a new GUI.
78
78
79
79
You actually already know how to use this GUI because this is just a mini version of what we did earlier. The GUI only shows transformable tags but other than that the way you edit transforms is just similar to how you work with other tags. If there are multiple transforms, you can switch between those transforms using drop-down menu.
80
80
81
+
## Example 4: Inserting New Tag Section
82
+
83
+
If you want to add a new tag section in the middle of the text, simply add `{}`
84
+
in the text box where you want a new tag section and click `Apply`. The GUI will
85
+
close and reopen with that tag section inserted. Now you can navigate to that
86
+
tag section and add tags to it.
87
+
81
88
# Multi-Line Mode
82
89
83
90
When you select multiple lines and run the script, this mode is run.
local textMode, sectionTable, data, count, transforms
934
+
parseLine = true
935
+
@end
936
+
937
+
** Start a while loop that will continue until exitLoop variable is true
938
+
@code moon
939
+
while true
925
940
@end
926
941
942
+
*** Parse Line
943
+
If the variable parseLine is true, which is always the case in the beginning, we parse the line. The variable is also true when user adds new tag section and we have to reparse the line again.
944
+
927
945
** Collect line data using ASSFoundation
928
946
@code moon
929
-
data = ASS\parse line
947
+
if parseLine
948
+
line = lines[1]
949
+
data = ASS\parse line
930
950
@end
931
951
932
-
** Gather transforms
952
+
*** Gather transforms
933
953
934
-
It's kinda easier to get transform this way than get their values from effective tags. Actually effective tags don't provide transforms at tll. So we're doing this here now while we get all other tags later.
954
+
It's kinda easier to get transform this way than get their values from effective tags. Actually effective tags don't provide transforms at tll. So we're doing this here now while we get all other tags later.
935
955
@code moon
936
-
transforms = data\getTags "transform"
956
+
transforms = data\getTags "transform"
937
957
@end
938
958
939
-
** Clean Tags
959
+
*** Clean Tags
940
960
941
-
Here we don't want to change tags willy nilly. We only want to merge consecutive tag sections so that we have clear distinction of tag, text and drawing sections.
961
+
Here we don't want to change tags willy nilly. We only want to merge consecutive tag sections so that we have clear distinction of tag, text and drawing sections.
942
962
@code moon
943
-
data\cleanTags 0
963
+
data\cleanTags 0
944
964
@end
945
965
946
-
** Loop through all the sections of a line
947
-
We loop through all the sections of a line and collect all the information we need from the line.
966
+
*** Loop through all the sections of a line
967
+
We loop through all the sections of a line and collect all the information we need from the line.
948
968
949
-
The first thing we do is we ignore the comment sections. We aren't touching it in this script. Our goal here is to find effective tags of text or drawing section which we can do but at the same time I also want to find out which tags actually exist in the line itself. These tags will be checked in the GUI so that user can easily differentiate which tags are coming from the line and which tags are effectively applied.
969
+
The first thing we do is we ignore the comment sections. We aren't touching it in this script. Our goal here is to find effective tags of text or drawing section which we can do but at the same time I also want to find out which tags actually exist in the line itself. These tags will be checked in the GUI so that user can easily differentiate which tags are coming from the line and which tags are effectively applied.
950
970
951
-
I do not know any way to find existing tags in text and drawing section currently which is why when we find a tag section, we collect all the tags that we find in that tag section and save it in a variable called *tempExistingTable*. Since we merged consecutive tag sections, these tags will apply to the next text or drawing sections we find which means when we find any text or drawing section, we save these existing tags as the tags that applies to that section. Then we clear the variable *tempExistingTable* for next tag section.
971
+
I do not know any way to find existing tags in text and drawing section currently which is why when we find a tag section, we collect all the tags that we find in that tag section and save it in a variable called *tempExistingTable*. Since we merged consecutive tag sections, these tags will apply to the next text or drawing sections we find which means when we find any text or drawing section, we save these existing tags as the tags that applies to that section. Then we clear the variable *tempExistingTable* for next tag section.
952
972
953
-
After this loop is finished, here's what we get:
954
-
- *tagTable* is table of tables where key is the index of that text or drawing section and its value is table of effective tags for that section.
955
-
- *existingtagTable* is table just like *tagTable* but in this case only the tags that already exist in the line are available.
956
-
- *textTable* is table of tables where key is the index of that text/drawing section and its value is the text of that section.
973
+
After this loop is finished, here's what we get:
974
+
- *tagTable* is table of tables where key is the index of that text or drawing section and its value is table of effective tags for that section.
975
+
- *existingtagTable* is table just like *tagTable* but in this case only the tags that already exist in the line are available.
976
+
- *textTable* is table of tables where key is the index of that text/drawing section and its value is the text of that section.
957
977
958
-
The indexes are important because they are assigned by ASSFoundation to those sections. So, whatever changes the user makes on the GUI will be applied on the basis of those indexes.
978
+
The indexes are important because they are assigned by ASSFoundation to those sections. So, whatever changes the user makes on the GUI will be applied on the basis of those indexes.
0 commit comments