{"thread":{"id":"39905","subject":"[PATCH] userdiff: add support for Fountain documents","startedAt":"2015-07-21T13:22:46Z","lastAt":"2015-07-29T11:19:06Z","messageCount":4,"participants":["Zoë Blade","Junio C Hamano","Zoë Blade"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"266539","messageId":"1437484966-664-1-git-send-email-zoe@bytenoise.co.uk","threadId":"39905","inReplyTo":null,"subject":"[PATCH] userdiff: add support for Fountain documents","fromName":"Zoë Blade","fromEmail":"zoe@bytenoise.co.uk","sentAt":"2015-07-21T13:22:46Z","receivedAt":"2015-07-21T13:22:46Z","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..eec939a 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+IPATTERN(\"fountain\", \"^((\\\\.|((int|est|ext)?\\\\.?|i(nt)?\\\\.?/e(xt)?\\\\.?) ).+)$\",\n+\t \"[^ \\t-]+\"),\n PATTERNS(\"html\", \"^[ \\t]*(<[Hh][1-6][ \\t].*>.*)$\",\n \t \"[^<>= \\t]+\"),\n PATTERNS(\"java\",\n-- \n1.9.5 (Apple Git-50.3)\n"},{"id":"266567","messageId":"xmqqk2ttuwyy.fsf@gitster.dls.corp.google.com","threadId":"39905","inReplyTo":"1437484966-664-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-21T19:33:41Z","receivedAt":"2015-07-21T19:33:41Z","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\nHmmmm, the pattern has too many question marks to make a simple\npanda brain spin.\n\n> \"^((\\\\.|((int|est|ext)?\\\\.?|i(nt)?\\\\.?/e(xt)?\\\\.?) ).+)$\"\n\nit can start with a dot, or match \"something\" at the beginning,\nfollowed by a SP (is a tab allowed there instead of SP, I have to\nwonder).\n\nOne problem I noticed immediately: this allows a line that begins\nwith \"...\", which I learned in http://fountain.io/syntax when I\nwrote $gmane/274127 is explicitly excluded.  A line that begin with\na dot followed by a non-dot is a forced scene heading.\n\nNow disecting that \"something\" (i.e. not a forced scene heading),\nwhich is this part ...\n\n> ((int|est|ext)?\\\\.?|i(nt)?\\\\.?/e(xt)?\\\\.?)\n\n... that gives us largely two choices:\n\n - It can begin with zero or one int/est/ext and can optionally be\n   followed by a dot, or\n\n - It can be one of (i, int), optionally followed by a dot, followed\n   by slash, followed by one of (e, ext), optionally followed by a\n   dot.\n\nSecond problem.  Doesn't the early part of this \"something\" pattern\nallow an empty string to match by having zero \"int\" and zero \".\"?\n\nWith this edit to the test vector (add either one of these two,\nremoving the other, before you run this test twice), you can see\nthat these over-eager matches in action.\n----------------------------------------------------------------\n\n t/t4018/fountain-scene | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/t/t4018/fountain-scene b/t/t4018/fountain-scene\nindex 6b3257d..94f0513 100644\n--- a/t/t4018/fountain-scene\n+++ b/t/t4018/fountain-scene\n@@ -1,4 +1,7 @@\n EXT. STREET RIGHT OUTSIDE - DAY\n \n+ An indented line is WRONG.\n+...we do not want ellipses.\n+\n CHARACTER\n You didn't say the magic phrase, \"ChangeMe\".\n\n----------------------------------------------------------------\n\nPerhaps the pattern is trying to be too clever for its own good.\nI'd prefer to see us doing simple, stupid and obviously correct.\n\nThat \"syntax\" page says:\n\n    You can \"force\" a Scene Heading by starting the line with a\n    single period. ... Note that only a single leading period\n    followed by an alphanumeric character will force a Scene\n    Heading. This allows the writer to begin Action and Dialogue\n    elements with ellipses ...\n\nwhich would give us the first part, i.e. the line may start with a\ndot and then an alnum\n\n\\\\.[a-z0-9]\n\nAnd then\n\n    A line beginning with any of the following, followed by either a dot\n    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\nwhich translates to\n\n(int|ext|est|int\\\\.?/ext|i/e)[. ]\n\nSo taking these all together, something like this?\n\n^((\\\\.[a-z0-9]|(int|ext|est|int\\\\.?/ext|i/e)[. ]).*)$\n\nI personally prefer to make it slightly lenient to exclude dot\ninstead of forcing US-ASCII view of alnum, i.e.\n\n^((\\\\.[^.]|(int|ext|est|int\\\\.?/ext|i/e)[. ]).*)$\n\nI'll queue a SQUASH??? on top while waiting for a response.\n\nThanks.\n"},{"id":"266610","messageId":"FCF96FC6-2DCB-42F2-9B75-A97F84ED2D94@bytenoise.co.uk","threadId":"39905","inReplyTo":"xmqqk2ttuwyy.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-22T16:31:31Z","receivedAt":"2015-07-22T16:31:31Z","isPatch":true,"sender":{"key":"zoe@bytenoise.co.uk","avatar":"https://avatars.githubusercontent.com/u/502434?v=4"},"body":"Hi again Junio!\n\nYes, your more elegant and accurate regex sounds much better than the way I was trying it. :)  Please, go ahead and use yours instead.  Thank you for your help!\n\nThanks,\nZoë."},{"id":"267043","messageId":"0B100A08-4387-4BDE-A3E5-049303343C8D@bytenoise.co.uk","threadId":"39905","inReplyTo":"FCF96FC6-2DCB-42F2-9B75-A97F84ED2D94@bytenoise.co.uk","subject":"Re: [PATCH] userdiff: add support for Fountain documents","fromName":"Zoë Blade","fromEmail":"zoe@bytenoise.co.uk","sentAt":"2015-07-29T11:19:06Z","receivedAt":"2015-07-29T11:19:06Z","isPatch":true,"sender":{"key":"zoe@bytenoise.co.uk","avatar":"https://avatars.githubusercontent.com/u/502434?v=4"},"body":"Hi again!\n\nWhere's this at?  Your last regex looks perfect to me:\n\n^((\\\\.[^.]|(int|ext|est|int\\\\.?/ext|i/e)[. ]).*)$\n\nDo you need anything else from me?\n\nThanks,\nZoë."}]}