From 806eca41cc2f1caae2dc07c78ed3551a35bc3607 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Fri, 31 Aug 2018 12:01:07 -0400 Subject: [PATCH] More link fixing! Thanks to https://github.com/wjdp/htmltest. --- CONTRIBUTING.org | 2 +- README.org | 16 ++++---- doc/.htmltest.yml | 93 ++++++++++++++++++++++++++++++++++++++++++ doc/config.toml | 2 +- doc/github-files.org | 12 ++++-- doc/ox-hugo-manual.org | 42 ++++++++++--------- 6 files changed, 133 insertions(+), 34 deletions(-) create mode 100644 doc/.htmltest.yml diff --git a/CONTRIBUTING.org b/CONTRIBUTING.org index aa92e15..e6ea128 100644 --- a/CONTRIBUTING.org +++ b/CONTRIBUTING.org @@ -30,7 +30,7 @@ code contributor needs to have both ~pandoc~ and ~pandoc-citeproc~ installed[fn:-1-local1]. These are needed for ~make md~ and ~make -j1 test~ steps to work as -they use/test the [[https://ox-hugo.scripter.co/doc/pandoc-citations][Pandoc Citations]] feature +they use/test the [[https://ox-hugo.scripter.co/doc/pandoc-citations/][Pandoc Citations]] feature too. #+END_note diff --git a/README.org b/README.org index c812ccd..1d47f68 100644 --- a/README.org +++ b/README.org @@ -63,9 +63,9 @@ You can generate the same too! Simply clone this repo and do =make doc_md=. *Make sure you visit the above link to read more on:* -- [[https://ox-hugo.scripter.co/doc/why-ox-hugo][Why =ox-hugo=?]] -- [[https://ox-hugo.scripter.co/doc/auto-export-on-saving][Auto exporting to Markdown each time the Org file is saved]] -- [[https://ox-hugo.scripter.co/doc/org-capture-setup][Using Org Capture to start a new blog post]] +- [[https://ox-hugo.scripter.co/doc/why-ox-hugo/][Why =ox-hugo=?]] +- [[https://ox-hugo.scripter.co/doc/auto-export-on-saving/][Auto exporting to Markdown each time the Org file is saved]] +- [[https://ox-hugo.scripter.co/doc/org-capture-setup/][Using Org Capture to start a new blog post]] - .. and many more topics and examples ** Source of the Documentation site - [[https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/doc/ox-hugo-manual.org][Org source]] @@ -106,7 +106,7 @@ If you use [[https://github.com/jwiegley/use-package][=use-package=]], you can d (use-package ox-hugo-auto-export) ;If you want the auto-exporting on file saves #+END_SRC -Also see the [[https://ox-hugo.scripter.co/doc/auto-export-on-saving][Auto Exporting]] section. +Also see the [[https://ox-hugo.scripter.co/doc/auto-export-on-saving/][Auto Exporting]] section. *Spacemacs* @@ -350,7 +350,7 @@ available customization options for this package. - Add missing http/https/ftp prefix for hyper-linked images. *** Meta - Add documentation on how you can have - [[https://ox-hugo.scripter.co/doc/images-in-content][Images live in the same directory as Org + [[https://ox-hugo.scripter.co/doc/images-in-content/][Images live in the same directory as Org source]] -- #[[https://github.com/kaushalmodi/ox-hugo/issues/91][91]]. - Now only Org files for the [[https://ox-hugo.scripter.co][documentation site]] need to be committed to git. =ox-hugo= then exports those to Markdown, and then Hugo @@ -361,7 +361,7 @@ available customization options for this package. yourself :smile:. ** v0.5 <2017-11-06 Mon> *** Features -- Export TOC as a Markdown ordered list. See [[https://ox-hugo.scripter.co/doc/org-toc][Table of +- Export TOC as a Markdown ordered list. See [[https://ox-hugo.scripter.co/doc/org-toc/][Table of Contents]] -- #[[https://github.com/kaushalmodi/ox-hugo/issues/88][88]]. - =#+attr_html= above http/https/ftp links is now supported (useful for specifying the =target=, =rel=, attributes, for example). @@ -395,7 +395,7 @@ available customization options for this package. set categories (tags with "@") globally in the file. See the new section added to documentation: -[[https://ox-hugo.scripter.co/doc/tags-and-categories][*Tags and Categories*]] +[[https://ox-hugo.scripter.co/doc/tags-and-categories/][*Tags and Categories*]] *** Features - Support specifying the =:width= parameter in the =#+attr_html= above image links. That eventually gets transformed to the =width= @@ -415,7 +415,7 @@ See the new section added to documentation: - Source blocks can now be exported with line numbers and/or highlighting! - See [[https://ox-hugo.scripter.co/doc/source-blocks][Source Blocks]] for details. + See [[https://ox-hugo.scripter.co/doc/source-blocks/][Source Blocks]] for details. ** v0.2.3 <2017-10-11 Wed> *** Fixes - =org-hugo-slug= earlier stripped off only the =code= HTML tag diff --git a/doc/.htmltest.yml b/doc/.htmltest.yml new file mode 100644 index 0000000..a9a2150 --- /dev/null +++ b/doc/.htmltest.yml @@ -0,0 +1,93 @@ +# Config file for htmltest +# https://github.com/wjdp/htmltest + +# CacheExpires: "336h" +# CheckAnchors: true +# CheckDoctype: true +# CheckExternal: true +# CheckFavicon: false +# CheckGeneric: true +# CheckImages: true +# CheckInternal: true +# CheckInternalHash: true +# CheckLinks: true +# CheckMailto: true +# CheckMeta: true +# CheckMetaRefresh: true +# CheckScripts: true +# CheckTel: true +# DirectoryIndex: "index.html" +DirectoryPath: "public" +# DocumentConcurrencyLimit: 128 +# EnforceHTML5: false +EnforceHTTPS: true +# ExternalTimeout: 15 +# FileExtension: ".html" +# FilePath: "" +# HTTPConcurrencyLimit: 16 +# HTTPHeaders: {"Range": "bytes=0-0", "Accept": "*/*"} +# IgnoreAltMissing: false +# IgnoreCanonicalBrokenLinks: true +# IgnoreDirectoryMissingTrailingSlash: false +IgnoreDirs: # Need to ignore the below 2 dirs as they have meta redirects; else htmltest crashes. +- "issues" # https://github.com/wjdp/htmltest/issues/92 +- "test" +IgnoreInternalEmptyHash: true +# IgnoreTagAttribute: "data-proofer-ignore" +# IgnoreURLs: +# LogLevel: 2 +# LogSort: "document" +# OutputCacheFile: "refcache.json" +# OutputDir: "tmp/.htmltest" +# OutputLogFile: "htmltest.log" +# StripQueryExcludes: ["fonts.googleapis.com"] +# StripQueryString: true +# TestFilesConcurrently: false + +# |-------------------------------------+----------------------------------------------------------------------------------------------------------+-----------------------------------------| +# | OPTION | DESCRIPTION | DEFAULT | +# |-------------------------------------+----------------------------------------------------------------------------------------------------------+-----------------------------------------| +# | CacheExpires | Cache validity period, accepts go.time duration strings (…"m", "h"). | 336h (two weeks) | +# | CheckAnchors | Enables checking . | false | +# | EnforceHTTPS | Fails when encountering an http:// link. Useful to prevent mixed content errors when serving over HTTPS. | false | +# | ExternalTimeout | Number of seconds to wait on an HTTP connection before failing. | 15 | +# | FileExtension | Extension of your HTML documents, includes the dot. If FilePath is set we use the extension from that. | .html | +# | FilePath | Single file to test within DirectoryPath, omit to test all. | filee | +# | HTTPConcurrencyLimit | Maximum number of open HTTP connections. If you raise this number ensure the ExternalTimeout | 16 | +# | | is suitably raised. | | +# | HTTPHeaders | Dictionary of headers to include in external requests | {"Range": "bytes=0-0", "Accept": "*/*"} | +# | IgnoreAltMissing | Turns off image alt attribute checking. | false | +# | IgnoreCanonicalBrokenLinks | When true produces a warning, rather than an error, for broken canonical links. When testing a site | true | +# | | which isn't live yet or before publishing a new page canonical links will fail. | | +# | IgnoreDirectoryMissingTrailingSlash | Turns off errors for links to directories without a trailing slash. | false | +# | IgnoreDirs | Array of regexs of directories to ignore when scanning for HTML files. | empty | +# | IgnoreInternalEmptyHash | When true prevents raising an error for links with href="#". | false | +# | IgnoreTagAttribute | Specify the ignore attribute. All tags with this attribute will be excluded from every check. | "data-proofer-ignore" | +# | IgnoreURLs | Array of regexs of URLs to ignore. | empty | +# | LogLevel | Logging level, 0-3: debug, info, warning, error. | 2 | +# | LogSort | How to sort/present issues. Can be seq for sequential output or document to group by document. | document | +# | OutputCacheFile | File within OutputDir to store reference cache. | refcache.json | +# | OutputDir | Directory to store cache and log files in. Relative to executing directory. | tmp/.htmltest | +# | OutputLogFile | File within OutputDir to store last tests errors. | htmltest.log | +# | StripQueryExcludes | List of URLs to disable query stripping on. | ["fonts.googleapis.com"] | +# | StripQueryString | Enables stripping of query strings from external checks. | true | +# | TestFilesConcurrently | ⚠️ 🚧 EXPERIMENTAL Turns on concurrent checking of files. | false | +# |-------------------------------------+----------------------------------------------------------------------------------------------------------+-----------------------------------------| diff --git a/doc/config.toml b/doc/config.toml index 80a9683..31752ef 100644 --- a/doc/config.toml +++ b/doc/config.toml @@ -1,4 +1,4 @@ -baseURL = "https://example.org/" +baseURL = "https://ox-hugo.scripter.co/" Title = "ox-hugo - Org to Hugo exporter" theme = ["hugo-debugprint", "hugo-onyx-theme"] diff --git a/doc/github-files.org b/doc/github-files.org index 3245e51..b747fc6 100644 --- a/doc/github-files.org +++ b/doc/github-files.org @@ -4,7 +4,7 @@ #+setupfile: doc-setupfile.org #+macro: imageclick [[https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/doc/static/images/$1][https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/doc/static/images/$1]] -#+macro: doc [[https://ox-hugo.scripter.co/doc/$1][$2]] +#+macro: doc [[https://ox-hugo.scripter.co/doc/$1/$2][$3]] * Readme :readme: @@ -36,9 +36,9 @@ You can generate the same too! Simply clone this repo and do =make doc_md=. *Make sure you visit the above link to read more on:* -- {{{doc(why-ox-hugo,Why =ox-hugo=?)}}} -- {{{doc(auto-export-on-saving,Auto exporting to Markdown each time the Org file is saved)}}} -- {{{doc(org-capture-setup,Using Org Capture to start a new blog post)}}} +- {{{doc(why-ox-hugo,,Why =ox-hugo=?)}}} +- {{{doc(auto-export-on-saving,,Auto exporting to Markdown each time the Org file is saved)}}} +- {{{doc(org-capture-setup,,Using Org Capture to start a new blog post)}}} - .. and many more topics and examples *** Source of the Documentation site - [[https://raw.githubusercontent.com/kaushalmodi/ox-hugo/master/doc/ox-hugo-manual.org][Org source]] @@ -66,3 +66,7 @@ export from Org to Markdown, and then finally =hugo=. #+include: "./ox-hugo-manual.org::#debug" :only-contents t ** Test #+include: "./ox-hugo-manual.org::#test" :only-contents t +* COMMENT Local Variables :ARCHIVE: +# Local Variables: +# org-hugo-auto-export-on-save: nil +# End: diff --git a/doc/ox-hugo-manual.org b/doc/ox-hugo-manual.org index d761beb..99176cf 100644 --- a/doc/ox-hugo-manual.org +++ b/doc/ox-hugo-manual.org @@ -9,7 +9,7 @@ #+setupfile: doc-setupfile.org #+macro: imageclick [[file:./static/images/$1][file:/images/$1]] -#+macro: doc [[/doc/$1][$2]] +#+macro: doc [[/doc/$1/$2][$3]] * Changelog :PROPERTIES: @@ -187,7 +187,7 @@ - Add missing http/https/ftp prefix for hyper-linked images. *** Meta - Add documentation on how you can have - {{{doc(images-in-content,Images live in the same directory as Org + {{{doc(images-in-content,,Images live in the same directory as Org source)}}} -- {{{issue(91)}}}. - Now only Org files for the [[https://ox-hugo.scripter.co][documentation site]] need to be committed to git. =ox-hugo= then exports those to Markdown, and then Hugo @@ -198,7 +198,7 @@ yourself :smile:. ** v0.5 <2017-11-06 Mon> *** Features -- Export TOC as a Markdown ordered list. See {{{doc(org-toc,Table of +- Export TOC as a Markdown ordered list. See {{{doc(org-toc,,Table of Contents)}}} -- {{{issue(88)}}}. - =#+attr_html= above http/https/ftp links is now supported (useful for specifying the =target=, =rel=, attributes, for example). @@ -232,7 +232,7 @@ set categories (tags with "@") globally in the file. See the new section added to documentation: -{{{doc(tags-and-categories,*Tags and Categories*)}}} +{{{doc(tags-and-categories,,*Tags and Categories*)}}} *** Features - Support specifying the =:width= parameter in the =#+attr_html= above image links. That eventually gets transformed to the =width= @@ -252,7 +252,7 @@ See the new section added to documentation: - Source blocks can now be exported with line numbers and/or highlighting! - See {{{doc(source-blocks,Source Blocks)}}} for details. + See {{{doc(source-blocks,,Source Blocks)}}} for details. ** v0.2.3 <2017-10-11 Wed> *** Fixes - =org-hugo-slug= earlier stripped off only the =code= HTML tag @@ -413,7 +413,7 @@ If you use [[https://github.com/jwiegley/use-package][=use-package=]], you can d (use-package ox-hugo-auto-export) ;If you want the auto-exporting on file saves #+end_src -Also see the {{{doc(auto-export-on-saving,Auto Exporting)}}} section. +Also see the {{{doc(auto-export-on-saving,,Auto Exporting)}}} section. *Spacemacs* @@ -573,7 +573,7 @@ code contributor needs to have both ~pandoc~ and ~pandoc-citeproc~ installed[fn:local1]. These are needed for ~make md~ and ~make -j1 test~ steps to work as -they use/test the {{{doc(pandoc-citations,Pandoc Citations)}}} feature +they use/test the {{{doc(pandoc-citations,,Pandoc Citations)}}} feature too. #+end_note @@ -623,7 +623,7 @@ error backtrace, 1. Clone this repo. 2. Ensure that ~pandoc~ and ~pandoc-citeproc~ (at least version {{{pandoc_version}}}) are installed (more info - {{{doc(contributing-guide/#contribute-to-code,here)}}}). + {{{doc(contributing-guide,#contribute-to-code,here)}}}). 3. Run =make -j1 test=. ** Thanks :PROPERTIES: @@ -758,7 +758,7 @@ have the exported Markdown files. - [[https://github.com/kaushalmodi/ox-hugo/tree/master/doc][=ox-hugo= documentation site (you're reading it)]] - [[https://github.com/kaushalmodi/ox-hugo/tree/master/test/site][=ox-hugo= test site]] - [[https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io][/scripter.co/ -- My blog]] -5. Create an Org file in there and follow the {{{doc(usage,*Usage*)}}} +5. Create an Org file in there and follow the {{{doc(usage,,*Usage*)}}} section to export it. *** Blogging Flow :PROPERTIES: @@ -774,10 +774,10 @@ There are 2 major blogging flows that can be used with this package: translate to post =draft= state, auto weight calculation for pages, taxonomies and menu items, etc. -See the {{{doc(org-capture-setup,Org Capture Setup)}}} page to see how +See the {{{doc(org-capture-setup,,Org Capture Setup)}}} page to see how to quickly create new posts. -See the {{{doc(auto-export-on-saving,Auto-export on Saving)}}} page to +See the {{{doc(auto-export-on-saving,,Auto-export on Saving)}}} page to learn how to setup up seeing live-preview of the Hugo-rendered HTML each time you do =C-x C-s= in the Org file. That section explains how to set that up for either of the above two blogging flows. @@ -809,7 +809,7 @@ exported Markdown files. #+end_example 2. Ensure that ~pandoc~ and ~pandoc-citeproc~ (at least version {{{pandoc_version}}}) are installed (more info - {{{doc(contributing-guide/#contribute-to-code,here)}}}). + {{{doc(contributing-guide,#contribute-to-code,here)}}}). 3. Start the =hugo= server: #+begin_example make serve HUGO_BASE_DIR=test/site @@ -830,7 +830,7 @@ exported Markdown files. #+end_example 2. Ensure that ~pandoc~ and ~pandoc-citeproc~ (at least version {{{pandoc_version}}}) are installed (more info - {{{doc(contributing-guide/#contribute-to-code,here)}}}). + {{{doc(contributing-guide,#contribute-to-code,here)}}}). 3. =cd= to the =test/site/= directory and do: #+begin_example hugo server -D --navigateToChanged @@ -930,7 +930,7 @@ set. For the file-based exports, the weights have to be specified manually. Any /weight/ assignment to ="auto"= for file-based exports is ignored. -- See {{{doc(dates#org-hugo-date-format,=org-hugo-date-format=)}}} for +- See {{{doc(dates,#org-hugo-date-format,=org-hugo-date-format=)}}} for customizing the date formats for all /date/ front-matter parameters. *** Formatting :PROPERTIES: @@ -1162,7 +1162,7 @@ copied location inside =static=: | =~/temp/static/articles/zoo.pdf= | =/static/articles/zoo.pdf= | (same as above) | |----------------------------------+-------------------------------------------+----------------------------------------------------------------------------------------------------------| -See the {{{doc(usage#before-you-export,Usage → Before you export)}}} +See the {{{doc(usage,#before-you-export,Usage → Before you export)}}} section to learn how to set the *HUGO_BASE_DIR*. ***** Source path does not contain =/static/= Here is an example link where the source path does not contain @@ -1365,7 +1365,7 @@ Then in your batch export setup, add that special tag to the =org-export-exclude-tags= variable. You can grep through this repo for the special tag =dont_export_during_make_test= that is used to mark few Org files to not be exported when running the -{{{doc(test,tests)}}}. +{{{doc(test,,tests)}}}. ****** Why use =#+filetags= and not =#+tags=? - About =#+filetags= -- [[https://orgmode.org/manual/Tag-inheritance.html][Tag Inheritance]] or =C-h i g (org) Tag inheritance= @@ -2047,7 +2047,7 @@ accessed at =/foo.png=. More detail for this conventional approach can be found in the documentation for -{{{doc(image-links#references-to-files-in-the-static-directory,referencing +{{{doc(image-links,#references-to-files-in-the-static-directory,referencing files in static directory)}}}. **** But.. what about putting images along with the content? OK, so with that short intro out of the way, =ox-hugo= supports @@ -2091,6 +2091,8 @@ exported Markdown files. Also as the image file references are valid within the Org file, you can see those images inline too! + +#+attr_html: :alt Screenshot of an Org mode buffer showing image in content [[file:/images/images-in-content-screenshot.png]] **** Examples Whether you prefer the subtree-based approach or file-based approach @@ -2357,10 +2359,10 @@ and /mark.js/. -- [[https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1 doc_md hugo_doc=). - [X] GitHub repo files: [[https://github.com/kaushalmodi/ox-hugo/blob/master/README.org][~README.org~]] and [[https://github.com/kaushalmodi/ox-hugo/blob/master/CONTRIBUTING.org][~CONTRIBUTING.org~]] -- Generated using =ox-org= (=make doc_gh=). -- [X] [[../test][Test site]] -- Regenerated after each commit to this repo (=make +- [X] [[../test/][Test site]] -- Regenerated after each commit to this repo (=make test=). - [X] Passes =make test= and generates documentation using =make doc= - in [[https://play.google.com/store/apps/details?id=com.termux&hl=en][Termux]] app on Android too. + in [[https://termux.com/][Termux]] app on Android too. - [X] Passes =checkdoc= and =package-lint= ([[https://github.com/purcell/package-lint/issues/89][/almost/]]). *** Contributing Guide :PROPERTIES: @@ -2415,7 +2417,7 @@ Org style tags too. Example: ~* I don't want to export this post [fn:1] To understand why the attachment files get copied to the =static/ox-hugo/= directory, have a look at the documentation for -{{{doc(image-links#references-to-files-outside-the-static-directory,referencing +{{{doc(image-links,#references-to-files-outside-the-static-directory,referencing files outside static directory)}}}. * COMMENT Local Variables :ARCHIVE: # Local Variables: