Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add funnelweb with pandoc converter to buildout for anyone to convert…
… html manuals to .rst
- Loading branch information
Showing
5 changed files
with
137 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
|
|||
[transmogrifier] | |||
include = funnelweb.remote | |||
|
|||
pipeline = | |||
crawler | |||
cache | |||
typeguess | |||
# drop | |||
template1 | |||
urltidy | |||
pandoc | |||
localupload | |||
|
|||
[crawler] | |||
#url=http://plone.org/documentation/manual/theme-reference | |||
url = http://plone.org/documentation/manual/developer-manual/generic-setup | |||
ignore= | |||
.css | |||
.js | |||
-all-pages | |||
[cache] | |||
[typeguess] | |||
|
|||
[template1] | |||
#title= text //h1[@class="documentFirstHeading"] | |||
text= html //div[@id="content"] | |||
_delete= optional //div[@class="visualNoPrint"] | |||
_delete2= optional //div[@class="documentByLine"] | |||
|
|||
[pandoc] | |||
blueprint = transmogrify.command | |||
commands = pandoc --from=html --to=rst | |||
input-key = text | |||
output-key = text | |||
|
|||
[urltidy] | |||
link_expr = python:(item['_path'].rsplit('.',1)[-1] in ['html','asp','php'] and item['_path'].rsplit('.',1)[0] or item['_path'])+".rst" | |||
use_title = python:False | |||
invalid_ids = | |||
security | |||
sharing | |||
|
|||
|
|||
# Save locally for debugging purposes | |||
[localupload] | |||
output=manual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
[transmogrifier] | |||
include = funnelweb.remote | |||
|
|||
[crawler] | |||
url=file:build/html | |||
ignore= | |||
cgi-bin | |||
javascript: | |||
_static | |||
_sources | |||
genindex\.html | |||
search\.html | |||
saesrchindex\.js | |||
|
|||
[template1] | |||
title = text //div[@class='body']//h1[1] | |||
description = optional //div[contains(@class,'admonition-description')]/p[@class='last']/text() | |||
text = html //div[@class='body'] | |||
# Fields with '_' won't be uploaded to Plone so will be effectively removed | |||
_permalink = text //div[@class='body']//a[@class='headerlink'] | |||
_label = optional //p[contains(@class,'admonition-title')] | |||
_remove_useless_links = optional //div[@id = 'indices-and-tables'] | |||
|
|||
# Images will get titles from backlink text | |||
[titleguess] | |||
condition = python:True | |||
|
|||
# Pages linked to content will be moved together | |||
[indexguess] | |||
condition = python:False | |||
|
|||
# Hide the images folder from navigation | |||
[hideguess] | |||
condition = python:item.get("_path","").startswith('_images') and item.get('_type')=='Folder' | |||
|
|||
# Upload as PHC instead of Folders and Pages | |||
[changetype] | |||
value=python:{'Folder':'HelpCenterReferenceManualSection','Document':'HelpCenterLeafPage'}.get(item['_type'],item['_type']) | |||
|
|||
# Save locally for debugging purposes | |||
[localupload] | |||
output=manual | |||
|
|||
# All folderish content should be checked if they contain | |||
# any items on the remote site which are not presented locally. including base folder | |||
[ploneprune] | |||
condition=python:item.get('_type') in ['HelpCenterReferenceManualSection','HelpCenterReferenceManual'] or item['_path'] == '' |