GithubHelp home page GithubHelp logo

Comments (9)

s3ththompson avatar s3ththompson commented on July 25, 2024 1

One approach for the API might be to add a method on the $blocks collection which would return a new collection of blocks with modified "text" / "markdown" blocks that contain numbered <sup> tags and then a new custom "footnotes" block type appended to the end?

Then users could still loop through the blocks manually and could even customize the output of the footnotes themselves with a custom snippet...

from kirby-footnotes.

sylvainjule avatar sylvainjule commented on July 25, 2024 1

I agree with your suggestion @s3ththompson, I think this would be the best way to set it up. The issue is that for now, one cannot register methods to the Blocks object (see kirby.nolt.io/228). So until this feature is added there's no integrated way to achieve this...

I have put together some methods for you to be able to output notes in the meantime, but keep in mind that it'll probably need to be updated once Blocks methods are available.

from kirby-footnotes.

sylvainjule avatar sylvainjule commented on July 25, 2024 1

@sylvainjule just an FYI, i've been thinking about writing an extension to the Writer block to add support for inline WYSIWYG footnotes per this example. I'm assuming that would probably warrant a new plugin right? If you disagree, I'd be happy to work out the right way to extend kirby-footnotes and submit a PR instead.

Sounds great! I think having it as a new plugin would be easier to maintain for both of us indeed, but we should probably sync the output syntax so that editors can use one, the other, or both simultaneously with the same markup output.

from kirby-footnotes.

trych avatar trych commented on July 25, 2024

I admit, I don't quite understand @s3ththompson's proposed solution.
But would it not be sufficient to have some sort of global counter per page that keeps counting up through all the blocks whenever it finds a footnote and then the footnote receives its number from that counter?

Edit: Ah, sorry, I hadn't seen your linked method. At first glance it looks this is a bit similar to what I suggested (if I understand this right?). I will give this a try in my setup.

from kirby-footnotes.

s3ththompson avatar s3ththompson commented on July 25, 2024

@trych a global counter would fix the numbering of inline <sup> tags, but it wouldn't solve the problem of how (and where) to output the final list of footnotes at the bottom of the page.

given that the whole point of Blocks is to introduce structured "blocks" of content, it seems natural to make the final list of footnotes at the bottom of the page a Block itself.

Ultimately though, Kirby's Blocks system doesn't have great primitives or patterns (yet) for creating Blocks that are aware of siblings and relative positioning. Because they are so self-contained, they make implementing a cross-page feature like footnotes tricky.

from kirby-footnotes.

s3ththompson avatar s3ththompson commented on July 25, 2024

@sylvainjule just an FYI, i've been thinking about writing an extension to the Writer block to add support for inline WYSIWYG footnotes per this example. I'm assuming that would probably warrant a new plugin right? If you disagree, I'd be happy to work out the right way to extend kirby-footnotes and submit a PR instead.

from kirby-footnotes.

trych avatar trych commented on July 25, 2024

@sylvainjule I just gave your new Blocks sample snippet a try. While it does handle the numbering correctly now over several blocks, it removes the formatting completely, from my text. That means the markdown is not parsed and all the kirbytags are not parsed either. This refers to the markdown blocks only, with text blocks it seems to work fine.

Do you now what could be causing this? Does the new withoutBlocksFootnotes() method not parse markdown?

This is what I get now:
20210301-233154_Screenshot_GoogleChrome

This is what I got with the old methods (that didn't allow the numbering over several blocks):
20210301-233241_Screenshot_GoogleChrome

Edit: Had a look at the plugin code and it seems that the $kt argument of the withoutBlocksFootnotes() method is set to false when I think it should be set to true? Referring to this line.

from kirby-footnotes.

psntr avatar psntr commented on July 25, 2024

Thank you for the temporary solution @sylvainjule, as @trych pointed it out, the withoutBlocksFootnotes() method should be set to true:

'withoutBlocksFootnotes' => function($field, $startAt) {
    return Footnotes::convert($field->text(), false, true, false, false, $startAt);
 }

To

'withoutBlocksFootnotes' => function($field, $startAt) {
    return Footnotes::convert($field->text(), false, true, false, true, $startAt);
}

from kirby-footnotes.

sylvainjule avatar sylvainjule commented on July 25, 2024

I have added a blocks method built upon the collectFootnotes worklow PRed by @rasteiner, replacing the previous way of dealing with footnotes in blocks.

from kirby-footnotes.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.