{"thread":{"id":"39872","subject":"[PATCH] userdiff: add support for Fountain documents","startedAt":"2015-07-17T14:21:52Z","lastAt":"2015-07-19T12:30:28Z","messageCount":4,"participants":["Zoë Blade","Junio C Hamano","Zoë Blade"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"266238","messageId":"1437142912-25380-1-git-send-email-zoe@bytenoise.co.uk","threadId":"39872","inReplyTo":null,"subject":"[PATCH] userdiff: add support for Fountain documents","fromName":"Zoë Blade","fromEmail":"zoe@bytenoise.co.uk","sentAt":"2015-07-17T14:21:52Z","receivedAt":"2015-07-17T14:21:52Z","isPatch":true,"sender":{"key":"zoe@bytenoise.co.uk","avatar":"https://avatars.githubusercontent.com/u/502434?v=4"},"body":"Add support for Fountain, a plain text screenplay format.  Git\nfacilitates not just programming specifically, but creative writing\nin general, so it makes sense to also support other plain text\ndocuments besides source code.\n\nIn the structure of a screenplay specifically, scenes are roughly\nanalogous to functions, in the sense that it makes your job easier\nif you can see which ones were changed in a given range of patches.\n\nMore information about the Fountain format can be found on its\nofficial website, at http://fountain.io .\n\nSigned-off-by: Zoë Blade <zoe@bytenoise.co.uk>\n---\n Documentation/gitattributes.txt | 2 ++\n t/t4018-diff-funcname.sh        | 1 +\n t/t4018/fountain-scene          | 4 ++++\n userdiff.c                      | 2 ++\n 4 files changed, 9 insertions(+)\n create mode 100644 t/t4018/fountain-scene\n\ndiff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\nindex 81fe586..e3b1de8 100644\n--- a/Documentation/gitattributes.txt\n+++ b/Documentation/gitattributes.txt\n@@ -527,6 +527,8 @@ patterns are available:\n \n - `fortran` suitable for source code in the Fortran language.\n \n+- `fountain` suitable for Fountain documents.\n+\n - `html` suitable for HTML/XHTML documents.\n \n - `java` suitable for source code in the Java language.\ndiff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\nindex 1dbaa38..67373dc 100755\n--- a/t/t4018-diff-funcname.sh\n+++ b/t/t4018-diff-funcname.sh\n@@ -31,6 +31,7 @@ diffpatterns=\"\n \tcpp\n \tcsharp\n \tfortran\n+\tfountain\n \thtml\n \tjava\n \tmatlab\ndiff --git a/t/t4018/fountain-scene b/t/t4018/fountain-scene\nnew file mode 100644\nindex 0000000..6b3257d\n--- /dev/null\n+++ b/t/t4018/fountain-scene\n@@ -0,0 +1,4 @@\n+EXT. STREET RIGHT OUTSIDE - DAY\n+\n+CHARACTER\n+You didn't say the magic phrase, \"ChangeMe\".\ndiff --git a/userdiff.c b/userdiff.c\nindex 2ccbee5..5316b48 100644\n--- a/userdiff.c\n+++ b/userdiff.c\n@@ -35,6 +35,8 @@ IPATTERN(\"fortran\",\n \t  * they would have been matched above as a variable anyway. */\n \t \"|[-+]?[0-9.]+([AaIiDdEeFfLlTtXx][Ss]?[-+]?[0-9.]*)?(_[a-zA-Z0-9][a-zA-Z0-9_]*)?\"\n \t \"|//|\\\\*\\\\*|::|[/<>=]=\"),\n+PATTERNS(\"fountain\", \"^((INT|EST|EXT)?\\\\.[A-Z0-9' -]+)$\",\n+\t \"[^ \\t-]+\"),\n PATTERNS(\"html\", \"^[ \\t]*(<[Hh][1-6][ \\t].*>.*)$\",\n \t \"[^<>= \\t]+\"),\n PATTERNS(\"java\",\n-- \n2.5.0.rc2.28.g6003e7f.dirty\n"},{"id":"266254","messageId":"xmqq1tg63dzv.fsf@gitster.dls.corp.google.com","threadId":"39872","inReplyTo":"1437142912-25380-1-git-send-email-zoe@bytenoise.co.uk","subject":"Re: [PATCH] userdiff: add support for Fountain documents","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-17T17:12:04Z","receivedAt":"2015-07-17T17:12:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Zoë Blade <zoe@bytenoise.co.uk> writes:\n\n> Add support for Fountain, a plain text screenplay format.  Git\n> facilitates not just programming specifically, but creative writing\n> in general, so it makes sense to also support other plain text\n> documents besides source code.\n>\n> In the structure of a screenplay specifically, scenes are roughly\n> analogous to functions, in the sense that it makes your job easier\n> if you can see which ones were changed in a given range of patches.\n>\n> More information about the Fountain format can be found on its\n> official website, at http://fountain.io .\n>\n> Signed-off-by: Zoë Blade <zoe@bytenoise.co.uk>\n> ---\n\nThe test looks a bit too brief (i.e. there is only one obvious\ncandidate to be picked as the funcname header in the input, so it is\nvery hard to break the expectation of the test even when the code or\npattern is modified incorrectly), but it would do for now.\nEverything else looks trivially OK ;-)\n\nThanks, will queue.\n\n\n>  Documentation/gitattributes.txt | 2 ++\n>  t/t4018-diff-funcname.sh        | 1 +\n>  t/t4018/fountain-scene          | 4 ++++\n>  userdiff.c                      | 2 ++\n>  4 files changed, 9 insertions(+)\n>  create mode 100644 t/t4018/fountain-scene\n>\n> diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt\n> index 81fe586..e3b1de8 100644\n> --- a/Documentation/gitattributes.txt\n> +++ b/Documentation/gitattributes.txt\n> @@ -527,6 +527,8 @@ patterns are available:\n>  \n>  - `fortran` suitable for source code in the Fortran language.\n>  \n> +- `fountain` suitable for Fountain documents.\n> +\n>  - `html` suitable for HTML/XHTML documents.\n>  \n>  - `java` suitable for source code in the Java language.\n> diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh\n> index 1dbaa38..67373dc 100755\n> --- a/t/t4018-diff-funcname.sh\n> +++ b/t/t4018-diff-funcname.sh\n> @@ -31,6 +31,7 @@ diffpatterns=\"\n>  \tcpp\n>  \tcsharp\n>  \tfortran\n> +\tfountain\n>  \thtml\n>  \tjava\n>  \tmatlab\n> diff --git a/t/t4018/fountain-scene b/t/t4018/fountain-scene\n> new file mode 100644\n> index 0000000..6b3257d\n> --- /dev/null\n> +++ b/t/t4018/fountain-scene\n> @@ -0,0 +1,4 @@\n> +EXT. STREET RIGHT OUTSIDE - DAY\n> +\n> +CHARACTER\n> +You didn't say the magic phrase, \"ChangeMe\".\n> diff --git a/userdiff.c b/userdiff.c\n> index 2ccbee5..5316b48 100644\n> --- a/userdiff.c\n> +++ b/userdiff.c\n> @@ -35,6 +35,8 @@ IPATTERN(\"fortran\",\n>  \t  * they would have been matched above as a variable anyway. */\n>  \t \"|[-+]?[0-9.]+([AaIiDdEeFfLlTtXx][Ss]?[-+]?[0-9.]*)?(_[a-zA-Z0-9][a-zA-Z0-9_]*)?\"\n>  \t \"|//|\\\\*\\\\*|::|[/<>=]=\"),\n> +PATTERNS(\"fountain\", \"^((INT|EST|EXT)?\\\\.[A-Z0-9' -]+)$\",\n> +\t \"[^ \\t-]+\"),\n>  PATTERNS(\"html\", \"^[ \\t]*(<[Hh][1-6][ \\t].*>.*)$\",\n>  \t \"[^<>= \\t]+\"),\n>  PATTERNS(\"java\",\n"},{"id":"266292","messageId":"xmqq380m1k3g.fsf@gitster.dls.corp.google.com","threadId":"39872","inReplyTo":"xmqq1tg63dzv.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] userdiff: add support for Fountain documents","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-17T22:43:15Z","receivedAt":"2015-07-17T22:43:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Zoë Blade <zoe@bytenoise.co.uk> writes:\n>\n>> More information about the Fountain format can be found on its\n>> official website, at http://fountain.io .\n\nSo I visited there.\n\n>> +PATTERNS(\"fountain\", \"^((INT|EST|EXT)?\\\\.[A-Z0-9' -]+)$\",\n>> +\t \"[^ \\t-]+\"),\n\nAfter skimming http://fountain.io/syntax I am getting the impression\nthat this might be a bit too limiting.\n\n * Although uppercase is recommended for Scene Headings to increase\n   readability, it is not required.\n\n * A line beginning with any of the following, followed by either a\n   dot or a space, is considered a Scene Heading (unless the line is\n   preceded by an exclamation point !). Case insensitive.\n\n      INT\n      EXT\n      EST\n      INT./EXT\n      INT/EXT\n      I/E\n\n * You can \"force\" a Scene Heading by starting the line with a\n   single period.\n\n * Scene Headings can optionally be appended with Scene\n   Numbers. Scene numbers are any alphanumerics (plus dashes and\n   periods), wrapped in #.\n\nSo, it appears wrong to insist on capital letters in the patterns.\nThe pattern in the patch does not even accept punctuations on the\nline other than apostrophe.  I won't judge if it is OK to limit to\nUS-ASCII ;-)\n\nIPATTERNS(\"fountain\",\n    \"^([.][^.]|(INT|EXT|EST|INT./EXT|INT/EXT|I/E)[. ]\",\n    \"[^ \\t-]+\"),\n\nor something like this, perhaps?\n"},{"id":"266375","messageId":"562D4AFF-BFC1-4234-8362-656D1F54DFD0@bytenoise.co.uk","threadId":"39872","inReplyTo":"xmqq380m1k3g.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] userdiff: add support for Fountain documents","fromName":"Zoë Blade","fromEmail":"zoe@bytenoise.co.uk","sentAt":"2015-07-19T12:30:28Z","receivedAt":"2015-07-19T12:30:28Z","isPatch":true,"sender":{"key":"zoe@bytenoise.co.uk","avatar":"https://avatars.githubusercontent.com/u/502434?v=4"},"body":"On 17 Jul 2015, at 23:43, Junio C Hamano <gitster@pobox.com> wrote:\n\n> * Although uppercase is recommended for Scene Headings to increase\n>   readability, it is not required.\n> \n> * A line beginning with any of the following, followed by either a\n>   dot or a space, is considered a Scene Heading (unless the line is\n>   preceded by an exclamation point !). Case insensitive.\n> \n>      INT\n>      EXT\n>      EST\n>      INT./EXT\n>      INT/EXT\n>      I/E\n> \n> * You can \"force\" a Scene Heading by starting the line with a\n>   single period.\n> \n> * Scene Headings can optionally be appended with Scene\n>   Numbers. Scene numbers are any alphanumerics (plus dashes and\n>   periods), wrapped in #.\n> \n> So, it appears wrong to insist on capital letters in the patterns.\n> The pattern in the patch does not even accept punctuations on the\n> line other than apostrophe.  I won't judge if it is OK to limit to\n> US-ASCII ;-)\n> \n> IPATTERNS(\"fountain\",\n>    \"^([.][^.]|(INT|EXT|EST|INT./EXT|INT/EXT|I/E)[. ]\",\n>    \"[^ \\t-]+\"),\n> \n> or something like this, perhaps?\n\nGood points, thanks!\n\nThis regex should be a bit sturdier:\n\n$ cat scenes.txt \nint. yes - day\nINT. YES - DAY #1A#\nEXT. YES - DAY\n.YES TOO\n!EXT. NO\nINT/EXT YES - DAY\nINT./EXT YES - DAY\nI/E YES - DAY\nno\nNO\nNO.\n!.NO.\nint yes - day\nest yes - day\n!EXT. NO - DAY\n\n$ grep -E \"^((\\.|(([Ii][Nn][Tt]|[Ee][Ss][Tt]|[Ee][Xx][Tt])?\\\\.?|[Ii]([Nn][Tt])?\\.?/[Ee]([Xx][Tt])?\\.?) ).+)$\" scenes.txt \nint. yes - day\nINT. YES - DAY #1A#\nEXT. YES - DAY\n.YES TOO\nINT/EXT YES - DAY\nINT./EXT YES - DAY\nI/E YES - DAY\nint yes - day\nest yes - day\n\nRevised version of patch incoming..."}]}