Commit Graph

87 Commits

Author SHA1 Message Date
Emii Tatsuo 34dca8d92d
Impl ToString for Builder, accept AsRef<[Node]> in `render()`
continuous-integration/drone/pr Build is failing Details
This adds a to_string method to the `Builder` allowing for the easy conversion of a Vec<Node> into a String, for any usecases where a library might not be directly writing to an io::Write, or may want to do String-y things with your document first.  Without this, users would have to write to a Vec<u8> and convert to a String, which is kinda unintuitive, takes a lot of steps, and doesn't produce very readable code.  This simplifies it to one method call.

* Implementation of the std::str::ToString method for Builder
* Accepting any AsRef<[Node]> in render (including accepting the old Vec<Node>, so not breaking)
* Addition of estimate_len() to Node, used to pre-allocate the correct size of the String buffer

* `estimate_len` has some quick doctests and examples.  I know most of the rest of the project uses test methods, but I hope this is alright given that the tests may add some more clarity to the purpose and function of the method.
* `to_string` has a single line of unsafe code.  As the associated comment explains, this is provably safe, and exists just to avoid having to choose between having a bunch of duplicate code or inefficiently performing a UTF-8 check on a whole bunch bytes that we already know are safe.  That said, I totally get it if you're just generally against unsafe code and will change it to be an alternative if you so wish
* ToString is implemented instead of Display.  This is to discourage users from directly using this in a println!() or write!() macro, which would not be a thing you would normally expect to do with this.  It also gives us the advantage of being able to pre-allocate a buffer size, meaning less expensive String resizing.
* I couldn't think of a clever way to get `render()` to work with both `io::Write`s or `fmt::Write`s without duplicating the code, but I'm dumb and might be missing something, so if there's a way to do that instead of doing my funky unsafe hack that's cool and I can do that instead.
2020-11-29 23:17:15 -05:00
Cadey Ratio c743056263 Remove kindlegen from shell.nix
continuous-integration/drone/push Build is passing Details
Closes #11
2020-11-01 22:47:28 +00:00
Cadey Ratio bebfa4d7b1 release gemtext 0.2.1 with clone fix from @boringcactus
continuous-integration/drone/push Build is passing Details
2020-10-06 17:43:42 -04:00
Cadey Ratio 725957bf8c Merge pull request 'make gemtext::Node `Clone`' (#10) from boringcactus/maj:make-gemtext-node-clone into main
continuous-integration/drone/push Build is passing Details
Reviewed-on: #10
2020-10-06 21:42:28 +00:00
Melody Horn c07d81077a make gemtext::Node `Clone`
continuous-integration/drone/pr Build is passing Details
2020-10-05 04:38:19 -06:00
Cadey Ratio d437ac6e8f version bump for gemtext
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-09-26 19:21:03 -04:00
Cadey Ratio f2a251e829 version bump
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-09-26 19:12:29 -04:00
Cadey Ratio e58a01d14d Merge pull request 'escape special prefixes in plaintext nodes' (#9) from boringcactus/maj:preserve-texthood-of-text-nodes into main
continuous-integration/drone/push Build is failing Details
Reviewed-on: #9
2020-09-26 23:09:23 +00:00
Melody Horn 3cd71ce302 escape special prefixes in plaintext nodes
continuous-integration/drone/pr Build is passing Details
2020-09-26 15:22:39 -06:00
Cadey Ratio 85a3cfda4a double oops
continuous-integration/drone/push Build is failing Details
2020-08-08 16:17:35 -04:00
Cadey Ratio 740ac00628 use gemtext crate :D 2020-08-08 16:14:07 -04:00
Cadey Ratio 6058af8b44 update gemtext metadata for publication
continuous-integration/drone/push Build is failing Details
2020-08-08 16:11:02 -04:00
Cadey Ratio bae0ccb136 refactor gemtext tools into its own crate
continuous-integration/drone/push Build is failing Details
2020-08-08 16:10:20 -04:00
Cadey Ratio 6b9070e200 majc: fix redirects
continuous-integration/drone/push Build is failing Details
2020-08-08 16:05:13 -04:00
Cadey Ratio 1429602370 oops
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-08-08 12:14:13 -04:00
Cadey Ratio f5d9e09e40 version 0.6.0
continuous-integration/drone/push Build is failing Details
2020-08-08 12:11:31 -04:00
Cadey Ratio a533ebbeaf fix CGI support 2020-08-08 12:08:03 -04:00
Cadey Ratio 1da65dcfeb add CGI support
continuous-integration/drone/push Build is passing Details
2020-08-08 11:23:44 -04:00
Cadey Ratio ccb142d8b3 Update 'VERSION'
continuous-integration/drone/push Build is passing Details
2020-08-06 19:08:57 +00:00
Cadey Ratio ddcb5afbc4 fix?
continuous-integration/drone/push Build was killed Details
2020-08-06 14:45:48 -04:00
Cadey Ratio 17a69980e0 tix tarot
continuous-integration/drone/push Build is passing Details
2020-08-05 16:16:41 -04:00
Cadey Ratio 9f19054993 add RPG character backstory generator
continuous-integration/drone/push Build is passing Details
2020-08-05 16:03:42 -04:00
Cadey Ratio f80bdd45e7 fix fix
continuous-integration/drone/push Build is passing Details
2020-08-02 03:16:29 +00:00
Cadey Ratio 0a3c6fb23f cleanup http rendering
continuous-integration/drone/push Build is passing Details
2020-08-02 03:13:01 +00:00
Cadey Ratio c6f15577bb fix 2020-08-02 02:45:36 +00:00
Cadey Ratio 00f8fdc9e1 shitpost: serve HTTP
continuous-integration/drone/push Build is passing Details
2020-08-01 22:42:44 -04:00
Cadey Ratio ff88b28688 oops
continuous-integration/drone/push Build is passing Details
2020-08-01 22:51:14 +00:00
Cadey Ratio ad7947c5fa serve cetacean.club
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
2020-08-01 21:55:08 +00:00
Cadey Ratio 4b7374b39f adapt majsite to serve cetacean.club
continuous-integration/drone/push Build is passing Details
2020-08-01 16:47:34 -04:00
Cadey Ratio 0ffd86c9f6 more words
continuous-integration/drone/push Build is passing Details
2020-08-01 12:02:12 -04:00
Cadey Ratio 2c2fc3ee09 better stuff :D 2020-08-01 12:02:12 -04:00
Cadey Ratio 28ae14ffa7 input test and static file serving with majsite 2020-08-01 12:02:12 -04:00
Cadey Ratio d2af2c5f08 file serving 2020-08-01 12:02:12 -04:00
Cadey Ratio 91328c4188 fix gitignore 2020-08-01 12:02:12 -04:00
Cadey Ratio c6567cc99d karnycukta experiment 2020-08-01 12:02:12 -04:00
Cadey Ratio 3c9fb6eeb3 why is this not working
continuous-integration/drone/push Build is passing Details
2020-07-31 16:43:09 +00:00
Cadey Ratio 93a5dd445a majc: fix rendering of gemlog.blue
continuous-integration/drone/push Build is passing Details
2020-07-28 16:02:48 -04:00
Cadey Ratio 70074e0075 fix
continuous-integration/drone/push Build is passing Details
2020-07-27 21:43:31 -04:00
Cadey Ratio 8984355c4e Update 'Cargo.toml'
continuous-integration/drone/tag Build is passing Details
continuous-integration/drone/push Build is passing Details
2020-07-28 01:39:57 +00:00
Cadey Ratio cd3cd13cd2 Merge pull request 'maj-async-std' (#4) from maj-async-std into main
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build was killed Details
Reviewed-on: #4
2020-07-28 01:36:01 +00:00
Cadey Ratio cd6ef8a516 cert info
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/pr Build is passing Details
2020-07-27 21:21:24 -04:00
Cadey Ratio 04a0c8e988 more helpers
continuous-integration/drone/push Build is passing Details
2020-07-27 21:03:50 -04:00
Cadey Ratio b47c1a69a2 response building helpers
continuous-integration/drone/push Build is passing Details
2020-07-27 20:50:42 -04:00
Cadey Ratio dd6f7f4e7d update changelog
continuous-integration/drone/push Build is passing Details
2020-07-27 20:31:54 -04:00
Cadey Ratio 4216f6b709 gemini: add document rendering function
continuous-integration/drone/push Build is passing Details
2020-07-27 20:31:05 -04:00
Cadey Ratio 851d7925c5 gemini: add document builder 2020-07-27 20:25:00 -04:00
Cadey Ratio 8495c5ab0d pass gemini torture tests
continuous-integration/drone/push Build is passing Details
2020-07-27 20:11:57 -04:00
Cadey Ratio 2bc1aa315f use async-std and tokio i guess
continuous-integration/drone/push Build is passing Details
2020-07-27 20:01:09 -04:00
Cadey Ratio 564eb3990c bump changelog
continuous-integration/drone/push Build is failing Details
2020-07-27 19:51:45 -04:00
Cadey Ratio aa4715abd8 even smaller binaries 2020-07-27 19:50:41 -04:00