mirror of
				https://gitlab.com/octtspacc/sitoctt
				synced 2025-06-05 22:09:20 +02:00 
			
		
		
		
	.
This commit is contained in:
		
							
								
								
									
										0
									
								
								Scripts/Build.Termux.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								Scripts/Build.Termux.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @@ -15,7 +15,7 @@ from translate_shell.translate import translate | ||||
| # TODO handle deleted files? (it should probably be done in another sh script, not here) | ||||
|  | ||||
| def printf(*objects): | ||||
| 	print(*objects, end='') | ||||
| 	print(*objects, end='', flush=True) | ||||
|  | ||||
| def get_source_language(document_path): | ||||
| 	return document_path.split('/')[0] | ||||
| @@ -30,7 +30,7 @@ def make_destination_path(document_path, destination_language): | ||||
| def is_translation_uptodate(source_path, destination_path): | ||||
| 	original_lines = split_with_frontmatter(read_original_document(source_path))[1].splitlines() | ||||
| 	translated_lines = split_with_frontmatter(open(destination_path, 'r').read())[1].splitlines() | ||||
| 	for [index, original_line] in enumerate(original_lines): | ||||
| 	for [index, original_line] in enumerate(original_lines[:len(translated_lines)]): | ||||
| 		line_key = original_line.split('=')[0] | ||||
| 		if line_key.strip().lower() == ModificationMetadataKey: | ||||
| 			if original_line != translated_lines[index]: | ||||
| @@ -58,6 +58,7 @@ def find_documents(folder_path): | ||||
| 		if isfile(document_path): | ||||
| 			documents_queue.append('/'.join(str(document_path).split('/')[2:])) | ||||
| 	for document in documents_queue: | ||||
| 		print(f"* {document},", flush=True) | ||||
| 		if needs_translation(document): | ||||
| 			documents[document] = [] | ||||
| 			for destination_language in list(set(DestinationLanguages) - {get_source_language(document)}): | ||||
| @@ -102,22 +103,17 @@ def number_to_ascii(number:int) -> str: | ||||
| # TODO handle code blocks and .notranslate HTML elements | ||||
| # TODO fix strange bugs | ||||
| def wrap_for_translation(original_text): | ||||
| 	#return original_text | ||||
| 	original_text = (original_text | ||||
| 		.replace("{{%", "{{@%").replace("%}}", "%@}}") | ||||
| 		.replace("{{<", "{{@<").replace(">}}", ">@}}")) | ||||
| 	original_tokens = original_text.split("{{@") | ||||
| 	#[(("{{@" if i else '') + c) for [i, c] in enumerate(original_text.split("{{@"))] | ||||
| 	for i in range(1, len(original_tokens)): | ||||
| 		token_tokens = original_tokens[i].split("@}}") | ||||
| 		token_tokens[0] = (f"{TranslationMagic}__" + str(ascii_to_number("{{@" + token_tokens[0] + "@}}")) + "__").replace("9", "9_") | ||||
| 		original_tokens[i] = ''.join(token_tokens) | ||||
| 	#print(unwrap_from_translation(''.join(original_tokens))) | ||||
| 	#exit(1) | ||||
| 	return ''.join(original_tokens) | ||||
|  | ||||
| def unwrap_from_translation(translated_text): | ||||
| 	#return translated_text | ||||
| 	translated_tokens = translated_text.split(f"{TranslationMagic}__") | ||||
| 	for i in range(1, len(translated_tokens)): | ||||
| 		token_tokens = translated_tokens[i].split("__") | ||||
|   | ||||
| @@ -28,13 +28,13 @@ it = "Altre cose" | ||||
| [[10-site]] | ||||
| alt = "CC BY-SA" | ||||
| file = "CC-BY-SA.svg" | ||||
| href = "/it/miscellanea/%EF%B8%8F-Open-Source/" | ||||
| href = "/miscellanea/Open-Source-sitoctt/" | ||||
| #href = "https://creativecommons.org/licenses/by-sa/4.0/deed.it?ref=chooser-v1&title=%E2%9C%A8sitoctt%E2%9C%A8&href=https://sitoctt.octt.eu.org&creator=OctoSpacc" | ||||
|  | ||||
| [[10-site]] | ||||
| alt = "✨sitoctt" | ||||
| file = "Sites/sitoctt-1.png" | ||||
| href = "/it/miscellanea/Raccolta-Siti-Internet/#il-mio" | ||||
| href = "/miscellanea/Raccolta-Siti-Internet/#il-mio" | ||||
|  | ||||
| [[10-site]] | ||||
| alt = "Sign my guestoobk" | ||||
| @@ -65,7 +65,7 @@ href = "http://http.sitoctt.octt.eu.org" | ||||
| [[10-site]] | ||||
| alt = "Download Offline Version" | ||||
| file = "OFF-LINE-VERSION.png" | ||||
| href = "/it/miscellanea/Copie-del-Sito/#archivi-offline" | ||||
| href = "/miscellanea/Copie-sitoctt/#archivi-offline" | ||||
|  | ||||
| ####################################### | ||||
|  | ||||
|   | ||||
| @@ -8,7 +8,7 @@ Oltre alla versione "normale" del sito, cioè servita dagli indirizzi web uffici | ||||
|  | ||||
| ## Archivi Offline | ||||
|  | ||||
| A parte [il codice sorgente disponibile]({{< relref "/miscellanea/Open-Source-sitoctt/" >}}), che può essere archiviato e riutilizzato da chiunque ne abbia le competenze per rigenerare le pagine dalle loro parti essenziali, il sito è progettato per poter essere agevolmente accessibile a tutti senza dipendere dal mio server. | ||||
| A parte [il codice sorgente disponibile]({{< relref "/miscellanea/Open-Source-sitoctt/#repository" >}}), che può essere archiviato e riutilizzato da chiunque ne abbia le competenze per rigenerare le pagine dalle loro parti essenziali, il sito è progettato per poter essere agevolmente accessibile a tutti senza dipendere dal mio server. | ||||
|  | ||||
| Senza bisogno di strumenti speciali (come ne esistono per clonare qualsiasi sito web), è possibile scaricare una copia precompilata di tutti i file del sito in formato di cartella ZIP, altamente compatibile con qualsiasi sistema. Basta scaricare una delle varianti di seguito, scompattare l'intero archivio, ed aprire `index.html` (o qualsiasi altro file HTML) con il browser per navigare offline. | ||||
|  | ||||
| @@ -23,7 +23,7 @@ Il sitoctt non è escluso dall'archivio più grosso al mondo, la _Wayback Machin | ||||
|  | ||||
| Esistono inoltre in giro archivi privati o aperti al pubblico, che potrebbero ospitare anche copie del mio sito. Non ne conosco nessuno, quindi consiglio di esercitare la giusta cautela nel consultarli, casomai dovessero uscirne fuori alcuni. | ||||
|  | ||||
| Chiunque voglia mettere a disposizione una copia del sitoctt su un proprio server può tranquillamente farlo, senza chiedermi esplicito permesso, secondo i termini della licenza; chiedo soltanto che si renda chiaro si tratti di copie (con banner o simili inseriti sulle pagine), e che non si alterino i cosidetti "link canonical" nelle pagine HTML (`<link rel="canonical" ... />`, tag usati dai motori di ricerca per determinare la fonte dei contenuti). | ||||
| Chiunque voglia mettere a disposizione una copia del sitoctt su un proprio server può tranquillamente farlo, senza chiedermi esplicito permesso, [secondo i termini della licenza]({{< relref "/miscellanea/Open-Source-sitoctt/" >}}); chiedo soltanto che si renda chiaro si tratti di copie (con banner o simili inseriti sulle pagine), e che non si alterino i cosidetti "link canonical" nelle pagine HTML (`<link rel="canonical" ... />`, tag usati dai motori di ricerca per determinare la fonte dei contenuti). | ||||
|  | ||||
| ## Domini Alternativi | ||||
|  | ||||
|   | ||||
| @@ -1 +1,5 @@ | ||||
| <a href="{{ .Params.href }}" rel="{{ .Params.rel }}" target="{{ .Params.target }}" title="{{ .Params.title }}">{{ or .Inner .Params.href }}</a> | ||||
| {{- $url := .Params.href -}} | ||||
| {{- if hasPrefix $url "/" -}} | ||||
|   {{- $url = (relref .Params.Context $url) -}} | ||||
| {{- end -}} | ||||
| <a href="{{ $url }}" rel="{{ .Params.rel }}" target="{{ .Params.target }}" title="{{ .Params.title }}">{{ or .Inner .Params.href }}</a> | ||||
|   | ||||
| @@ -1,18 +1,20 @@ | ||||
| {{ $repo := "octospacc/sitoctt" }} | ||||
| {{ $repoId := "R_kgDOHbCR4A" }} | ||||
| {{ $category := "Comments" }} | ||||
| {{ $categoryId := "DIC_kwDOHbCR4M4CiAIZ" }} | ||||
| {{ $theme := "noborder_light" }} | ||||
| {{- $repo := "octospacc/sitoctt" -}} | ||||
| {{- $repoId := "R_kgDOHbCR4A" -}} | ||||
| {{- $category := "Comments" -}} | ||||
| {{- $categoryId := "DIC_kwDOHbCR4M4CiAIZ" -}} | ||||
| {{- $theme := "noborder_light" -}} | ||||
| {{- $slug := printf "all/%s" (delimit (after 2 (split .RelPermalink "/")) "/") -}} | ||||
| <iframe class="GiscusFallback" | ||||
|         style="width: 100%; box-sizing: border-box; height: 100vh;" | ||||
|         src="https://hlb0.octt.eu.org/OcttComments.php?baseUrl={{ .Site.BaseURL }}&pageSlug={{ .RelPermalink }}&theme={{ $theme }}&repo={{ $repo }}&repoId={{ $repoId }}&category={{ $category }}&categoryId={{ $categoryId }}" | ||||
|         src="https://hlb0.octt.eu.org/OcttComments.php?baseUrl={{ .Site.BaseURL }}&pageSlug={{ $slug }}&theme={{ $theme }}&repo={{ $repo }}&repoId={{ $repoId }}&category={{ $category }}&categoryId={{ $categoryId }}" | ||||
| ></iframe> | ||||
| <script src="https://giscus.app/client.js" | ||||
|         data-repo="{{ $repo }}" | ||||
|         data-repo-id="{{ $repoId }}" | ||||
|         data-category="{{ $category }}" | ||||
|         data-category-id="{{ $categoryId }}" | ||||
|         data-mapping="pathname" | ||||
|         data-term="{{ $slug }}" | ||||
|         data-mapping="specific" | ||||
|         data-strict="1" | ||||
|         data-reactions-enabled="1" | ||||
|         data-emit-metadata="0" | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
| {{- $context := . -}} | ||||
| {{- $language := (string .Language) -}} | ||||
| {{- with resources.Get "ButtonBadges.toml" -}} | ||||
|   {{- with . | transform.Unmarshal -}} | ||||
| @@ -7,7 +8,7 @@ | ||||
|           {{- $src := .src -}} | ||||
|           {{- if (or .file .src) -}} | ||||
|             {{- if $src -}} | ||||
|               {{ $src = (partial "functions/ParseFileUrl.html" $src) }} | ||||
|               {{- $src = (partial "functions/ParseFileUrl.html" $src) -}} | ||||
|             {{- end -}} | ||||
|             {{- $newprops := (dict | ||||
|               "decoding" "async" | ||||
| @@ -20,7 +21,7 @@ | ||||
|                 "rel" "nofollow noopener" | ||||
|                 "target" "_blank")) -}} | ||||
|             {{- end -}} | ||||
|             {{ partial "ImgButton.html" (merge . $newprops) }} | ||||
|             {{ partial "ImgButton.html" (merge . $newprops (dict "Context" $context)) }} | ||||
|           {{- else -}} | ||||
|             <h4>{{ partial "functions/FromLanguageObject.html" (dict "Object" .title "Language" $language) }}</h4> | ||||
|           {{- end -}} | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| {{ $url := . }} | ||||
| {{ if hasPrefix . "@" }} | ||||
|   {{ $url = (printf "%s/%s" (partial "assetsRoot") (trim . "@/")) }} | ||||
| {{ end }} | ||||
| {{ return $url }} | ||||
| {{- $url := . -}} | ||||
| {{- if hasPrefix . "@" -}} | ||||
|   {{- $url = (printf "%s/%s" (partial "assetsRoot") (trim . "@/")) -}} | ||||
| {{- end -}} | ||||
| {{- return $url -}} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user