-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature suggestion #35
Comments
Hi Ben, Thanks, I hope Exet works out for you. I'm always open to feature requests, bug reports, and am also happy to discuss potential contributions, ideas/algorithms/etc. Re: the simple text format that you would like: the Exolve format is ultimately itself a simple plain text format. It looks very similar to what you need. For example:
There are additional features in the Exolve format (such as providing clue annotations, underlining the definition part after Reveal, etc.), but you can easily remove all that if needed. If you save a crossword from Exet using the "Save > Download Exolve file with solutions" option, then the downloaded file, say
And then run:
I am a bit reluctant to add a specific "Download as .." option for your specific format to Exet itself, as the format is just specific to your use-case. One possibility would be to add support where Exet lets the user paste in a JavaScript function to create any arbitrary format, using the simple data structures that carry the grid and the clues, and then you can save the output. But that too, I worry, would not be widely used. Re: Exolve on mobile devices. Exolve does support mobile devices: for example, you can load any of my puzzles at gussalufz.com from a browser on a phone. But if you've done that already and have suggestions for improvements, am happy to listen and/or accept contributions! |
Thanks for the script ... very helpful. Unless I'm missing something, I
only seem to be able to download the full html from exet, but I see that
that has the Exolve source in it as a single string, so won't be hard to
extract. It also seems to have the solution grid spaced out compared to the
snippet in your email.
I will also have another look to see what I've missed with exolve on phone
- I can't remember what test I did to make me think you hadn't covered it.
(Including whether it was on an actual phone or just simulating in chrome
on PC.)
…On Wed, Jan 8, 2025 at 7:01 PM Viresh Ratnakar ***@***.***> wrote:
Hi Ben,
Thanks, I hope Exet works out for you. I'm always open to feature
requests, bug reports, and am also happy to discuss potential
contributions, ideas/algorithms/etc.
Re: the simple text format that you would like: the Exolve format is
ultimately itself a simple plain text format. It looks very similar to what
you need. For example:
exolve-width: 3
exolve-height: 3
exolve-grid:
ACE
C.A
TAT
exolve-across:
1 Clue for ACE (3)
3 Clue for TAT (3)
exolve-down:
1 Clue for ACT (3)
2 Clue for EAT (3)
There are additional features in the Exolve format (such as providing clue
annotations, underlining the definition part after Reveal, etc.), but you
can easily remove all that if needed.
If you save a crossword from Exet using the "Save > Download Exolve file
with solutions" option, then the downloaded file, say
exet-exolve-output.html, can be converted to your format with some simple
scripting. Eg., you can save the following script as exolve-to-plain.sh:
#!/bin/bash
awk_script='
BEGIN {
in_grid = 0;
in_clues = 0;
} /exolve/ {
in_grid = 0;
in_clues = 0;
} /exolve-grid/ {
in_grid = 1;
in_clues = 0;
} /exolve-across/ {
in_grid = 0;
in_clues = 1;
printf "\nAcross:\n";
} /exolve-down/ {
if (in_grid) printf "\n";
in_grid = 0;
in_clues = 1;
printf "Down:\n";
} !/exolve-/ {
if (in_grid) {
gridline = $0;
gsub(/ /, "", gridline);
gsub(/\./, "=", gridline);
printf "%s\n", gridline;
}
if (in_clues) {
clue = $0;
# Code to print the clue number right justified in four spaces and with a trailing period
num_matches = match(clue, /[0-9]+/);
if (num_matches != 0) {
num = substr(clue, RSTART, RLENGTH);
printf "%4d. ", num;
clue = substr(clue, RSTART + RLENGTH);
}
# Strip away any "annotation" part
num_matches = match(clue, /) /);
if (num_matches != 0) {
clue = substr(clue, 1, RSTART);
}
# Remove defintion markers, if any
gsub(/~{/, "", clue);
gsub(/}~/, "", clue);
# Trim leading/trailing spaces
gsub(/^[ ]+/, "", clue);
gsub(/[ ]+$/, "", clue);
printf "%s\n", clue;
}
}'
awk "$awk_script" -
And then run:
cat exet-exolve-output.html | ./exolve-to-plain.sh > plain-text-puzzle.txt
I am a bit reluctant to add a specific "Download as .." option for your
specific format to Exet itself, as the format is just specific to your
use-case. One possibility would be to add support where Exet lets the user
paste in a JavaScript function to create any arbitrary format, using the
simple data structures that carry the grid and the clues, and then you can
save the output. But that too, I worry, would not be widely used.
Re: Exolve on mobile devices. Exolve does support mobile devices: for
example, you can load any of my puzzles at gussalufz.com from a browser
on a phone. But if you've done that already and have suggestions for
improvements, am happy to listen and/or accept contributions!
—
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2ZYRICO65JXURUWFMQCLT2JTLPLAVCNFSM6AAAAABUY4ATWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZWHE4DMOBVG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Yeah, there is some html around the exolve part (but the script I posted above should just ignore that). Also, spaces in the grid part are optional (but Exet does use them). The script also removes the spaces. Please let me know how it goes! |
Yes, I'm just making sense of the awk script now (I've never scripted for
awk so a little bit of a learning curve but it's pretty self-explanatory)
and I see you've covered my concerns ... nice work! I'm also wondering if I
can make a bookmarklet (executable bookmark using javascript) to do the job
from the browser when viewing the html file. But since you've already done
the hard work on the awk script, I'll probably just run with that. Thanks
again!
…On Wed, Jan 8, 2025 at 7:25 PM Viresh Ratnakar ***@***.***> wrote:
Yeah, there is some html around the exolve part (but the script I posted
above should just ignore that).
Also, spaces in the grid part are optional (but Exet does use them). The
script also removes the spaces.
Please let me know how it goes!
—
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2ZYRORMKI3JHNT246D5532JTOI7AVCNFSM6AAAAABUY4ATWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZXGA2DCOJRG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Great! One bug is that if you have parentheses inside the clue, anything after that will get deleted :-). Exet does always start the annotation part with "[SOLUTION]", so you can make a false positive very unlikely by replacing the line:
with:
Also, the line:
is not needed (I was trying to insert the extra blank line that your format had, before "Across:", but then I just added it to the part that prints the "Across:". |
What a coincidence - the script I use to turn a friend's crosswords into
html (he sends me the puzzles in the simple format I showed you) has a
similar glitch with parentheses, so I end up manually rescuing the odd clue.
…On Wed, Jan 8, 2025 at 7:39 PM Viresh Ratnakar ***@***.***> wrote:
Great!
One bug is that if you have parentheses inside the clue, anything after
that will get deleted :-). Exet does always start the annotation part with
"[SOLUTION]", so you can make a false positive very unlikely by replacing
the line:
num_matches = match(clue, /) /);
with:
num_matches = match(clue, /) \[[A-Z]/);
Also, the line:
if (in_grid) printf "\n";
is not needed (I was trying to insert the extra blank line that your
format had, before "Across:", but then I just added it to the part that
prints the "Across:".
—
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2ZYROJHNKC2UGWAUTU2CD2JTP5PAVCNFSM6AAAAABUY4ATWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZXGA4DCMZQGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
In case you're curious, this is the bookmarklet I've now written for
copying the grid (not clues yet) to the clipboard when writing a puzzle in
Exet, in my preferred format...
javascript:(function() { navigator.clipboard.writeText(
Object.entries(exolvePuzzles).filter(x=>( typeof x[1] != 'number'
))[0][1].grid.map(row=>row.map(cell=>(cell.isLight?cell.currLetter:'=')).join('')).join('\n'))})();
…On Wed, Jan 8, 2025 at 7:44 PM Ben Robinson ***@***.***> wrote:
What a coincidence - the script I use to turn a friend's crosswords into
html (he sends me the puzzles in the simple format I showed you) has a
similar glitch with parentheses, so I end up manually rescuing the odd clue.
On Wed, Jan 8, 2025 at 7:39 PM Viresh Ratnakar ***@***.***>
wrote:
> Great!
>
> One bug is that if you have parentheses inside the clue, anything after
> that will get deleted :-). Exet does always start the annotation part with
> "[SOLUTION]", so you can make a false positive very unlikely by replacing
> the line:
>
> num_matches = match(clue, /) /);
>
> with:
>
> num_matches = match(clue, /) \[[A-Z]/);
>
> Also, the line:
>
> if (in_grid) printf "\n";
>
> is not needed (I was trying to insert the extra blank line that your
> format had, before "Across:", but then I just added it to the part that
> prints the "Across:".
>
> —
> Reply to this email directly, view it on GitHub
> <#35 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AB2ZYROJHNKC2UGWAUTU2CD2JTP5PAVCNFSM6AAAAABUY4ATWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZXGA4DCMZQGE>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
(Just chatting now, sorry if I'm wasting your time...) It's actually a good
example of how similarly you and I approach some things that your Exolve
format is so similar to what my interface now uses. We both seem to have
implemented what I call "colon notation", which looks a bit like JSON at
first glance, but isn't quite, and is just a bit more natural and
human-readable. You appear to have gone with the same convention that a
field which is a single line of text comes after the colon on the same line
as its label, while multi line fields follow a label and colon with nothing
else on that line. You even have nested properties (the field
'exolve-maker' has subfields Software, Version, ...) just like in my
scheme. (Although I've not used any nested structures in the crossword
application.)
Attached is an example of one of my final html files. It illustrates yet
another common feature of our designs... we've both ensured that the
individual html files are nice and compact, with pretty much all the actual
code in separate files which a browser will hopefully cache, making the
experience much better for end users with limited bandwidth.
…On Wed, Jan 8, 2025 at 9:05 PM Ben Robinson ***@***.***> wrote:
In case you're curious, this is the bookmarklet I've now written for
copying the grid (not clues yet) to the clipboard when writing a puzzle in
Exet, in my preferred format...
javascript:(function() { navigator.clipboard.writeText(
Object.entries(exolvePuzzles).filter(x=>( typeof x[1] != 'number'
))[0][1].grid.map(row=>row.map(cell=>(cell.isLight?cell.currLetter:'=')).join('')).join('\n'))})();
On Wed, Jan 8, 2025 at 7:44 PM Ben Robinson ***@***.***> wrote:
> What a coincidence - the script I use to turn a friend's crosswords into
> html (he sends me the puzzles in the simple format I showed you) has a
> similar glitch with parentheses, so I end up manually rescuing the odd clue.
>
> On Wed, Jan 8, 2025 at 7:39 PM Viresh Ratnakar ***@***.***>
> wrote:
>
>> Great!
>>
>> One bug is that if you have parentheses inside the clue, anything after
>> that will get deleted :-). Exet does always start the annotation part with
>> "[SOLUTION]", so you can make a false positive very unlikely by replacing
>> the line:
>>
>> num_matches = match(clue, /) /);
>>
>> with:
>>
>> num_matches = match(clue, /) \[[A-Z]/);
>>
>> Also, the line:
>>
>> if (in_grid) printf "\n";
>>
>> is not needed (I was trying to insert the extra blank line that your
>> format had, before "Across:", but then I just added it to the part that
>> prints the "Across:".
>>
>> —
>> Reply to this email directly, view it on GitHub
>> <#35 (comment)>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/AB2ZYROJHNKC2UGWAUTU2CD2JTP5PAVCNFSM6AAAAABUY4ATWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZXGA4DCMZQGE>
>> .
>> You are receiving this because you authored the thread.Message ID:
>> ***@***.***>
>>
>
|
(Sorry still going...) Moving forward, I am now going to make my working
source files pretty much the same format as what goes into my html files
(minus the html), so the final conversion will really only have to discard
all the irrelevant bits (my draft files usual retain many lines of rough
working that went into both setting the grid and writing the clues) and
wrap what's left in the two standard lines of html. And I now have this
quite refined version of my bookmarklet, which fetches everything from Exet
in one hit, while adjusting for our (very) slight differences in style ...
javascript:(function() { navigator.clipboard.writeText(
[Object.entries(exolvePuzzles).filter(x=>(typeof
x[1]!='number'))[0][1]].map( puz=> [Object.entries(puz.clues)].map(cls=>
['Across:\n','Down:\n'].map(dir=>
dir+cls.filter(c=>c[0].slice(0,1)==dir.slice(0,1)).map(c=>
c[1].displayLabel.replace('a','ac').replace('d','dn').replaceAll(' ','')+'.
'+c[1].clue.replace('[DRAFT]','').replace(' Set clue and clear draft
marker...',c[1].entry)).join('\n')).join('\n')+'\n')[0] +
'Solution:\n'+puz.grid.map(row=>row.map(cell=>(cell.isLight?cell.currLetter:'=')).join('')).join('\n')+'\n'
+ (puz.title?'Name: '+puz.title+'\n':'')+(puz.setter?'Author:
'+puz.setter+'\n':'') )[0])})();
I have to say, your good coding habits - well structured data objects with
sensible naming conventions - made this bit of hacking delightfully
painless. I wish I could say the same of my own coding, which even I have
trouble reconnecting with sometimes!
All the best
Ben
…On Wed, Jan 8, 2025 at 11:34 PM Ben Robinson ***@***.***> wrote:
(Just chatting now, sorry if I'm wasting your time...) It's actually a
good example of how similarly you and I approach some things that your
Exolve format is so similar to what my interface now uses. We both seem to
have implemented what I call "colon notation", which looks a bit like JSON
at first glance, but isn't quite, and is just a bit more natural and
human-readable. You appear to have gone with the same convention that a
field which is a single line of text comes after the colon on the same line
as its label, while multi line fields follow a label and colon with nothing
else on that line. You even have nested properties (the field
'exolve-maker' has subfields Software, Version, ...) just like in my
scheme. (Although I've not used any nested structures in the crossword
application.)
Attached is an example of one of my final html files. It illustrates yet
another common feature of our designs... we've both ensured that the
individual html files are nice and compact, with pretty much all the actual
code in separate files which a browser will hopefully cache, making the
experience much better for end users with limited bandwidth.
On Wed, Jan 8, 2025 at 9:05 PM Ben Robinson ***@***.***> wrote:
> In case you're curious, this is the bookmarklet I've now written for
> copying the grid (not clues yet) to the clipboard when writing a puzzle in
> Exet, in my preferred format...
> javascript:(function() { navigator.clipboard.writeText(
> Object.entries(exolvePuzzles).filter(x=>( typeof x[1] != 'number'
> ))[0][1].grid.map(row=>row.map(cell=>(cell.isLight?cell.currLetter:'=')).join('')).join('\n'))})();
>
> On Wed, Jan 8, 2025 at 7:44 PM Ben Robinson ***@***.***> wrote:
>
>> What a coincidence - the script I use to turn a friend's crosswords into
>> html (he sends me the puzzles in the simple format I showed you) has a
>> similar glitch with parentheses, so I end up manually rescuing the odd clue.
>>
>> On Wed, Jan 8, 2025 at 7:39 PM Viresh Ratnakar ***@***.***>
>> wrote:
>>
>>> Great!
>>>
>>> One bug is that if you have parentheses inside the clue, anything after
>>> that will get deleted :-). Exet does always start the annotation part with
>>> "[SOLUTION]", so you can make a false positive very unlikely by replacing
>>> the line:
>>>
>>> num_matches = match(clue, /) /);
>>>
>>> with:
>>>
>>> num_matches = match(clue, /) \[[A-Z]/);
>>>
>>> Also, the line:
>>>
>>> if (in_grid) printf "\n";
>>>
>>> is not needed (I was trying to insert the extra blank line that your
>>> format had, before "Across:", but then I just added it to the part that
>>> prints the "Across:".
>>>
>>> —
>>> Reply to this email directly, view it on GitHub
>>> <#35 (comment)>,
>>> or unsubscribe
>>> <https://github.com/notifications/unsubscribe-auth/AB2ZYROJHNKC2UGWAUTU2CD2JTP5PAVCNFSM6AAAAABUY4ATWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZXGA4DCMZQGE>
>>> .
>>> You are receiving this because you authored the thread.Message ID:
>>> ***@***.***>
>>>
>>
|
Yeah, bookmarklet seems like a good way to do this. It basically does the "custom JS code to transform/format before saving" that I had mentioned we could consider adding as a feature, but the browser already has that feature by way of bookmarklets. Nice. |
I was expecting that you might point out the fundamental flaw in my
approach, which is that I have relied on my observed internal workings of
your code (or at least how you've structured the data) rather than the file
format that you export. Having users relying on that format means that you
are (implicitly and/or at some practical level) committed to keeping it
fairly unchanged or at least backward-compatible if you do make changes.
Whereas in theory you could restructure and/or rename a lot of those
internal variables whenever you feel like it and it shouldn't be anyone
else's business. So my solution is not very robust and wouldn't (or
shouldn't) fly in a professional setting, but it was fun (in its own way)
to throw together and it did help me start to get some insight into the
workings of your code in case I ever do try to contribute.
…On Thu, Jan 9, 2025 at 5:23 AM Viresh Ratnakar ***@***.***> wrote:
Yeah, bookmarklet seems like a good way to do this. It basically does the
"custom JS code to transform/format before saving" that I had mentioned we
could consider adding as a feature, but the browser already has that
feature by way of bookmarklets. Nice.
—
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2ZYRLXYJCSCZE4DIET5GD2JVUK5AVCNFSM6AAAAABUY4ATWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZYGMZTQOJQHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
This is fine, I do not plan to change the basic names. In fact I have a test in Exolve that checks for the presence of some basic fields, and I run all the tests before every release. There are other people who use customizations in their Exolve puzzles who rely on the presence of many basic fields, so I think of these as part of the Exolve "API". I've now also added a couple of fields that you were using that were not already present in the test: https://github.com/viresh-ratnakar/exolve/blob/master/test-customize-puzzle.html Also, FYI, when using Exet, the Exolve object can also be accessed as |
Wow you are super organised! It's not just a program, but an established
API with test suite (and documentation).
And nimble.
…On Thu, Jan 9, 2025 at 5:10 PM Viresh Ratnakar ***@***.***> wrote:
This is fine, I do not plan to change the basic names. In fact I have a
test in Exolve that checks for the presence of some basic fields, and I run
all the tests before every release. There are other people who use
customizations in their Exolve puzzles who rely on the presence of many
basic fields, so I think of these as part of the Exolve "API".
I've now also added a couple of fields that you were using that were not
already present in the test:
https://github.com/viresh-ratnakar/exolve/blob/master/test-customize-puzzle.html
Also, FYI, when using Exet, the Exolve object can also be accessed as
exet.puz
—
Reply to this email directly, view it on GitHub
<#35 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2ZYROMSES26B5MATU5WML2JYHENAVCNFSM6AAAAABUY4ATWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNZZGI2TCMRTGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Hi Viresh I'm a big fan of your work. I look at Exet and think "this is where I was going with my project" as so many of the features of your program are things I had envisaged, and your design philosophy seems very similar. (My own project stalled long ago. I was working in python, as I hadn't thought browser-based would cope with holding entire lexicon in memory, as once upon a time it wouldn't have! I am still using my software as a CLI in a terminal, having been torn between going to a GUI or ncurses format next ... which was many years ago.)
I am now starting to use Exet for setting some of my grids (with some swallowing of pride, having relied on my own program for so long now) but an obstacle to integrating it into my workflow is when I go to save my work which I will then want to convert to a different format. (I am self-publishing using my own solving interface.) It would be great if I could save a puzzle in a really simple bare-bones text format, such as seen in the sample file attached. I have a simple program that can then convert that to the html file for publishing on my site.
I toyed with the idea of forking your project and trying to write the necessary extra code myself, then sending you a pull request, but I know that would be opening quite a can of worms and I might never get it done, so thought I'd pop it in as a feature request. BUT if you have the time to answer the odd question to help me find my way around your code, I could be willing to have a go at it. And more broadly, even though collaboration has never been my strong suit, I am potentially interested in contributing some effort to your project. It's always worried me that as programmers, so many of our efforts are duplicating one another's work rather than building on it, so I have long thought I should break out of my solo silo and do some collaboration. As an example of an area where you might welcome a contribution, I recently finally adapted my own solving interface to be phone-friendly, and I notice that Exolve (as far as I can see) is not yet well optimised for that setting.
I don't log into Github often and don't know what the mechanism is for receiving replies to this sort of communication, so I will also DM you in Messenger to open an easy line of communication.
386sltd29.txt
The text was updated successfully, but these errors were encountered: