Compare commits
2 Commits
7338784e3b
...
bafcb245f3
Author | SHA1 | Date | |
---|---|---|---|
![]() |
bafcb245f3 | ||
![]() |
8178e1ba52 |
@ -11,14 +11,17 @@ from urllib.parse import urlparse
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
raw_url = urlparse("https://git.fsfe.org/FSFE/activities/raw/branch/master/activities.csv")
|
raw_url = urlparse(
|
||||||
|
"https://git.fsfe.org/FSFE/activities/raw/branch/master/activities.csv"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def create_activities_file():
|
def create_activities_file():
|
||||||
git_token = os.environ.get("GIT_TOKEN")
|
git_token = os.environ.get("GIT_TOKEN")
|
||||||
if git_token is None:
|
if git_token is None:
|
||||||
logger.warn("GIT_TOKEN is not set, skipping generation of activities file")
|
logger.warn("GIT_TOKEN is not set, skipping generation of activities file")
|
||||||
return
|
return
|
||||||
|
|
||||||
url = raw_url._replace(query=f"token={git_token}").geturl()
|
url = raw_url._replace(query=f"token={git_token}").geturl()
|
||||||
r = requests.get(url)
|
r = requests.get(url)
|
||||||
|
|
||||||
@ -40,11 +43,11 @@ def create_activities_file():
|
|||||||
activities += f' <option value="{tag}||{description}"'
|
activities += f' <option value="{tag}||{description}"'
|
||||||
if event:
|
if event:
|
||||||
activities += f' data-event="{event}"'
|
activities += f' data-event="{event}"'
|
||||||
|
|
||||||
activities += '>'
|
activities += ">"
|
||||||
activities += f"{tag} ({description})"
|
activities += f"{tag} ({description})"
|
||||||
activities += "</option>\n"
|
activities += "</option>\n"
|
||||||
|
|
||||||
content = f"""<?xml version="1.0" encoding="UTF-8"?>
|
content = f"""<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<data>
|
<data>
|
||||||
@ -58,5 +61,5 @@ def create_activities_file():
|
|||||||
activities_path = Path("global/data/modules/fsfe-activities-options.en.xml")
|
activities_path = Path("global/data/modules/fsfe-activities-options.en.xml")
|
||||||
with open(activities_path, "w") as f:
|
with open(activities_path, "w") as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
logger.info(f"Wrote activity file to {str(activities_path)}")
|
logger.info(f"Wrote activity file to {str(activities_path)}")
|
||||||
|
@ -36,7 +36,11 @@ def _process_dir(languages: list[str], target: Path, dir: Path) -> None:
|
|||||||
else basename.with_suffix(".en.xhtml")
|
else basename.with_suffix(".en.xhtml")
|
||||||
),
|
),
|
||||||
processor,
|
processor,
|
||||||
target_file.with_suffix("").with_suffix(".xmllist"),
|
(
|
||||||
|
source_file.parent.joinpath(
|
||||||
|
"." + basename.name
|
||||||
|
).with_suffix(".xmllist")
|
||||||
|
),
|
||||||
Path(f"global/data/texts/.texts.{lang}.xml"),
|
Path(f"global/data/texts/.texts.{lang}.xml"),
|
||||||
Path(f"global/data/topbanner/.topbanner.{lang}.xml"),
|
Path(f"global/data/topbanner/.topbanner.{lang}.xml"),
|
||||||
Path("global/data/texts/texts.en.xml"),
|
Path("global/data/texts/texts.en.xml"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user