Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag Hierarchy as defined in #+TAGS #341

Closed
tabroughton opened this issue Apr 4, 2020 · 7 comments · Fixed by #506
Closed

Tag Hierarchy as defined in #+TAGS #341

tabroughton opened this issue Apr 4, 2020 · 7 comments · Fixed by #506

Comments

@tabroughton
Copy link

I wondered if it would be possible to export tags with hierarchy defined in the org-mode #TAGS

https://orgmode.org/manual/Tag-Hierarchy.html

@kaushalmodi
Copy link
Owner

We will need to define a little spec on how we want that to behave when exporting to Hugo tags.

Let's take the example from the manual:


You can set group tags by using brackets and inserting a colon between the group tag and its related tags—beware that all whitespaces are mandatory so that Org can parse this line correctly:

#+TAGS: [ GTD : Control Persp ]

In this example, ‘GTD’ is the group tag and it is related to two other tags: ‘Control’, ‘Persp’. Defining ‘Control’ and ‘Persp’ as group tags creates a hierarchy of tags:

#+TAGS: [ Control : Context Task ]
#+TAGS: [ Persp : Vision Goal AOF Project ]

That can conceptually be seen as a hierarchy of tags:

    ‘GTD’
        ‘Persp’
            ‘Vision’
            ‘Goal’
            ‘AOF’
            ‘Project’ 
        ‘Control’
            ‘Context’
            ‘Task’ 

Given above, if a post is tagged "Vision", should its tags front-matter look like below? :

tags = ["GTD", "Persp", "Vision"]

As an aside, have you tried out tags inheritance in sub-tree based exports?

image


PS: I am currently bogged down with work stuff, but we can atleast start defining the spec in parallel.

@tabroughton
Copy link
Author

Given above, if a post is tagged "Vision", should its tags front-matter look like below? :

I like your approach using the org-mode examples. Yes I agree that the front matter tags should look as you have specified given the structure and then tagging a something with :Vision:

This would be an excellent feature because I want to use various tags from different inheritance trees as it were for example, using the example you have laid out I might want to tag with both :Vision: and :Task: which should result in the following front matter:

tags = ["GTD", "Persp", "Vision", "Control", "Task"]

I can't do this with sub-tree inheritance even though in my personal approach I do use sub-tree based exports.

@tabroughton
Copy link
Author

I imagine the spec would maintain the ox-hugo use of _ (underscore) and __ (double underscore) within tag text of the defined #+TAGS resulting in either a hyphen - or a space respectively.

@tabroughton
Copy link
Author

It could also be possible to mix tags and categories within the definition. So if we changed one of the examples to include the @ sign

#+TAGS: [ @Persp : Vision Goal AOF Project ]

And then tag with :Vision: again, the exported front matter would now be something like:

tags = ["GTD", "Vision"]
categories = ["Persp"]

This is how org-mode can be configured and I think it would be quite a powerful feature

@tabroughton
Copy link
Author

PS: I am currently bogged down with work stuff, but we can atleast start defining the spec in parallel.

Is there anything I can do to help spec this further?

@kaushalmodi
Copy link
Owner

Hi Tom, no, I have enough data to start implementing this feature. I just need time to implement this.

@kaushalmodi
Copy link
Owner

@tabroughton This is now implemented in #506. It might not be the best algorithm to do the reverse search from each tag to the tag group's head, but it works 😄 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants