shtanton / gmi2html Goto Github PK
View Code? Open in Web Editor NEWTranslate text/gemini into HTML
License: MIT License
Translate text/gemini into HTML
License: MIT License
Should have some test input and outputs.
Probably use the gemini stress tests for this.
$ zig version
0.9.1
$ gmi2html -h
fish: Job 1, 'gmi2html -h' terminated by signal SIGILL (Illegal instruction)
$ coredumpctl gdb
(gdb) bt
#0 0x000000000023a2f4 in memset ()
#1 0x0000000000208923 in std.os.linux.tls.initTLS ()
#2 0x00000000002074a4 in std.os.linux.tls.initStaticTLS ()
#3 0x0000000000206a50 in std.start.posixCallMainAndExit ()
#4 0x0000000000206883 in _start ()
This could probably be a finite state machine reading one character at a time, although the input and output should be buffered to remain fast.
For now only https
links properly translated to <a href="...">...</a>
.
Line 20 in 2ee16d2
mailto
links in the same way.The use of <br/>
everywhere isn't a very semantic use, and almost all can be removed:
text
should translate to <p>text</p>
<p><br/></p>
<a>
) should translate to <a style="display: block;">content</a>
Inspired by https://codeberg.org/talon/gmi-web
Like v0.4.0 Release, please upload and distribute pre-built binaries in v0.4.1.
Ampersand, angle brackets and quotes all should be escaped
I clone the project on thet latest version on master branch (84cfa53)
zig version : 0.10.1
I'm on archlinux x86_64 Linux 6.2.12-arch1-1
The error :
/home/david/src/gmi2html/src/main.zig:208:16: error: member function expected 0 argument(s), found 1
while (args.next(allocator)) |maybeArg| {
~~~~^~~~~
/usr/lib/zig/std/process.zig:777:9: note: function declared here
pub fn next(self: *ArgIterator) ?([:0]const u8) {
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
callMain: /usr/lib/zig/std/start.zig:614:32
initEventLoopAndCallMain: /usr/lib/zig/std/start.zig:548:51
remaining reference traces hidden; use '-freference-trace' to see all reference traces
error: gmi2html...
error: The following command exited with error code 1:
/usr/bin/zig build-exe /home/david/src/gmi2html/src/main.zig -fno-strip --cache-dir /home/david/src/gmi2html/zig-cache --global-cache-dir /home/david/.cache/zig --name gmi2html -fsingle-threaded --enable-cache
error: the following build command failed with exit code 1:
Some errors that probably should be handled:
-h
should show help, which should also be shown if no input is given-v
should show the versionMaybe something like
--inline-images
--inline-video
--inline-audio
--inline-all
A web page probably isn't that useful if all the links point to places inaccessible from a web browser.
Ideas:
gemini://thing.com
=> https://thing.com
. This works if the whole gemini site is mirrored on the the webThe code would be a lot simpler if all input was done through stdin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.