Update README.md

This commit is contained in:
2026-05-30 16:22:13 +02:00
committed by Josip Tišljar Mataušić
parent 9769b64610
commit 34838936dd
+23 -34
View File
@@ -24,68 +24,57 @@ gemtext2gophermap input.gmi output_gophermap [max line length (default 70)] [pre
## Example
### Input Gemtext
_input.gmi_
````gemtext
Everything until the first <!--break--> in the map file will be put in place of the insert-gopher tag.
**input.gmi**
````markdown
Everything until the first <!--break--> in the map file will be put in place of the following insert-gopher tag.
```html
<!--insert-gopher-->
```
The following <script> tag will be removed because it is between to web-only tags.
The <script> tag should be removed because it is between two web-only tags.
```html
<!--web-only-->
```
```html
<script>
console.log("joj")
</script>
```
```html
<!--web-only-->
```
> Here, the contents after the first break in the map file will be put
> Everything after the first <!--break--> in the map file:
```html
<!--insert-gopher-->
```
````
### A map file
_map.txt_
**map.txt**
```gophermap
<?php
echo "i" . date(DATE_RFC2822) . "\t/FAKE\tNULL\t0";
echo "i" . date(DATE_RFC2822) . "\tFAKE\tNULL\t0";
?>
<!--break-->
iIf your Gopher server supports running PHP it should have printed the current date. /FAKE NULL 0
A line from map.txt
```
### Command
> If a line in map.txt isn't in format `i /PATH host 123` it **will not** automatically get converted into that format,
> your **server is expected to do that** or you should write that explicitly in the map.txt file.
>
> This has been done to allow injecting PHP scripts.
> (to avoid: `i<?php /FAKE NULL 0`)
#### Command
```shell
gemtext2gophermap input.gmi - 70 map.txt
```
If `-` is passed instead of `input/output` file name `stdin/stdout` will be used. Reading the **map file from stdin** is **not supported**.
If `-` is passed instead of `input or output` file name `stdin or stdout` will be used. Reading the **map file from stdin** is **not supported**.
### Output
#### Output
```gophermap
iEverything until the first <!--break--> in the map file will be put in /FAKE NULL 0
iplace of the insert-gopher tag. /FAKE NULL 0
iplace of the following insert-gopher tag. /FAKE NULL 0
<?php
echo "i" . date(DATE_RFC2822) . "\t/FAKE\tNULL\t0";
echo date(DATE_RFC2822);
?>
iThe following <script> tag will be removed because it is between to /FAKE NULL 0
iweb-only tags. /FAKE NULL 0
iThe <script> tag should be removed because it is between two web-only /FAKE NULL 0
itags. /FAKE NULL 0
i> Everything after the first <!--break--> in the map file: /FAKE NULL 0
i> Here, the contents after the first break in the map file will be put /FAKE NULL 0
iIf your Gopher server supports running PHP it should have printed the current date. /FAKE NULL 0
A line from map.txt
```