Code Monkey home page Code Monkey logo

Comments (7)

alexanderjulo avatar alexanderjulo commented on July 17, 2024

I don't mind the extra dependency if it enables a good solution. What I am worried about is the escaping you are talking about, can you elaborate on why and when it happens?

from wiki.

walkerh avatar walkerh commented on July 17, 2024

The extra dependency is simple and pure-python, so its friendly to a broad spectrum of environments. I agree that the key concerns are about behavior.

from wiki.

traeblain avatar traeblain commented on July 17, 2024

Here's my Usability concerns:

  1. Included WikiLinks support:

    If I had a paragraph that I wanted to render as follows:

    In this scenario the fatigue stress is lower than the yield stress due to material properties.

    I could do this:

    In this scenario the [[fatigue stress]] is lower than the [[yield stress]] due to material properties.

    But that would yield:

    In this scenario the fatigue stress is lower than the yield stress due to material properties.

    The links are not the same. So I would have to reword it:

    In this scenario the [[strength/fatigue]] is lower than the [[strength/yield]] due to material properties.

    Yielding:

    In this scenario the strength/fatigue is lower than the strength/fatigue due to material properties.

    That is ugly and sort of removes some context to the statement. There's no real easy way to fix this with the default extension.

  2. With the semantic wikilinks extension, it is a bit easier:

    I can get exactly what I want by typing my WikiLinks like this:

    In this scenario the [[/strength/fatigue|fatigue stress]] is lower than the [[/strength/yield|yield stress]] due to material properties.

    This outputs exactly what I need (it also pays attention to absolute and relative paths). But what if I just want to use the defaults [[]] behavior? Say I'm on the page: /tolerance_example/

    If you like this, then the [[Tolerance Toolbox]] can elaborate on everything explained here.

    This would yield:

    If you like this, then the [Tolerance Toolbox](/tolerance_example/Tolerance Toolbox) can elaborate on everything explained here.

    As you can see the link is wrong, implying that it's a sub-page of tolerance_example as well as maintaining capitalization and spaces. So we use it's config feature to correct for all this:

    def wikilink_builder(self, md, rel, target, label):
        link = target.lower().replace(' ', '_')
        output = '<a rel="{0}" href="/{1}">{2}</a>'.format(rel, link, label or target)
        return output

    This breaks everything out and assumes it's at the root (meaning to go to subpages you'll need to use the [[first/second|Title]] syntax). I thought this would work well, but the output is actually:

    If you like this, then the &lt;a rel="None" href="/tolerance_toolbox"&gt;Tolerance Toolbox&lt;/a&gt; can elaborate on everything explained here.

So as you can see, I haven't quite figured out the best option. I think the Semantic Wikilinks is the best way to go. But it may require me to dig into that code to submit a bug report, not completely sure at this point.

from wiki.

alexanderjulo avatar alexanderjulo commented on July 17, 2024

as far as I understood from a quick check from the readme, it appears that it is not a string that is expected as a return element but much rather some type of etree.Element instance? Might this be the issue here?

from wiki.

traeblain avatar traeblain commented on July 17, 2024

Yeah, I looked into it early on. What I got was an error:

TypeError: must be Element, not Element

Since that is so informative, I tried making it a string. I figured it would simply pass the string, but it wasn't. So I'll go back and try to figure out which Element it wants.

from wiki.

mgaitan avatar mgaitan commented on July 17, 2024

I've added autolinking support In restructuredtext with a very simple trick: just try to render the document: every missing link is reported as an error so retry but adding (manipulating the content input) the missing links targets as "internal wiki links" (using the same urlifing function we use when create a new page).

See mgaitan@3341a8f92dc3da78 for details

from wiki.

traeblain avatar traeblain commented on July 17, 2024

Closed. Ref: #36

from wiki.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.