@@ -45,3 +45,4 @@ glife.html
__pycache__/
+mods/modable_glife.html
@@ -0,0 +1 @@
+<tw-passagedata pid="1680" name="Start_before" tags="mod" position="1225,20975" size="100,100">Modded with Example Mod</tw-passagedata>
@@ -0,0 +1,3 @@
+@ECHO off
+
+Python -X utf8 mods/util/MakeMod.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+import os
+import fileinput
+import re
+import sys
+modTag = "mod"
+file_path_html = 'glife.html'
+file_path_mod = 'mods/mod.html'
+data = ''
+modData = ''
+with open(file_path_html, 'r') as file:
+ data = file.read()
+i = 0
+regex = r"""<tw-passagedata pid="(\d+)" name="([\s\w]+)" tags="(.*?)" (?:position="\d+,\d+" )?(?:size="\d+,\d+")?>(.*?)</tw-passagedata>"""
+for match in re.finditer(regex,data,re.S):
+ tags = match.group(3).split()
+ if(modTag in tags):
+ modData += match.group(0)+'\n'
+ i += 1
+ if(i % 100 == 0):
+ print(i)
+with open(file_path_mod, 'w') as file:
+ file.write(modData)
+print('Done')
+Python -X utf8 mods/util/MakeModableHtml.py
@@ -0,0 +1,21 @@
+file_path_out = 'mods/modable_glife.html'
+data = re.sub(r"""(<script id="script-sugarcube" type="text/javascript">)(.*?)(</script>)""",r"""\1$.ajax({ url: "test.html", cache: false}) .done(function( html ) { $( "tw-storydata" ).append( html );\2});\3""",data,1, re.S)
+with open(file_path_out, 'w') as file:
+ file.write(data)
@@ -12,6 +12,11 @@
<<include 'PassageHeaderAll'>>
+<<if Story.has($here+'_before')>>
+ <<include `$here+'_before'`>>
+<</if>>
:: PassageHeaderAll
<!-- Also exists for subpassages and if CLA was called -->
<div id="connectedLocations"></div>
@@ -0,0 +1,2 @@
+:: Start_before[mod]
+Modded with Example Mod