omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Pick Different CSS Files

    Pythonista
    3
    3
    2752
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • CoryBradford
      CoryBradford last edited by

      Does anyone know how to pick different CSS files for output? I created a workflow that has the following actions:

      1. Document Text
      2. Convert Markdown
      3. Set Variable (variable name: markdown; store the markdown text)
      4. Get File Contents (I specify css.css as the CSS file i want)
      5. Set variable (variable name: css; stores the text contents of the css.css file)
      6. Generate text (setup HTML; use <style>css</style> and <body>markdown</body>)
      7. Serve HTML (A python script from another workflow that in essence prepends pdf to the http address which then opens in Readdle PDF Converter.

      What I was hoping is if there was a way at step 4 to pick a css file to use. Depending on what I am writing I use different stylings for the output. I don't know python, so if that is the solution, can someone help me write the script?

      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        Are you using a ui? Or just the console?

        https://github.com/jsbain/uicomponents/blob/master/file_picker.py
        Is a dropdown that lets you select a file. If you had some sort of ui settings, you can add this class in the ui editor for example (just make sure you have from file_picker import FilteredFileDropdown before you load your view. You can override filter to be *.css to show only css files. This version only shows files in the specified base folder. Note you'd need dropdown.py from the same repo as well.

        If you just want to prompt the user for a file, see
        https://github.com/jsbain/uicomponents/blob/master/uidir.py

        I really need to revamp that, (maybe polymerchm has something better now, I know he was working on something similar) but you would create a FileViewer, then call getFile.

        1 Reply Last reply Reply Quote 0
        • peterh86
          peterh86 last edited by

          You can write the css file name as the first line of the document, then you need to strip of that first line later.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors