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

doclicense: provide URL to legalcode #17

Open
cdlm opened this issue May 22, 2017 · 4 comments
Open

doclicense: provide URL to legalcode #17

cdlm opened this issue May 22, 2017 · 4 comments

Comments

@cdlm
Copy link

cdlm commented May 22, 2017

The URL in \doclicenseURL points to the online human-readable description of the license.

It would be nice to provide a similar macro that points to the online full text of the license (ending in /legalcode instead of e.g. /deed.en).

@ypid
Copy link
Owner

ypid commented May 22, 2017

Could be done with an optional parameter I guess. \doclicenseURL would default to the overview page and \doclicenseURL[full-license] could expand to the full license text. Want to give it a try?

@cdlm
Copy link
Author

cdlm commented May 22, 2017

Sure 👍
Not before later this week, though, so feel free to go forward if you get the time before me.

@sammaddens
Copy link

One possibility is to define two new commands \doclicenseURLS (deed = Short) and \doclicenseURLL (legalcode = Long). The original \doclicenseURL gives the one from the package settings. Change the code as follows.

  • Add the option urlform with deed as default.

    \DeclareStringOption[deed]{urlform}
  • Change the code of doclicense@UrlLangPart for setting up the correct URL path.

        \ifcsdef{doclicense@UrlLangPart}{}{%
        \ifthenelse{\equal{\doclicense@lang@lic@CC@code}{}}{%
          \edef\doclicense@UrlLangPart{}
        }{%
          \edef\doclicense@UrlLangPart{/\doclicense@urlformUsed.\doclicense@lang@lic@CC@code}%COMMENT Replaced "deed" by "\doclicense@urlformUsed"
        }
  • Replace \doclicense@set with the code below to define all the URL commands.

    \newcommand{\doclicenseUrlform@set}{%
      \let\doclicenseURL\undefined%
      \let\doclicense@UrlLangPart\undefined%
      \edef\doclicense@urlformUsed{deed}%
      \doclicense@set%
      \edef\doclicenseURLS{\doclicenseURL}%
      %
      \let\doclicenseURL\undefined%
      \let\doclicense@UrlLangPart\undefined%
      \edef\doclicense@urlformUsed{legalcode}%
      \doclicense@set%
      \edef\doclicenseURLL{\doclicenseURL}%
      %
      \let\doclicenseURL\undefined%
      \let\doclicense@UrlLangPart\undefined%
      \edef\doclicense@urlformUsed{\doclicense@urlform}%
      \doclicense@set%
      %
      \ifthenelse{\equal{\doclicense@urlform}{deed}}{}{%
        \ifthenelse{\equal{\doclicense@urlform}{legalcode}}{}{%
          \PackageWarningNoLine{doclicense}{"\doclicense@urlform" is not a supported urlform. Please use "deed" or "legalcode"}%
        }%
      }%
    }
    
    \doclicenseUrlform@set%

@ypid
Copy link
Owner

ypid commented Aug 21, 2019

One possibility is to define two new commands \doclicenseURLS (deed = Short) and \doclicenseURLL (legalcode = Long). The original \doclicenseURL gives the one from the package settings. Change the code as follows.

I am not sure about this. I would rather prefer \doclicenseURL[legalcode] and \doclicenseURL[deed] as I suggested above. This should help keep doclicense generic. Maybe there will be a third URL variant. Maybe other license types (like the GPL) do this differently. Feel free to work on this and open a pull request.

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

No branches or pull requests

3 participants