Jump to page: 1 2 3
Thread overview
How to represent multiple files in a forum post?
Feb 14
user1234
Feb 14
user1234
Feb 14
Seb
5 days ago
Martin Nowak
5 days ago
Jonathan Marler
4 days ago
Martin Nowak
4 days ago
Jonathan Marler
4 days ago
Sönke Ludwig
4 days ago
Timothee Cour
4 days ago
Jonathan Marler
4 days ago
Jonathan Marler
2 days ago
Seb
2 days ago
Basile B.
February 14
@timotheecour and I came up with a solution to a common problem:

How to represent multiple files in a forum post?

So we decided to take a stab at creating a standard! (queue links to https://xkcd.com/927)

We're calling it "har" (inspired by the name tar). Here's the REPO: https://github.com/marler8997/har and here's what it looks like:

--- file1.d
module file1;

--- file2.d
module file2;

// some cool stuff

--- main.d
import file1, file2;
void main() { }

--- Makefile
main: main.d file1.d file2.d
    dmd main.d file1.d file2.d

The repo contains the standard in README.md and a reference implementation for extracting files from a har file (archiving not implemented yet).

One of the great things is when someone creates a post with this format, you can simply copy paste it to "stuff.har" and then extract it with `har stuff.har`.  No need to create each individual file and copy/paste the contents to each one.

Is this going to change the world? No...but seems like a nice solution to an minor annoyance :)
February 14
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler wrote:
> @timotheecour and I came up with a solution to a common problem:
>
> How to represent multiple files in a forum post?
>
> So we decided to take a stab at creating a standard! (queue links to https://xkcd.com/927)
>
> We're calling it "har" (inspired by the name tar). Here's the REPO: https://github.com/marler8997/har and here's what it looks like:
>
> --- file1.d
> module file1;
>
> --- file2.d
> module file2;
>
> // some cool stuff
>
> --- main.d
> import file1, file2;
> void main() { }
>
> --- Makefile
> main: main.d file1.d file2.d
>     dmd main.d file1.d file2.d
>
> The repo contains the standard in README.md and a reference implementation for extracting files from a har file (archiving not implemented yet).
>
> One of the great things is when someone creates a post with this format, you can simply copy paste it to "stuff.har" and then extract it with `har stuff.har`.  No need to create each individual file and copy/paste the contents to each one.
>
> Is this going to change the world? No...but seems like a nice solution to an minor annoyance :)

how does it mix with markdown, html etc ?
They'll have to use escapes to be compliant, haven't they ?
February 14
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler wrote:
> @timotheecour and I came up with a solution to a common problem:
>
> How to represent multiple files in a forum post?

What's wrong with https://gist.github.com?

FYI: I have it on my agenda to work with Vladimir to add run.dlang.io support to DFeed (the software that runs this forum) [1].

Ideally it will be like those runnable snippets on StackOverflow [2].

[1] https://github.com/CyberShadow/DFeed
[2] https://stackoverflow.blog/2014/09/16/introducing-runnable-javascript-css-and-html-code-snippets/
February 14
On Wednesday, 14 February 2018 at 18:44:06 UTC, user1234 wrote:
> how does it mix with markdown, html etc ?
> They'll have to use escapes to be compliant, haven't they ?

Works great with mardown.

```
--- file1
Contents of file1

--- file2
Contents of file2

```
February 14
On Wednesday, 14 February 2018 at 18:45:59 UTC, Seb wrote:
> On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler wrote:
>> @timotheecour and I came up with a solution to a common problem:
>>
>> How to represent multiple files in a forum post?
>
> What's wrong with https://gist.github.com?

I'm not sure how that allows you to represent multiple files in a forum post, or how it would help you download the files locally to reproduce/test them.

February 14
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler wrote:
> @timotheecour and I came up with a solution to a common problem:
>
> How to represent multiple files in a forum post?

I've been using:
https://github.com/CyberShadow/misc/blob/master/dir2bug.d

Looks pretty similar to har, but the delimiters use syntax used for comments in D and C-like languages.

February 14
On Wednesday, 14 February 2018 at 18:47:31 UTC, Jonathan Marler wrote:
> On Wednesday, 14 February 2018 at 18:44:06 UTC, user1234 wrote:
>> how does it mix with markdown, html etc ?
>> They'll have to use escapes to be compliant, haven't they ?
>
> Works great with mardown.
>
> ```
> --- file1
> Contents of file1
>
> --- file2
> Contents of file2
>
> ```

hyphens are used for titles in some flavors.
February 14
On Wednesday, 14 February 2018 at 18:52:35 UTC, user1234 wrote:
> On Wednesday, 14 February 2018 at 18:47:31 UTC, Jonathan Marler wrote:
>> On Wednesday, 14 February 2018 at 18:44:06 UTC, user1234 wrote:
>>> how does it mix with markdown, html etc ?
>>> They'll have to use escapes to be compliant, haven't they ?
>>
>> Works great with mardown.
>>
>> ```
>> --- file1
>> Contents of file1
>>
>> --- file2
>> Contents of file2
>>
>> ```
>
> hyphens are used for titles in some flavors.

2 things mitigate that.

1) Markdown does not preprocess text in between triple backticks
2) Even if you didn't put your HAR file in between triple backticks:
  Har uses "newline, dash, dash, dash, space, name"
  Markdown uses "newline, dash, dash, dash, dash*, newline"

These don't actually conflict, i.e.

Markdown title
---
--- har file
February 14
On Wednesday, 14 February 2018 at 18:33:23 UTC, Jonathan Marler wrote:
> @timotheecour and I came up with a solution to a common problem:
>
> How to represent multiple files in a forum post?
>
> So we decided to take a stab at creating a standard! (queue links to https://xkcd.com/927)
>
> We're calling it "har" (inspired by the name tar).

Clever name. Har D har har {ducks!} :)

> Here's the REPO: https://github.com/marler8997/har and here's what it looks like:
>
> --- file1.d
> module file1;
>
> --- file2.d
> module file2;
>
> // some cool stuff
>
> --- main.d
> import file1, file2;
> void main() { }
>
> --- Makefile
> main: main.d file1.d file2.d
>     dmd main.d file1.d file2.d

This looks handy.

Yes, it's easy enough in markdown docs to just put code block markers around them (such as ``` or ~~~).

Can the har file delimiter be more than three characters?

What do you think of allowing trailing dashes (or whatever the delim chars are) after the file/dir name? It would make it easier to see the delimiters for larger har'd files.

    --- file1.d -------------------
    module file1;

    --- file2.d -------------------
    module file2;

(Note that markdown allows extra trailing characters with its ATX-style headers, and Pandoc does likewise with ATX headers as well as its div syntax (delimited by at least three colons), for that very reason --- to make it easier to spot them.)

February 14
On Wednesday, 14 February 2018 at 20:16:32 UTC, John Gabriele wrote:
> Can the har file delimiter be more than three characters?

Yes.  So long as the delimiter is the consistent across the whole file, i.e.

-------- file1
-------- file2

(See https://github.com/marler8997/har#custom-delimiters)

>
> What do you think of allowing trailing dashes (or whatever the delim chars are) after the file/dir name? It would make it easier to see the delimiters for larger har'd files.
>
>     --- file1.d -------------------
>     module file1;
>
>     --- file2.d -------------------
>     module file2;
>
> (Note that markdown allows extra trailing characters with its ATX-style headers, and Pandoc does likewise with ATX headers as well as its div syntax (delimited by at least three colons), for that very reason --- to make it easier to spot them.)

Given the simplicity of the addition and the the fact that other standards have found it helps readability...I think you've made a fair case.

I'll add a note in the README to be a probable addition.



« First   ‹ Prev
1 2 3