MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Plugins (https://www.mobileread.com/forums/forumdisplay.php?f=268)
-   -   [Plugin] TagMechanic (https://www.mobileread.com/forums/showthread.php?t=270639)

Doitsu 01-30-2017 05:00 AM

Quote:

Originally Posted by roger64 (Post 3467128)
Hi

I tried to use the last version of your nice plugin, but it failed.

Code:

Statut :failed

Traceback (most recent call last):
  File "/usr/share/sigil/plugin_launchers/python/launcher.py", line 134, in launch
    target_script = __import__(script_module)
  File "/home/roger/.local/share/sigil-ebook/sigil/plugins/TagMechanic/plugin.py", line 15, in <module>
    from parsing_engine import MarkupParser
  File "/home/roger/.local/share/sigil-ebook/sigil/plugins/TagMechanic/parsing_engine.py", line 8, in <module>
    import regex as re
ModuleNotFoundError: No module named 'regex'
Error: No module named 'regex'


Using ArchLinux 64 bits. Sigil 0.9.7. Qt 5.8. Python 3.6.

You're missing the Python regex library. Enter the following in a terminal window:

Code:

sudo pip install regex
if that doesn't work try:

Code:

sudo pip3 install regex

roger64 01-30-2017 05:23 AM

Hi

Indeed. Thank you. :thumbsup:

Code:

[roger@anterg ~]$ sudo pip3 install regex
[sudo] Mot de passe de roger*:*
Collecting regex
  Downloading regex-2017.01.17.tar.gz (601kB)
    100% |████████████████████████████████| 604kB 811kB/s
Installing collected packages: regex
  Running setup.py install for regex ... done
Successfully installed regex-2017.1.17
[roger@anterg ~]$


DiapDealer 01-30-2017 07:47 AM

Just about every other linux distro out there includes Barnett's regex module in their official repositories. Why is it that Arch relegates it to their unofficial user repository?

And when did Arch go to Qt 5.8? I just got a 5.7 update on my Arch machine yesterday.

roger64 01-30-2017 10:09 AM

1 Attachment(s)
Hi

I use Antergos which is 100% Arch compatible. The difference are it provides an installer, an access to AUR and a icon pack.

I probably could have got pip3 elsewhere, I followed Doitsu's advice. But it was missing on my machine.

A screenshot of the Sigil information panel.

DiapDealer 01-30-2017 10:41 AM

Quote:

Originally Posted by roger64 (Post 3467290)
Hi

I use Antergos which is 100% Arch compatible. The difference are it provides an installer, an access to AUR and a icon pack.

I probably could have got pip3 elsewhere, I followed Doitsu's advice. But it was missing on my machine.

A screenshot of the Sigil information panel.

If you used this plugin before, you probably already had the regex module installed. If it was installed from the AUR, Arch's move from Python 3.5 to 3.6 made most AUR-installed python modules null and void. I posted an Arch PSA in the stickied thread section about it.

Glad you got it working again, though.

odamizu 01-31-2017 12:07 AM

Quote:

Originally Posted by DiapDealer (Post 3466742)
If someone could please verify that I didn't inadvertently break something else with my changes before I update the first post with the new version, I'd appreciate it.

EDIT: Removed beta attachment and updated the first post with the new version

Sorry for the late response.

In case it makes a difference, +1 for 0.4.4 running fine.

I'm on a Mac :)

Thank you, DiapDealer!

odamizu 08-16-2018 09:25 PM

convert <h2> to <h1>
 
I'm guessing I'm missing something obvious, so forgive the stupid question, but is there a way to convert <h2> to <h1>?

When I go to the Tags dropdown menu, there is no <h2> (or <h1>) option. I tried adding it using Customize Plugin, but couldn't find a place to do so.

Thank you!

theducks 08-17-2018 12:23 AM

Quote:

Originally Posted by odamizu (Post 3737591)
I'm guessing I'm missing something obvious, so forgive the stupid question, but is there a way to convert <h2> to <h1>?

When I go to the Tags dropdown menu, there is no <h2> (or <h1>) option. I tried adding it using Customize Plugin, but couldn't find a place to do so.

Thank you!

Check out the default "saved Searches", Early versions of sigil had to groups of searches. Promote Headings and Demote headings. that would do 1 level at a time (without editing the replace :D term )

DiapDealer 08-17-2018 09:57 AM

Quote:

Originally Posted by odamizu (Post 3737591)
I'm guessing I'm missing something obvious, so forgive the stupid question, but is there a way to convert <h2> to <h1>?

When I go to the Tags dropdown menu, there is no <h2> (or <h1>) option. I tried adding it using Customize Plugin, but couldn't find a place to do so.

Thank you!

You can't add new tags to be manipulated though the plugin's UI or json prefs file. You can only manipulate the items that existing tags can be changed to via Customize Plugin.

I've already included more tags than I really deem worthwhile to this plugin. The original intent was to be able to change tags/attributes that would be difficult to do with standard Sigil tools or fairly simple S&R (or Sigil clips). Primarily nested tags like spans and divs.

For instance, if I wanted to change all h1 tags to h2 tags I'd use something like:

Code:

<(\/?)h1
And replace it with:
Code:

<\1h2
Having said all that, I did however make it pretty easy to modify the plugin's code to add more tags by default (I'm not a glutton for punishment and people were asking for tags to be added left and right ;) ) You'd have to modify the plugin.py file just a bit (and realize that you'd need to do it again if you ever updated the plugin in the future).

Near the beginning of plugin.py you'd just need to add 'h1' to the 'taglist' list, and then you'd need to add an 'h1_changes' entry to the 'combobox_defaults' dictionary right below that. Something like:

Code:

'h1_changes'          : ['h2'],
should suffice. You could then use the gui to customize it with any other tags you might want to change h1s to.

Hope that helps! I'll consider adding h tags to the plugin in a future release, but it really is pretty trivial to make such changes without the plugin. Better yet, I should find a way to make it possible for users to add their own tags in a way that would survive future plugin updates. No promises, though. :D

odamizu 08-17-2018 05:03 PM

Quote:

Originally Posted by DiapDealer (Post 3737758)
... modify the plugin.py file just a bit (and realize that you'd need to do it again if you ever updated the plugin in the future).

Near the beginning of plugin.py you'd just need to add 'h1' to the 'taglist' list, and then you'd need to add an 'h1_changes' entry to the 'combobox_defaults' dictionary right below that.

Perfect! This works great and is something within my limited skill set :)

(I struggle with regex. There's something about it that my poor brain can't grasp.)

Quote:

Originally Posted by theducks (Post 3737640)
Check out the default "saved Searches", Early versions of sigil had to groups of searches. Promote Headings and Demote headings. that would do 1 level at a time (without editing the replace :D term )

Thanks, but I'm not following. I have the current version of Sigil (0.9.10). Where do I look for this?

DiapDealer 08-17-2018 06:11 PM

Quote:

Originally Posted by odamizu (Post 3737929)
Perfect! This works great and is something within my limited skill set :)

Great!
I'm hoping you caught/fixed my copy/paste mistake that I just corrected in that 2nd change. :o

odamizu 08-17-2018 10:29 PM

Oh! I didn't notice any mistake. I edited plugin.py manually once your instructions pointed me in the right direction, so I didn't copy/paste.

Thanks again! The more I use Sigil and its plug-ins, the more I love it.

DiapDealer 08-17-2018 10:46 PM

Quote:

Originally Posted by odamizu (Post 3738027)
Oh! I didn't notice any mistake. I edited plugin.py manually once your instructions pointed me in the right direction, so I didn't copy/paste.

Thanks again! The more I use Sigil and its plug-ins, the more I love it.

I said "h1_changes" and then pasted "a_changes".
I was hoping it was obvious that the tag name should be the same in both. ;)

p -> p_changes
a -> a_changes
h1 -> h1_changes, etc...

odamizu 08-18-2018 12:28 AM

Ah. Once you pointed me to plugin.py, I used what I found there as a guide, and since what you had there was correct, it worked perfectly :)

Thasaidon 09-27-2018 10:30 PM

Font Size
 
1 Attachment(s)
Hi DiapDealer

I have started using "Tag Mechanic" a lot more recently and am having problems with the font size used. It is just on the edge of the size where my eyes start to blur the text. (please see attached image)

I have made many adjustments to Windows so I can comfortably use Windows but none seem to affect Tag Mechanic.

Please consider enlarging the font in the plugin, if possible.

And I will even start using your shiny blue spanner icon instead of the one I found, honest.:D


All times are GMT -4. The time now is 07:08 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.