We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10839
    • 51 Posts
    I am building a list of bibliography records by means of template variables, templates and so on.

    Those bib. records will be rendered in several ways using Ditto. That’s ok.

    It would be nice if the user could have an option similar to "Export as a bibTex file", which is a specific text-like format for bib. records.

    It could be not very difficult to build a kind of function in Javascript (or whatever) in order to "translate" records in a MODx table to bibTeX entries.

    But, first of all, I want to be sure it is not already done.

    So, does any of you know any kind of piece of code (easy to put into MODx) that makes it possible to "translate" bibliography information into bibTeX??

    I’ve only found a Javascript project (http://sourceforge.net/projects/jsbibtex/), and also I know a similar "function" or module or whatever exists in Joomla! CMS.

    I think it is not just about building a "simple" Ditto template chunk, because, for example, in order to translate the field "authors" into a valid "authors" field in BibTeX format, it could be necessary some "if" clauses. I do know conditional clauses are possible within Ditto (aren’t they?), but I think the overall process of "translating" or "exporting" into BibTeX format could be a little bit confusing to "program" and to maintain with Ditto syntax.

    What do you think about?
      GinerBosk smiley

      If you can dream it, you can do it.
      • 10839
      • 51 Posts
      Maybe with the help of PHx, it could be possible to do it (I could have more control over the format, the way the entries are rendered).

      Anyway, do you think I should go on that way ((Ditto) templates + PHx)?

      By the way, can I use PHx only within Ditto template chunks??

      Sorry for as many questions in the same post....
        GinerBosk smiley

        If you can dream it, you can do it.
        • 4310
        • 2,310 Posts
        PHx can be run as a plugin outside Ditto.
          • 10839
          • 51 Posts
          So, one of my point questions is:

          If I have something like this in a TV called "authors":

          Giner-Bosch V., San Matías S.

          and I want/need it to be rendered in the BibTeX format as

          {Giner-Bosch, V. and San{ }Mat{\’{i}}as, S.}


          , how would you do it with templates, PHx, etc.??
            GinerBosk smiley

            If you can dream it, you can do it.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I think you would need to create your own TV output widget using a snippet, as described in the wiki here.
            In your case, the snippet would parse and format the TV content, and output the formatted content.

            I wouldn’t be surprised to find a PHP class to do that which you could use in your snippet.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 10839
              • 51 Posts
              Quote from: sottwell at Sep 13, 2008, 01:38 AM

              I think you would need to create your own TV output widget using a snippet, as described in the wiki here.
              In your case, the snippet would parse and format the TV content, and output the formatted content.

              Thank you very much for your help.

              I was just now thinking about formatting the output via templates, using PHx. I’ve seen I can http://wiki.modxcms.com/index.php/PHx#Creating_a_custom_modifier"" target="_blank" rel="nofollow">define new modifiers, for example.

              And I am thinking about saving data in my TVs in BibTeX format, instead of a "readable" format, and then using PHx in order to modify output.

              For example, when you want to store "authors" field in a proper BibTeX format, you have to use "{" and "}" in order to mantain capital leters, or special entities similar to HTML entities. For instance:

              {Giner, V. and San{ }Mat{\'{i}}as, S. and Anybody, X.}


              stands for

              Giner V., San Matías S., Anybody X.

              So maybe I can define a customized PHx modifier in order to "translate" from BibTeX format to "human" format.

              But your idea is a good approach also, I think. I must think about it...
                GinerBosk smiley

                If you can dream it, you can do it.
                • 7231
                • 4,205 Posts
                One potential problem will that if there happens to be a {{string}} modx will think it is a chunk placeholder. Not sure if this can happen in this syntax but the potential problem came to mind.
                  [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                  Something is happening here, but you don't know what it is.
                  Do you, Mr. Jones? - [bob dylan]
                  • 10839
                  • 51 Posts
                  Quote from: dev_cw at Sep 13, 2008, 07:03 AM

                  One potential problem will that if there happens to be a {{string}} modx will think it is a chunk placeholder. Not sure if this can happen in this syntax but the potential problem came to mind.

                  Yes, that’s a true potential problem.

                  Thank you! I must take that into account, when trying to generate a BibTeX file.
                    GinerBosk smiley

                    If you can dream it, you can do it.