Closed Incina76 closed 4 years ago
The Japanese Support add-on has this to say:
To show furigana with your own note types:
- You need a directive like "{{furigana:Reading}}" in your card templates.
- The Reading field must be formatted in a special way with brackets. After every word should come the reading in brackets, followed by a space. It is not intended to be entered in manually; it is intended to be automatically generated as described in the above section.
So it seems like you need to change {{furigana:Example Sentence w/ Blanked Out Word (optional)}}
into {{Example Sentence w/ Blanked Out Word (optional)}}
in the card template.
that will allow closet to work on that line, but will prevent me from using Furigana on any line I want to use the clozet's effects with. if possible i would like to be able to use both. Is it possible for me to edit something so closet uses { } or <> to trigger?
Yes, they are defined in the source code in a single location: https://github.com/hgiesel/closet/blob/70b85670a825e30aeae3de0b3e034ed8ca809609/src/template/utils.ts#L1.
You would need to find this location in the compiled Closet code, and change it to what you want. You should be able to find by looking for "[["
. Note that at least for now, you would have to repeat this, every time I push another version of the Closet add-on, however I could make this configurable in the future: #28.
Another idea: Create a Closet filter, that creates Ruby text (furigana). In fact I use this:
function rubySupport(filterManager) {
const rubyStylizer = closet.Stylizer.make({
separator: '',
mapper: (v, i) => i === 0
? `<rb>${v}</rb>`
: `<rt>${v}</rt>`,
processor: (v) => `<ruby>${v}</ruby>`,
})
filterManager.install(closet.recipes.stylize({
tagname: 'rb',
separator: { sep: '::', max: 2 },
stylizer: rubyStylizer,
}))
}
That allows you to create ruby text like so: [[rb::家::いえ]]
will turn into
Am I doing this wrong? I've open Closet.js in notepad++ and searched [[
and found
t.TAG_OPEN="[[",t.TAG_CLOSE="]]"
and changed it to
t.TAG_OPEN="<<",t.TAG_CLOSE=">>"
restarted anki and write to template again and change the line in anki to
<<c0::起きます::起きる>>
and its not working.
am i editing the wrong file or the wrong place in the code?
and thanks for the help i know this isn't exactly and issue with your add-on.
The problem here is that "<" and ">" are treated special in HTML. You can look at the HTML you generated by using Ctrl-Shift-X (Cmd-Shift-X on Mac).
The <
and >
are translated to <
(less than) and >
(greater than). So in your case you would want:
t.TAG_OPEN="<<",t.TAG_CLOSE=">>"
I'm still having no luck I've tried
t.TAG_OPEN="<<",t.TAG_CLOSE=">>"
t.TAG_OPEN="<",t.TAG_CLOSE=">"
t.TAG_OPEN="{{",t.TAG_CLOSE="}}"
t.TAG_OPEN="??",t.TAG_CLOSE="]]"
it only seems to work if i change it back to
t.TAG_OPEN="[[",t.TAG_CLOSE="]]"
the ctrl+shift+X thing dosn't work either
Thanks again i saw that you added a plan to make them configurable.
Okay, I definitely had setting the delimiters to something else in the back of my mind while developing, however I never tried it, to make sure it actually works.
It seems there are still a few places where it's unsupported. I will see that I fix that very soon.
Ill look forward to it.
I just uploaded a new version, which at least makes the delimiters settable, however you will still need to redo it, if I were to update Closet again (and you choose Write to Templates) again.
Just updated it and tested it seems to be working now. Thank you!
I just pushed a new version, which has a few radical changes, but it also has better support for setting custom delimiters via JavaScript. You can read about them in #28.
i'm not sure what to do to configure it to use the different delimiters. in #28 you said i had to call closet.setDelimiters('[[', '::', ']]')
Im not sure how or where to do that.
I'm actually still working on this. I tried it out myself in order to demonstrate it to you, but that's when I figured out there was still a bug. Give me a moment, I'll try to figure as we're speaking.
both add-ons use the [ ] bracket on cards to trigger their effects. so when i try to use you cloze deletion on my cards I get the un hidden part of the sentence with the cloze deletion code as furigana above it.