Giter Site home page Giter Site logo

Comments (4)

fbennett avatar fbennett commented on June 9, 2024

Is there are reason you can't use CSS to control the display effects of the div wrappers? In some styles they are important to the structure of the cite. If you do want to omit them completely, you could extend src/formats.js with a custom output format that sets the HTML but returns unadorned text instead of the div wrappers.

from citeproc-js.

dsifford avatar dsifford commented on June 9, 2024

I'd like just the citation content because my app takes it and throws it into an ordered list. By doing so, it'll get numbered twice.

I suppose, now that I think about it more, I could just be tossing the citations into a containing <div>. I'll have to play around with it more.

One other question comes to mind now that I'm thinking about html formatting. Does citeproc also return correctly formatted inline citations? If so, how do I access them? (All I really am aware of is the makeBibliography function).

Thanks for the help!

from citeproc-js.

dsifford avatar dsifford commented on June 9, 2024

Ah, now I remember the reason...

I'm generally grabbing citations one at a time (but also sometimes 2-3 at a time, and other times 10-20 at a time). I didn't think it was possible for it to keep the numbering in sync if it had to process the data more than in one go.

If this is possible, I'm totally interested.

from citeproc-js.

dsifford avatar dsifford commented on June 9, 2024

FWIW, this is how I'm doing it right now:

/**
     * Removes outer HTML formatting served from citeproc, sparing inner `<i>` or `<a>` tags.
     * @param  {string} ref The reference payload from citeproc.
     * @return {string}     A formatted reference string without outer HTML.
     */
    trimHTML(ref: string): string {
        return ref
            .replace(/<(?!(i|\/i|a|\/a)).+?>/g, '')
            .trim()
            .replace(/^\d+\.\s?/, '');
    }

from citeproc-js.

Related Issues (20)

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.