Community
    • Login

    Replacing Tidy plugin

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 4.8k Views
    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.
    • TBugReporterT
      TBugReporter
      last edited by

      Neither of the plugins that include HTML Tidy have been updated for 64bit, so instead I downloaded a command line version of Tidy along with Don Ho’s Pork2Sausage plugin to connect this version of Tidy with NPP, but so far, I haven’t been able to configure Pork2Sausage properly. Has anyone else succeeded at this?

      TBugReporterT 1 Reply Last reply Reply Quote 0
      • TBugReporterT
        TBugReporter @TBugReporter
        last edited by

        Wow. Almost a month has passed since I first posted this, with no comment (let alone an answer) from anyone. Is Don Ho the only person who understands how to use Pork2Sausage? (And where is he on this?) The examples given in the plugin are essentially meaningless for anyone who doesn’t have Java installed.

        1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones
          last edited by PeterJones

          Nope, never used it. When I want to manipulate the text with an external utility, I tend to use NppExec or PythonScript plugins.

          What did you try before you asked the question? Have you tried anything in the month since then? What works, what doesn’t? (People in help forums usually like seeing that you’ve put in effort yourself. Besides, it helps them reproduce your problem, and gives a good starting place for where to go next.)

          However, even though I’ve never used it, I took a 2minute look at the pork2sausage.ini, and it comes with pretty good documentation in the comments section. Here’s how I understand the parameters, after those 2 minutes:

          • progPath: full path to the executable you want to run. He used the example of java.exe, but that’s where you’d give the full path to tidy.exe (or whatever Tidy’s executable is called)
          • progCommand: the command you wanted to run. He used an example of calling a specific java class, but you would use something like tiny --option 1 -- something else "$(SELECTION)"
          • workDir: what directory do you want it to run in
          • progInput and progOutput: if you have whole files you want to use, this is where you’d specify them. But that’s if tidy were expecting filenames, and could not handle command-line arguments.

          I know nothing about the tidy executable, so let’s pretend I had a program called transform which takes as its argument a single string, and outputs some transform of the string on STDOUT. My .ini would be something like (untested, since I’ve never used pork2sausage, and haven’t downloaded it)

          [xfrm]
          progPath=C:\Program Files\TransForm\transform.exe
          progCmd=transform "$(SELECTION)"
          workDir=C:\Program Files\TransForm\
          

          You would then select some text, and run the pork2sausage using “xfrm” (I don’t know how to do that part; presumably, Plugins > Pork2Sausage > xfrm).

          Given that tidying HTML probably wants the whole file, rather than a small selection, and passing newlines over the command line is difficult, you’d be more likely to want the progInput / progOutput version: but then you’d need to always save the file to whatever’s defined in progInput. But at that point, I’d probably switch to NppExec, with something like this command, which I use to take the entire contents of the currently active file, encrypt it using gpg.exe, and paste it back into the active document (and save):

          cls
          npp_save
          cmd.exe /c exit %RANDOM%														// cannot access $(SYS.RANDOM) directly through NppExec, but can tell cmd.exe to return it as a value
          set tempfile = $(SYS.TEMP)\NppGpgFile_$(EXITCODE).tmp							// create random tempfile name
          set ascfile = $(SYS.TEMP)\NppGpgFile_$(EXITCODE).asc							// create associated ascfile name
          sci_sendmsg SCI_SELECTALL														// select all
          sel_saveto $(tempfile) :a														// save selection to the tempfile	(use :a to save as ansi, to prevent unicode prefix ÿþ getting embedded)
          INPUTBOX "Recipients (use -r between multiple): " : email@address	// get the recipients
          gpg.exe --output "$(ascfile)" -ase -r $(INPUT) "$(tempfile)"					// armor+sign+encrypt to recipient(s)
          sel_loadfrom $(ascfile)															// replace selection with results
          sci_sendmsg SCI_DOCUMENTSTART													// deselect
          //rm -rf "$(tempfile)" "$(ascfile)"												// cleanup temp files
          npp_save
          
          1 Reply Last reply Reply Quote 2
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors